Compare commits
1 Commits
dev
...
197-shared
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42d46712cd |
4
.github/agents/copilot-instructions.md
vendored
4
.github/agents/copilot-instructions.md
vendored
@ -186,6 +186,8 @@ ## Active Technologies
|
|||||||
- PostgreSQL via existing `operation_runs.type`, `operation_runs.context`, `baseline_profiles.scope_jsonb`, `baseline_snapshot_items`, findings, evidence payloads, and current config-backed registries; no new top-level tables planned (204-platform-core-vocabulary-hardening)
|
- PostgreSQL via existing `operation_runs.type`, `operation_runs.context`, `baseline_profiles.scope_jsonb`, `baseline_snapshot_items`, findings, evidence payloads, and current config-backed registries; no new top-level tables planned (204-platform-core-vocabulary-hardening)
|
||||||
- PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `BaselineCompareService`, `CompareBaselineToTenantJob`, `CompareStrategyRegistry`, `IntuneCompareStrategy`, `CurrentStateHashResolver`, and current finding lifecycle services (205-compare-job-cleanup)
|
- PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `BaselineCompareService`, `CompareBaselineToTenantJob`, `CompareStrategyRegistry`, `IntuneCompareStrategy`, `CurrentStateHashResolver`, and current finding lifecycle services (205-compare-job-cleanup)
|
||||||
- PostgreSQL via existing baseline snapshots, baseline snapshot items, inventory items, `operation_runs`, findings, and current run-context JSON; no new storage planned (205-compare-job-cleanup)
|
- PostgreSQL via existing baseline snapshots, baseline snapshot items, inventory items, `operation_runs`, findings, and current run-context JSON; no new storage planned (205-compare-job-cleanup)
|
||||||
|
- PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Tailwind CSS v4, existing `VerificationReportViewer`, `VerificationReportChangeIndicator`, `PolicyNormalizer`, `VersionDiff`, `DriftFindingDiffBuilder`, and `SettingsCatalogSettingsTable` (197-shared-detail-contract)
|
||||||
|
- PostgreSQL unchanged; no new persistence, cache store, or durable UI artifact (197-shared-detail-contract)
|
||||||
|
|
||||||
- PHP 8.4.15 (feat/005-bulk-operations)
|
- PHP 8.4.15 (feat/005-bulk-operations)
|
||||||
|
|
||||||
@ -220,8 +222,8 @@ ## Code Style
|
|||||||
PHP 8.4.15: Follow standard conventions
|
PHP 8.4.15: Follow standard conventions
|
||||||
|
|
||||||
## Recent Changes
|
## Recent Changes
|
||||||
|
- 197-shared-detail-contract: Added PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Tailwind CSS v4, existing `VerificationReportViewer`, `VerificationReportChangeIndicator`, `PolicyNormalizer`, `VersionDiff`, `DriftFindingDiffBuilder`, and `SettingsCatalogSettingsTable`
|
||||||
- 205-compare-job-cleanup: Added PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `BaselineCompareService`, `CompareBaselineToTenantJob`, `CompareStrategyRegistry`, `IntuneCompareStrategy`, `CurrentStateHashResolver`, and current finding lifecycle services
|
- 205-compare-job-cleanup: Added PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `BaselineCompareService`, `CompareBaselineToTenantJob`, `CompareStrategyRegistry`, `IntuneCompareStrategy`, `CurrentStateHashResolver`, and current finding lifecycle services
|
||||||
- 204-platform-core-vocabulary-hardening: Added PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `GovernanceSubjectTaxonomyRegistry`, `BaselineScope`, `CompareStrategyRegistry`, `OperationCatalog`, `OperationRunType`, `ReasonTranslator`, `ReasonResolutionEnvelope`, `ProviderReasonTranslator`, and current Filament monitoring or review surfaces
|
- 204-platform-core-vocabulary-hardening: Added PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `GovernanceSubjectTaxonomyRegistry`, `BaselineScope`, `CompareStrategyRegistry`, `OperationCatalog`, `OperationRunType`, `ReasonTranslator`, `ReasonResolutionEnvelope`, `ProviderReasonTranslator`, and current Filament monitoring or review surfaces
|
||||||
- 203-baseline-compare-strategy: Added PHP 8.4.15 + Laravel 12, Filament v5, Livewire v4, Pest v4, Laravel Sail, existing `BaselineCompareService`, `CompareBaselineToTenantJob`, `SubjectResolver`, `CurrentStateHashResolver`, `DriftHasher`, `BaselineCompareSummaryAssessor`, and finding lifecycle services
|
|
||||||
<!-- MANUAL ADDITIONS START -->
|
<!-- MANUAL ADDITIONS START -->
|
||||||
<!-- MANUAL ADDITIONS END -->
|
<!-- MANUAL ADDITIONS END -->
|
||||||
|
|||||||
@ -1760,6 +1760,8 @@ private function verificationReportViewData(): array
|
|||||||
'previousRunUrl' => null,
|
'previousRunUrl' => null,
|
||||||
'canAcknowledge' => false,
|
'canAcknowledge' => false,
|
||||||
'acknowledgements' => [],
|
'acknowledgements' => [],
|
||||||
|
'surface' => [],
|
||||||
|
'redactionNotes' => [],
|
||||||
'assistVisibility' => $assistVisibility,
|
'assistVisibility' => $assistVisibility,
|
||||||
'assistActionName' => 'wizardVerificationRequiredPermissionsAssist',
|
'assistActionName' => 'wizardVerificationRequiredPermissionsAssist',
|
||||||
'technicalDetailsActionName' => 'wizardVerificationTechnicalDetails',
|
'technicalDetailsActionName' => 'wizardVerificationTechnicalDetails',
|
||||||
@ -1809,7 +1811,28 @@ private function verificationReportViewData(): array
|
|||||||
$targetScope = is_array($targetScope) ? $targetScope : [];
|
$targetScope = is_array($targetScope) ? $targetScope : [];
|
||||||
|
|
||||||
$failures = is_array($run->failure_summary ?? null) ? $run->failure_summary : [];
|
$failures = is_array($run->failure_summary ?? null) ? $run->failure_summary : [];
|
||||||
$verificationReport = VerificationReportViewer::report($run);
|
$surface = VerificationReportViewer::surface($run, $acknowledgements, [
|
||||||
|
'hostKind' => 'onboarding_wizard',
|
||||||
|
'changeIndicator' => $changeIndicator,
|
||||||
|
'previousRunUrl' => $previousRunUrl,
|
||||||
|
'nextStepPlacement' => ($assistVisibility['is_visible'] ?? false) ? 'host_action_zone' : 'shared_zone',
|
||||||
|
'hostActions' => array_values(array_filter([
|
||||||
|
($assistVisibility['is_visible'] ?? false)
|
||||||
|
? ['kind' => 'assist', 'label' => 'View required permissions', 'ownedByHost' => true]
|
||||||
|
: null,
|
||||||
|
['kind' => 'technical_details', 'label' => 'Technical details', 'ownedByHost' => true],
|
||||||
|
$canAcknowledge
|
||||||
|
? ['kind' => 'acknowledge', 'label' => 'Acknowledge', 'ownedByHost' => true]
|
||||||
|
: null,
|
||||||
|
])),
|
||||||
|
'hostVariation' => [
|
||||||
|
'ownsNoRunState' => true,
|
||||||
|
'ownsActiveState' => true,
|
||||||
|
'supportsAssist' => (bool) ($assistVisibility['is_visible'] ?? false),
|
||||||
|
'supportsAcknowledge' => $canAcknowledge,
|
||||||
|
'supportsTechnicalDetailsTrigger' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'run' => [
|
'run' => [
|
||||||
@ -1832,6 +1855,8 @@ private function verificationReportViewData(): array
|
|||||||
'previousRunUrl' => $previousRunUrl,
|
'previousRunUrl' => $previousRunUrl,
|
||||||
'canAcknowledge' => $canAcknowledge,
|
'canAcknowledge' => $canAcknowledge,
|
||||||
'acknowledgements' => $acknowledgements,
|
'acknowledgements' => $acknowledgements,
|
||||||
|
'surface' => $surface,
|
||||||
|
'redactionNotes' => VerificationReportViewer::redactionNotes($report),
|
||||||
'assistVisibility' => $assistVisibility,
|
'assistVisibility' => $assistVisibility,
|
||||||
'assistActionName' => 'wizardVerificationRequiredPermissionsAssist',
|
'assistActionName' => 'wizardVerificationRequiredPermissionsAssist',
|
||||||
'technicalDetailsActionName' => 'wizardVerificationTechnicalDetails',
|
'technicalDetailsActionName' => 'wizardVerificationTechnicalDetails',
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
use App\Filament\Concerns\InteractsWithTenantOwnedRecords;
|
use App\Filament\Concerns\InteractsWithTenantOwnedRecords;
|
||||||
use App\Filament\Concerns\ResolvesPanelTenantContext;
|
use App\Filament\Concerns\ResolvesPanelTenantContext;
|
||||||
use App\Filament\Resources\FindingResource\Pages;
|
use App\Filament\Resources\FindingResource\Pages;
|
||||||
|
use App\Filament\Support\NormalizedDiffSurface;
|
||||||
use App\Models\Finding;
|
use App\Models\Finding;
|
||||||
use App\Models\FindingException;
|
use App\Models\FindingException;
|
||||||
use App\Models\PolicyVersion;
|
use App\Models\PolicyVersion;
|
||||||
@ -412,11 +413,6 @@ public static function infolist(Schema $schema): Schema
|
|||||||
Section::make('Diff')
|
Section::make('Diff')
|
||||||
->visible(fn (Finding $record): bool => $record->finding_type === Finding::FINDING_TYPE_DRIFT)
|
->visible(fn (Finding $record): bool => $record->finding_type === Finding::FINDING_TYPE_DRIFT)
|
||||||
->schema([
|
->schema([
|
||||||
TextEntry::make('diff_unavailable')
|
|
||||||
->label('')
|
|
||||||
->state(fn (Finding $record): string => static::driftDiffUnavailableMessage($record))
|
|
||||||
->visible(fn (Finding $record): bool => ! static::canRenderDriftDiff($record))
|
|
||||||
->columnSpanFull(),
|
|
||||||
ViewEntry::make('rbac_role_definition_diff')
|
ViewEntry::make('rbac_role_definition_diff')
|
||||||
->label('')
|
->label('')
|
||||||
->view('filament.infolists.entries.rbac-role-definition-diff')
|
->view('filament.infolists.entries.rbac-role-definition-diff')
|
||||||
@ -429,13 +425,13 @@ public static function infolist(Schema $schema): Schema
|
|||||||
->state(function (Finding $record): array {
|
->state(function (Finding $record): array {
|
||||||
$tenant = static::resolveTenantContextForCurrentPanel();
|
$tenant = static::resolveTenantContextForCurrentPanel();
|
||||||
if (! $tenant) {
|
if (! $tenant) {
|
||||||
return static::unavailableDiffState('No tenant context');
|
return NormalizedDiffSurface::build(static::unavailableDiffState('No tenant context'), 'finding');
|
||||||
}
|
}
|
||||||
|
|
||||||
[$baselineVersion, $currentVersion] = static::resolveDriftDiffVersions($record, $tenant);
|
[$baselineVersion, $currentVersion] = static::resolveDriftDiffVersions($record, $tenant);
|
||||||
|
|
||||||
if (! static::hasRequiredDiffVersions($record, $baselineVersion, $currentVersion)) {
|
if (! static::hasRequiredDiffVersions($record, $baselineVersion, $currentVersion)) {
|
||||||
return static::unavailableDiffState('Diff unavailable — referenced policy versions are missing.');
|
return NormalizedDiffSurface::build(static::unavailableDiffState('Diff unavailable — referenced policy versions are missing.'), 'finding');
|
||||||
}
|
}
|
||||||
|
|
||||||
$diff = app(DriftFindingDiffBuilder::class)->buildSettingsDiff($baselineVersion, $currentVersion);
|
$diff = app(DriftFindingDiffBuilder::class)->buildSettingsDiff($baselineVersion, $currentVersion);
|
||||||
@ -452,9 +448,9 @@ public static function infolist(Schema $schema): Schema
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $diff;
|
return NormalizedDiffSurface::build($diff, 'finding');
|
||||||
})
|
})
|
||||||
->visible(fn (Finding $record): bool => static::canRenderDriftDiff($record) && Arr::get($record->evidence_jsonb ?? [], 'summary.kind') === 'policy_snapshot')
|
->visible(fn (Finding $record): bool => Arr::get($record->evidence_jsonb ?? [], 'summary.kind') === 'policy_snapshot')
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
|
|
||||||
ViewEntry::make('scope_tags_diff')
|
ViewEntry::make('scope_tags_diff')
|
||||||
|
|||||||
@ -1178,6 +1178,18 @@ private static function verificationReportViewData(OperationRun $record): array
|
|||||||
'changeIndicator' => $changeIndicator,
|
'changeIndicator' => $changeIndicator,
|
||||||
'previousRunUrl' => $previousRunUrl,
|
'previousRunUrl' => $previousRunUrl,
|
||||||
'acknowledgements' => $acknowledgements,
|
'acknowledgements' => $acknowledgements,
|
||||||
|
'surface' => VerificationReportViewer::surface($record, $acknowledgements, [
|
||||||
|
'hostKind' => 'operation_run_detail',
|
||||||
|
'changeIndicator' => $changeIndicator,
|
||||||
|
'previousRunUrl' => $previousRunUrl,
|
||||||
|
'hostVariation' => [
|
||||||
|
'ownsNoRunState' => false,
|
||||||
|
'ownsActiveState' => false,
|
||||||
|
'supportsAssist' => false,
|
||||||
|
'supportsAcknowledge' => false,
|
||||||
|
'supportsTechnicalDetailsTrigger' => false,
|
||||||
|
],
|
||||||
|
]),
|
||||||
'redactionNotes' => VerificationReportViewer::redactionNotes($report),
|
'redactionNotes' => VerificationReportViewer::redactionNotes($report),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
use App\Filament\Concerns\ScopesGlobalSearchToTenant;
|
use App\Filament\Concerns\ScopesGlobalSearchToTenant;
|
||||||
use App\Filament\Resources\PolicyResource\Pages;
|
use App\Filament\Resources\PolicyResource\Pages;
|
||||||
use App\Filament\Resources\PolicyResource\RelationManagers\VersionsRelationManager;
|
use App\Filament\Resources\PolicyResource\RelationManagers\VersionsRelationManager;
|
||||||
|
use App\Filament\Support\NormalizedSettingsSurface;
|
||||||
use App\Jobs\BulkPolicyDeleteJob;
|
use App\Jobs\BulkPolicyDeleteJob;
|
||||||
use App\Jobs\BulkPolicyExportJob;
|
use App\Jobs\BulkPolicyExportJob;
|
||||||
use App\Jobs\BulkPolicyUnignoreJob;
|
use App\Jobs\BulkPolicyUnignoreJob;
|
||||||
@ -238,25 +239,13 @@ public static function infolist(Schema $schema): Schema
|
|||||||
Tab::make('Settings')
|
Tab::make('Settings')
|
||||||
->id('settings')
|
->id('settings')
|
||||||
->schema([
|
->schema([
|
||||||
ViewEntry::make('settings_catalog')
|
ViewEntry::make('settings')
|
||||||
->label('')
|
->label('')
|
||||||
->view('filament.infolists.entries.normalized-settings')
|
->view('filament.infolists.entries.normalized-settings')
|
||||||
->state(function (Policy $record) {
|
->state(function (Policy $record) {
|
||||||
return static::settingsTabState($record);
|
return NormalizedSettingsSurface::build(static::settingsTabState($record), 'policy');
|
||||||
})
|
})
|
||||||
->visible(fn (Policy $record) => static::hasSettingsTable($record) &&
|
->visible(fn (Policy $record) => $record->versions()->exists()),
|
||||||
$record->versions()->exists()
|
|
||||||
),
|
|
||||||
|
|
||||||
ViewEntry::make('settings_standard')
|
|
||||||
->label('')
|
|
||||||
->view('filament.infolists.entries.policy-settings-standard')
|
|
||||||
->state(function (Policy $record) {
|
|
||||||
return static::settingsTabState($record);
|
|
||||||
})
|
|
||||||
->visible(fn (Policy $record) => ! static::hasSettingsTable($record) &&
|
|
||||||
$record->versions()->exists()
|
|
||||||
),
|
|
||||||
|
|
||||||
TextEntry::make('no_settings_available')
|
TextEntry::make('no_settings_available')
|
||||||
->label('Settings')
|
->label('Settings')
|
||||||
@ -301,16 +290,7 @@ public static function infolist(Schema $schema): Schema
|
|||||||
->label('')
|
->label('')
|
||||||
->view('filament.infolists.entries.normalized-settings')
|
->view('filament.infolists.entries.normalized-settings')
|
||||||
->state(function (Policy $record) {
|
->state(function (Policy $record) {
|
||||||
$normalized = app(PolicyNormalizer::class)->normalize(
|
return NormalizedSettingsSurface::build(static::settingsTabState($record), 'policy');
|
||||||
static::latestSnapshot($record),
|
|
||||||
$record->policy_type ?? '',
|
|
||||||
$record->platform
|
|
||||||
);
|
|
||||||
|
|
||||||
$normalized['context'] = 'policy';
|
|
||||||
$normalized['record_id'] = (string) $record->getKey();
|
|
||||||
|
|
||||||
return $normalized;
|
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
|
|||||||
@ -6,6 +6,8 @@
|
|||||||
use App\Filament\Concerns\ResolvesPanelTenantContext;
|
use App\Filament\Concerns\ResolvesPanelTenantContext;
|
||||||
use App\Filament\Concerns\ScopesGlobalSearchToTenant;
|
use App\Filament\Concerns\ScopesGlobalSearchToTenant;
|
||||||
use App\Filament\Resources\PolicyVersionResource\Pages;
|
use App\Filament\Resources\PolicyVersionResource\Pages;
|
||||||
|
use App\Filament\Support\NormalizedDiffSurface;
|
||||||
|
use App\Filament\Support\NormalizedSettingsSurface;
|
||||||
use App\Jobs\BulkPolicyVersionForceDeleteJob;
|
use App\Jobs\BulkPolicyVersionForceDeleteJob;
|
||||||
use App\Jobs\BulkPolicyVersionPruneJob;
|
use App\Jobs\BulkPolicyVersionPruneJob;
|
||||||
use App\Jobs\BulkPolicyVersionRestoreJob;
|
use App\Jobs\BulkPolicyVersionRestoreJob;
|
||||||
@ -180,7 +182,7 @@ public static function infolist(Schema $schema): Schema
|
|||||||
Tab::make('Normalized settings')
|
Tab::make('Normalized settings')
|
||||||
->id('normalized-settings')
|
->id('normalized-settings')
|
||||||
->schema([
|
->schema([
|
||||||
Infolists\Components\ViewEntry::make('normalized_settings_catalog')
|
Infolists\Components\ViewEntry::make('normalized_settings')
|
||||||
->view('filament.infolists.entries.normalized-settings')
|
->view('filament.infolists.entries.normalized-settings')
|
||||||
->state(function (PolicyVersion $record) {
|
->state(function (PolicyVersion $record) {
|
||||||
$normalized = app(PolicyNormalizer::class)->normalize(
|
$normalized = app(PolicyNormalizer::class)->normalize(
|
||||||
@ -189,29 +191,12 @@ public static function infolist(Schema $schema): Schema
|
|||||||
$record->platform
|
$record->platform
|
||||||
);
|
);
|
||||||
|
|
||||||
$normalized['context'] = 'version';
|
|
||||||
$normalized['record_id'] = (string) $record->getKey();
|
|
||||||
|
|
||||||
return $normalized;
|
|
||||||
})
|
|
||||||
->visible(fn (PolicyVersion $record) => in_array($record->policy_type, ['settingsCatalogPolicy', 'endpointSecurityPolicy', 'securityBaselinePolicy'], true)),
|
|
||||||
|
|
||||||
Infolists\Components\ViewEntry::make('normalized_settings_standard')
|
|
||||||
->view('filament.infolists.entries.policy-settings-standard')
|
|
||||||
->state(function (PolicyVersion $record) {
|
|
||||||
$normalized = app(PolicyNormalizer::class)->normalize(
|
|
||||||
is_array($record->snapshot) ? $record->snapshot : [],
|
|
||||||
$record->policy_type ?? '',
|
|
||||||
$record->platform
|
|
||||||
);
|
|
||||||
|
|
||||||
$normalized['context'] = 'version';
|
$normalized['context'] = 'version';
|
||||||
$normalized['record_id'] = (string) $record->getKey();
|
$normalized['record_id'] = (string) $record->getKey();
|
||||||
$normalized['policy_type'] = $record->policy_type;
|
$normalized['policy_type'] = $record->policy_type;
|
||||||
|
|
||||||
return $normalized;
|
return NormalizedSettingsSurface::build($normalized, 'policy_version');
|
||||||
})
|
}),
|
||||||
->visible(fn (PolicyVersion $record) => ! in_array($record->policy_type, ['settingsCatalogPolicy', 'endpointSecurityPolicy', 'securityBaselinePolicy'], true)),
|
|
||||||
]),
|
]),
|
||||||
Tab::make('Raw JSON')
|
Tab::make('Raw JSON')
|
||||||
->id('raw-json')
|
->id('raw-json')
|
||||||
@ -238,7 +223,7 @@ public static function infolist(Schema $schema): Schema
|
|||||||
$result = $diff->compare($from, $to);
|
$result = $diff->compare($from, $to);
|
||||||
$result['policy_type'] = $record->policy_type;
|
$result['policy_type'] = $record->policy_type;
|
||||||
|
|
||||||
return $result;
|
return NormalizedDiffSurface::build($result, 'policy_version');
|
||||||
}),
|
}),
|
||||||
Infolists\Components\ViewEntry::make('diff_json')
|
Infolists\Components\ViewEntry::make('diff_json')
|
||||||
->label('Raw diff (advanced)')
|
->label('Raw diff (advanced)')
|
||||||
|
|||||||
155
apps/platform/app/Filament/Support/NormalizedDiffSurface.php
Normal file
155
apps/platform/app/Filament/Support/NormalizedDiffSurface.php
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Filament\Support;
|
||||||
|
|
||||||
|
final class NormalizedDiffSurface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $diff
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public static function build(array $diff, string $hostKind): array
|
||||||
|
{
|
||||||
|
$summary = is_array($diff['summary'] ?? null) ? $diff['summary'] : [];
|
||||||
|
$added = is_array($diff['added'] ?? null) ? $diff['added'] : [];
|
||||||
|
$removed = is_array($diff['removed'] ?? null) ? $diff['removed'] : [];
|
||||||
|
$changed = is_array($diff['changed'] ?? null) ? $diff['changed'] : [];
|
||||||
|
$message = is_string($summary['message'] ?? null) && trim((string) $summary['message']) !== ''
|
||||||
|
? trim((string) $summary['message'])
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$addedCount = is_numeric($summary['added'] ?? null) ? (int) $summary['added'] : count($added);
|
||||||
|
$removedCount = is_numeric($summary['removed'] ?? null) ? (int) $summary['removed'] : count($removed);
|
||||||
|
$changedCount = is_numeric($summary['changed'] ?? null) ? (int) $summary['changed'] : count($changed);
|
||||||
|
$availabilityState = self::availabilityState($message, $addedCount, $removedCount, $changedCount);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'hostKind' => $hostKind,
|
||||||
|
'availabilityState' => $availabilityState,
|
||||||
|
'summary' => [
|
||||||
|
'added' => $addedCount,
|
||||||
|
'removed' => $removedCount,
|
||||||
|
'changed' => $changedCount,
|
||||||
|
'message' => $message,
|
||||||
|
],
|
||||||
|
'viewModes' => [
|
||||||
|
['key' => 'grouped', 'label' => 'Grouped diff', 'default' => true],
|
||||||
|
],
|
||||||
|
'sectionBehavior' => [
|
||||||
|
'preservesGroupOrder' => true,
|
||||||
|
'supportsExpansion' => true,
|
||||||
|
'supportsFullscreen' => true,
|
||||||
|
],
|
||||||
|
'renderExpectations' => [
|
||||||
|
'ownsAvailabilityState' => true,
|
||||||
|
'ownsZeroDiffMessaging' => true,
|
||||||
|
'keepsHostFramingOutsideCore' => true,
|
||||||
|
],
|
||||||
|
'groups' => [
|
||||||
|
self::group('changed', 'Changed', $changed, false),
|
||||||
|
self::group('added', 'Added', $added, true),
|
||||||
|
self::group('removed', 'Removed', $removed, true),
|
||||||
|
],
|
||||||
|
'scriptRendering' => [
|
||||||
|
'policyType' => $diff['policy_type'] ?? null,
|
||||||
|
'showScriptContent' => (bool) config('tenantpilot.display.show_script_content', false),
|
||||||
|
],
|
||||||
|
'emptyState' => self::emptyState($availabilityState, $message, $addedCount, $removedCount, $changedCount),
|
||||||
|
'raw' => [
|
||||||
|
'added' => $added,
|
||||||
|
'removed' => $removed,
|
||||||
|
'changed' => $changed,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $items
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private static function group(string $key, string $label, array $items, bool $collapsed): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'key' => $key,
|
||||||
|
'label' => $label,
|
||||||
|
'collapsed' => $collapsed,
|
||||||
|
'count' => count($items),
|
||||||
|
'items' => self::groupByBlock($items),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $items
|
||||||
|
* @return array<string, array<string, mixed>>
|
||||||
|
*/
|
||||||
|
private static function groupByBlock(array $items): array
|
||||||
|
{
|
||||||
|
$groups = [];
|
||||||
|
|
||||||
|
foreach ($items as $path => $value) {
|
||||||
|
if (! is_string($path) || $path === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(' > ', $path, 2);
|
||||||
|
$group = count($parts) === 2 ? $parts[0] : 'Other';
|
||||||
|
$label = count($parts) === 2 ? $parts[1] : $path;
|
||||||
|
|
||||||
|
$groups[$group][$label] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($groups);
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function availabilityState(?string $message, int $addedCount, int $removedCount, int $changedCount): string
|
||||||
|
{
|
||||||
|
if ($message !== null && str_contains(strtolower($message), 'unavailable')) {
|
||||||
|
return 'unavailable';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($message !== null && str_contains(strtolower($message), 'partial')) {
|
||||||
|
return 'partial';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'available';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{title: string, message: string}|null
|
||||||
|
*/
|
||||||
|
private static function emptyState(
|
||||||
|
string $availabilityState,
|
||||||
|
?string $message,
|
||||||
|
int $addedCount,
|
||||||
|
int $removedCount,
|
||||||
|
int $changedCount,
|
||||||
|
): ?array
|
||||||
|
{
|
||||||
|
if ($availabilityState === 'unavailable' && $message !== null) {
|
||||||
|
return [
|
||||||
|
'title' => 'Diff unavailable',
|
||||||
|
'message' => $message,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($availabilityState === 'partial' && $message !== null) {
|
||||||
|
return [
|
||||||
|
'title' => 'Diff partially available',
|
||||||
|
'message' => $message,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($availabilityState === 'available' && ($addedCount + $removedCount + $changedCount) === 0) {
|
||||||
|
return [
|
||||||
|
'title' => 'No normalized changes',
|
||||||
|
'message' => $message ?? 'No normalized changes were found.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Filament\Support;
|
||||||
|
|
||||||
|
final class NormalizedSettingsSurface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $normalized
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public static function build(array $normalized, string $hostKind): array
|
||||||
|
{
|
||||||
|
$warnings = collect($normalized['warnings'] ?? [])
|
||||||
|
->filter(static fn (mixed $warning): bool => is_string($warning) && trim($warning) !== '')
|
||||||
|
->map(static fn (string $warning): string => trim($warning))
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
$settingsTable = is_array($normalized['settings_table'] ?? null) ? $normalized['settings_table'] : null;
|
||||||
|
$settingsTableRows = is_array($settingsTable['rows'] ?? null) ? $settingsTable['rows'] : [];
|
||||||
|
$blocks = collect($normalized['settings'] ?? [])
|
||||||
|
->filter(static fn (mixed $block): bool => is_array($block))
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
$context = is_string($normalized['context'] ?? null) && $normalized['context'] !== ''
|
||||||
|
? (string) $normalized['context']
|
||||||
|
: 'policy';
|
||||||
|
|
||||||
|
$variant = $settingsTableRows !== [] ? 'settings_catalog_table' : 'standard_blocks';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'hostKind' => $hostKind,
|
||||||
|
'context' => $context,
|
||||||
|
'variant' => $variant,
|
||||||
|
'warnings' => $warnings,
|
||||||
|
'settingsTable' => $settingsTableRows !== [] ? $settingsTable : null,
|
||||||
|
'blocks' => $blocks,
|
||||||
|
'sectionBehavior' => [
|
||||||
|
'preservesSectionOrder' => true,
|
||||||
|
'supportsExpansion' => true,
|
||||||
|
'ownsEmptyState' => true,
|
||||||
|
],
|
||||||
|
'renderExpectations' => [
|
||||||
|
'ownsWarningsInWrapper' => true,
|
||||||
|
'ownsSubtypeDelegation' => true,
|
||||||
|
'keepsHostFramingOutsideCore' => true,
|
||||||
|
],
|
||||||
|
'emptyState' => $settingsTableRows === [] && $blocks === []
|
||||||
|
? [
|
||||||
|
'title' => 'No settings available.',
|
||||||
|
'message' => 'No normalized settings payload is available for this host.',
|
||||||
|
]
|
||||||
|
: null,
|
||||||
|
'titlePolicy' => [
|
||||||
|
'showWrapperTitle' => false,
|
||||||
|
],
|
||||||
|
'recordId' => $normalized['record_id'] ?? null,
|
||||||
|
'policyType' => $normalized['policy_type'] ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,8 @@
|
|||||||
namespace App\Filament\Support;
|
namespace App\Filament\Support;
|
||||||
|
|
||||||
use App\Models\OperationRun;
|
use App\Models\OperationRun;
|
||||||
|
use App\Support\Badges\BadgeDomain;
|
||||||
|
use App\Support\Badges\BadgeRenderer;
|
||||||
use App\Support\RedactionIntegrity;
|
use App\Support\RedactionIntegrity;
|
||||||
use App\Support\Verification\VerificationReportFingerprint;
|
use App\Support\Verification\VerificationReportFingerprint;
|
||||||
use App\Support\Verification\VerificationReportSanitizer;
|
use App\Support\Verification\VerificationReportSanitizer;
|
||||||
@ -91,6 +93,276 @@ public static function shouldRenderForRun(OperationRun $run): bool
|
|||||||
return in_array((string) $run->type, ['provider.connection.check'], true);
|
return in_array((string) $run->type, ['provider.connection.check'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, array<string, mixed>> $acknowledgements
|
||||||
|
* @param array{
|
||||||
|
* hostKind?: string,
|
||||||
|
* changeIndicator?: array{state: string, previous_report_id: int}|null,
|
||||||
|
* previousRunUrl?: string|null,
|
||||||
|
* nextStepPlacement?: 'shared_zone'|'host_action_zone',
|
||||||
|
* hostActions?: array<int, array{kind: string, label: string, ownedByHost: bool}>,
|
||||||
|
* hostVariation?: array{
|
||||||
|
* ownsNoRunState?: bool,
|
||||||
|
* ownsActiveState?: bool,
|
||||||
|
* supportsAssist?: bool,
|
||||||
|
* supportsAcknowledge?: bool,
|
||||||
|
* supportsTechnicalDetailsTrigger?: bool
|
||||||
|
* },
|
||||||
|
* optionalZones?: array<int, string>
|
||||||
|
* } $options
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public static function surface(OperationRun $run, array $acknowledgements = [], array $options = []): array
|
||||||
|
{
|
||||||
|
$report = self::report($run);
|
||||||
|
$summary = is_array($report['summary'] ?? null) ? $report['summary'] : [];
|
||||||
|
$counts = is_array($summary['counts'] ?? null) ? $summary['counts'] : [];
|
||||||
|
$groupedChecks = self::groupedChecks($report, $acknowledgements);
|
||||||
|
$changeIndicator = $options['changeIndicator'] ?? null;
|
||||||
|
$hostKind = is_string($options['hostKind'] ?? null) && $options['hostKind'] !== ''
|
||||||
|
? (string) $options['hostKind']
|
||||||
|
: 'operation_run_detail';
|
||||||
|
$nextStepPlacement = ($options['nextStepPlacement'] ?? 'shared_zone') === 'host_action_zone'
|
||||||
|
? 'host_action_zone'
|
||||||
|
: 'shared_zone';
|
||||||
|
|
||||||
|
$hostActions = collect($options['hostActions'] ?? [])
|
||||||
|
->filter(static fn (mixed $action): bool => is_array($action))
|
||||||
|
->map(static function (array $action): array {
|
||||||
|
$kind = is_string($action['kind'] ?? null) ? trim((string) $action['kind']) : 'navigation';
|
||||||
|
$label = is_string($action['label'] ?? null) ? trim((string) $action['label']) : 'Action';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'kind' => $kind !== '' ? $kind : 'navigation',
|
||||||
|
'label' => $label !== '' ? $label : 'Action',
|
||||||
|
'ownedByHost' => (bool) ($action['ownedByHost'] ?? true),
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
$hostVariation = [
|
||||||
|
'ownsNoRunState' => (bool) (($options['hostVariation']['ownsNoRunState'] ?? false)),
|
||||||
|
'ownsActiveState' => (bool) (($options['hostVariation']['ownsActiveState'] ?? false)),
|
||||||
|
'supportsAssist' => (bool) (($options['hostVariation']['supportsAssist'] ?? false)),
|
||||||
|
'supportsAcknowledge' => (bool) (($options['hostVariation']['supportsAcknowledge'] ?? false)),
|
||||||
|
'supportsTechnicalDetailsTrigger' => (bool) (($options['hostVariation']['supportsTechnicalDetailsTrigger'] ?? false)),
|
||||||
|
];
|
||||||
|
|
||||||
|
$optionalZones = collect($options['optionalZones'] ?? ['technical_details', 'change_indicator', 'previous_run_context'])
|
||||||
|
->filter(static fn (mixed $zone): bool => is_string($zone) && trim($zone) !== '')
|
||||||
|
->map(static fn (string $zone): string => trim($zone))
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
$overall = $summary['overall'] ?? null;
|
||||||
|
$overallSpec = BadgeRenderer::spec(BadgeDomain::VerificationReportOverall, $overall);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'hostKind' => $hostKind,
|
||||||
|
'coreState' => $report === null ? 'unavailable' : 'completed',
|
||||||
|
'summary' => [
|
||||||
|
'overall' => $overall,
|
||||||
|
'overallLabel' => $overallSpec->label,
|
||||||
|
'counts' => [
|
||||||
|
'total' => (int) ($counts['total'] ?? 0),
|
||||||
|
'pass' => (int) ($counts['pass'] ?? 0),
|
||||||
|
'fail' => (int) ($counts['fail'] ?? 0),
|
||||||
|
'warn' => (int) ($counts['warn'] ?? 0),
|
||||||
|
'skip' => (int) ($counts['skip'] ?? 0),
|
||||||
|
'running' => (int) ($counts['running'] ?? 0),
|
||||||
|
],
|
||||||
|
'changeIndicator' => is_array($changeIndicator) ? $changeIndicator : null,
|
||||||
|
],
|
||||||
|
'issueGroups' => $groupedChecks['issueGroups'],
|
||||||
|
'passedChecks' => $groupedChecks['passedChecks'],
|
||||||
|
'diagnostics' => [
|
||||||
|
'hasTechnicalZone' => true,
|
||||||
|
'fingerprint' => is_array($report) ? self::fingerprint($report) : null,
|
||||||
|
'previousRunUrl' => is_string($options['previousRunUrl'] ?? null) && $options['previousRunUrl'] !== ''
|
||||||
|
? (string) $options['previousRunUrl']
|
||||||
|
: null,
|
||||||
|
'operationRunId' => (int) $run->getKey(),
|
||||||
|
'flow' => (string) $run->type,
|
||||||
|
'completedAt' => $run->completed_at?->toJSON(),
|
||||||
|
],
|
||||||
|
'viewZones' => [
|
||||||
|
['key' => 'issues', 'label' => 'Issues', 'defaultVisible' => true],
|
||||||
|
['key' => 'passed', 'label' => 'Passed', 'defaultVisible' => false],
|
||||||
|
],
|
||||||
|
'nextSteps' => self::nextSteps($groupedChecks['issueGroups'], $nextStepPlacement),
|
||||||
|
'hostActions' => $hostActions,
|
||||||
|
'hostVariation' => $hostVariation,
|
||||||
|
'optionalZones' => $optionalZones,
|
||||||
|
'emptyState' => $report === null
|
||||||
|
? [
|
||||||
|
'title' => 'Verification report unavailable',
|
||||||
|
'message' => 'This operation doesn’t have a report yet. If it is still running, refresh in a moment. If it already completed, start verification again.',
|
||||||
|
]
|
||||||
|
: null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed>|null $report
|
||||||
|
* @param array<string, array<string, mixed>> $acknowledgements
|
||||||
|
* @return array{issueGroups: array<int, array{label: string, checks: array<int, array<string, mixed>>, acknowledged?: bool}>, passedChecks: array<int, array<string, mixed>>}
|
||||||
|
*/
|
||||||
|
private static function groupedChecks(?array $report, array $acknowledgements): array
|
||||||
|
{
|
||||||
|
$checks = is_array($report['checks'] ?? null) ? $report['checks'] : [];
|
||||||
|
$ackByKey = [];
|
||||||
|
|
||||||
|
foreach ($acknowledgements as $checkKey => $acknowledgement) {
|
||||||
|
if (! is_string($checkKey) || $checkKey === '' || ! is_array($acknowledgement)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ackByKey[$checkKey] = $acknowledgement;
|
||||||
|
}
|
||||||
|
|
||||||
|
$blockers = [];
|
||||||
|
$failures = [];
|
||||||
|
$warnings = [];
|
||||||
|
$acknowledgedIssues = [];
|
||||||
|
$passed = [];
|
||||||
|
|
||||||
|
foreach ($checks as $check) {
|
||||||
|
if (! is_array($check)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = is_string($check['key'] ?? null) ? trim((string) $check['key']) : '';
|
||||||
|
|
||||||
|
if ($key === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = is_string($check['status'] ?? null) ? strtolower(trim((string) $check['status'])) : '';
|
||||||
|
$blocking = (bool) ($check['blocking'] ?? false);
|
||||||
|
$normalizedCheck = self::normalizeCheck($check, $ackByKey[$key] ?? null);
|
||||||
|
|
||||||
|
if ($normalizedCheck['acknowledgement'] !== null) {
|
||||||
|
$acknowledgedIssues[] = $normalizedCheck;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status === 'pass') {
|
||||||
|
$passed[] = $normalizedCheck;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status === 'fail' && $blocking) {
|
||||||
|
$blockers[] = $normalizedCheck;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status === 'fail') {
|
||||||
|
$failures[] = $normalizedCheck;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status === 'warn') {
|
||||||
|
$warnings[] = $normalizedCheck;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sortChecks = static fn (array $left, array $right): int => strcmp((string) ($left['key'] ?? ''), (string) ($right['key'] ?? ''));
|
||||||
|
|
||||||
|
usort($blockers, $sortChecks);
|
||||||
|
usort($failures, $sortChecks);
|
||||||
|
usort($warnings, $sortChecks);
|
||||||
|
usort($acknowledgedIssues, $sortChecks);
|
||||||
|
usort($passed, $sortChecks);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'issueGroups' => array_values(array_filter([
|
||||||
|
['label' => 'Blockers', 'checks' => $blockers],
|
||||||
|
['label' => 'Failures', 'checks' => $failures],
|
||||||
|
['label' => 'Warnings', 'checks' => $warnings],
|
||||||
|
['label' => 'Acknowledged issues', 'checks' => $acknowledgedIssues, 'acknowledged' => true],
|
||||||
|
], static fn (array $group): bool => ($group['checks'] ?? []) !== [])),
|
||||||
|
'passedChecks' => $passed,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $check
|
||||||
|
* @param array<string, mixed>|null $acknowledgement
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private static function normalizeCheck(array $check, ?array $acknowledgement): array
|
||||||
|
{
|
||||||
|
$nextSteps = collect($check['next_steps'] ?? [])
|
||||||
|
->filter(static fn (mixed $step): bool => is_array($step))
|
||||||
|
->map(static function (array $step): array {
|
||||||
|
$label = is_string($step['label'] ?? null) ? trim((string) $step['label']) : '';
|
||||||
|
$url = is_string($step['url'] ?? null) ? trim((string) $step['url']) : '';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'label' => $label,
|
||||||
|
'url' => $url,
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->filter(static fn (array $step): bool => $step['label'] !== '' && $step['url'] !== '')
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'key' => is_string($check['key'] ?? null) ? trim((string) $check['key']) : '',
|
||||||
|
'title' => is_string($check['title'] ?? null) && trim((string) $check['title']) !== ''
|
||||||
|
? trim((string) $check['title'])
|
||||||
|
: 'Check',
|
||||||
|
'message' => is_string($check['message'] ?? null) && trim((string) $check['message']) !== ''
|
||||||
|
? trim((string) $check['message'])
|
||||||
|
: null,
|
||||||
|
'status' => is_string($check['status'] ?? null) ? trim((string) $check['status']) : null,
|
||||||
|
'severity' => is_string($check['severity'] ?? null) ? trim((string) $check['severity']) : null,
|
||||||
|
'reason_code' => is_string($check['reason_code'] ?? null) ? trim((string) $check['reason_code']) : null,
|
||||||
|
'blocking' => (bool) ($check['blocking'] ?? false),
|
||||||
|
'next_steps' => $nextSteps,
|
||||||
|
'acknowledgement' => is_array($acknowledgement) ? $acknowledgement : null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, array{label: string, checks: array<int, array<string, mixed>>, acknowledged?: bool}> $issueGroups
|
||||||
|
* @return array<int, array{label: string, placement: string, ownedByHost: bool, actionKind: string|null}>
|
||||||
|
*/
|
||||||
|
private static function nextSteps(array $issueGroups, string $placement): array
|
||||||
|
{
|
||||||
|
$steps = [];
|
||||||
|
|
||||||
|
foreach ($issueGroups as $group) {
|
||||||
|
foreach ($group['checks'] as $check) {
|
||||||
|
foreach ($check['next_steps'] ?? [] as $step) {
|
||||||
|
if (! is_array($step)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = is_string($step['label'] ?? null) ? trim((string) $step['label']) : '';
|
||||||
|
|
||||||
|
if ($label === '' || array_key_exists($label, $steps)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$steps[$label] = [
|
||||||
|
'label' => $label,
|
||||||
|
'placement' => $placement,
|
||||||
|
'ownedByHost' => $placement === 'host_action_zone',
|
||||||
|
'actionKind' => $placement === 'host_action_zone' ? 'assist' : 'navigation',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_values($steps);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, mixed>|null $report
|
* @param array<string, mixed>|null $report
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
namespace App\Filament\Widgets\Tenant;
|
namespace App\Filament\Widgets\Tenant;
|
||||||
|
|
||||||
use App\Filament\Resources\TenantResource\Pages\ViewTenant;
|
use App\Filament\Resources\TenantResource\Pages\ViewTenant;
|
||||||
|
use App\Filament\Support\VerificationReportChangeIndicator;
|
||||||
use App\Filament\Support\VerificationReportViewer;
|
use App\Filament\Support\VerificationReportViewer;
|
||||||
use App\Models\OperationRun;
|
use App\Models\OperationRun;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
@ -189,6 +190,12 @@ protected function getViewData(): array
|
|||||||
$report = $run instanceof OperationRun
|
$report = $run instanceof OperationRun
|
||||||
? VerificationReportViewer::report($run)
|
? VerificationReportViewer::report($run)
|
||||||
: null;
|
: null;
|
||||||
|
$changeIndicator = $run instanceof OperationRun
|
||||||
|
? VerificationReportChangeIndicator::forRun($run)
|
||||||
|
: null;
|
||||||
|
$previousRunUrl = is_array($changeIndicator) && is_numeric($changeIndicator['previous_report_id'] ?? null)
|
||||||
|
? OperationRunLinks::tenantlessView((int) $changeIndicator['previous_report_id'])
|
||||||
|
: null;
|
||||||
|
|
||||||
$isInProgress = $run instanceof OperationRun
|
$isInProgress = $run instanceof OperationRun
|
||||||
&& (string) $run->status !== OperationRunStatus::Completed->value;
|
&& (string) $run->status !== OperationRunStatus::Completed->value;
|
||||||
@ -230,6 +237,20 @@ protected function getViewData(): array
|
|||||||
'runData' => $runData,
|
'runData' => $runData,
|
||||||
'runUrl' => $run instanceof OperationRun ? OperationRunLinks::tenantlessView($run) : null,
|
'runUrl' => $run instanceof OperationRun ? OperationRunLinks::tenantlessView($run) : null,
|
||||||
'report' => $report,
|
'report' => $report,
|
||||||
|
'surface' => $run instanceof OperationRun
|
||||||
|
? VerificationReportViewer::surface($run, [], [
|
||||||
|
'hostKind' => 'tenant_widget',
|
||||||
|
'changeIndicator' => $changeIndicator,
|
||||||
|
'previousRunUrl' => $previousRunUrl,
|
||||||
|
'hostVariation' => [
|
||||||
|
'ownsNoRunState' => true,
|
||||||
|
'ownsActiveState' => true,
|
||||||
|
'supportsAssist' => false,
|
||||||
|
'supportsAcknowledge' => false,
|
||||||
|
'supportsTechnicalDetailsTrigger' => false,
|
||||||
|
],
|
||||||
|
])
|
||||||
|
: [],
|
||||||
'redactionNotes' => VerificationReportViewer::redactionNotes($report),
|
'redactionNotes' => VerificationReportViewer::redactionNotes($report),
|
||||||
'isInProgress' => $isInProgress,
|
'isInProgress' => $isInProgress,
|
||||||
'showStartAction' => ! ($run instanceof OperationRun) && $isTenantMember && $canOperate,
|
'showStartAction' => ! ($run instanceof OperationRun) && $isTenantMember && $canOperate,
|
||||||
|
|||||||
@ -1,108 +1,34 @@
|
|||||||
@php
|
@php
|
||||||
$report = $report ?? null;
|
$surface = is_array($surface ?? null) ? $surface : [];
|
||||||
$report = is_array($report) ? $report : null;
|
$coreState = is_string($surface['coreState'] ?? null) ? (string) $surface['coreState'] : 'unavailable';
|
||||||
|
$redactionNotes = is_array($redactionNotes ?? null)
|
||||||
$run = $run ?? null;
|
? array_values(array_filter($redactionNotes, 'is_string'))
|
||||||
$run = is_array($run) ? $run : null;
|
: [];
|
||||||
|
$canAcknowledge = (bool) ($canAcknowledge ?? false);
|
||||||
$fingerprint = $fingerprint ?? null;
|
$ackAction = $ackAction ?? null;
|
||||||
$fingerprint = is_string($fingerprint) && trim($fingerprint) !== '' ? trim($fingerprint) : null;
|
$showAssist = (bool) ($showAssist ?? false);
|
||||||
|
$assistActionName = is_string($assistActionName ?? null) && trim((string) $assistActionName) !== ''
|
||||||
$changeIndicator = $changeIndicator ?? null;
|
? trim((string) $assistActionName)
|
||||||
$changeIndicator = is_array($changeIndicator) ? $changeIndicator : null;
|
: 'wizardVerificationRequiredPermissionsAssist';
|
||||||
|
$linkBehavior = $linkBehavior ?? app(\App\Support\Verification\VerificationLinkBehavior::class);
|
||||||
$previousRunUrl = $previousRunUrl ?? null;
|
$emptyState = is_array($surface['emptyState'] ?? null) ? $surface['emptyState'] : null;
|
||||||
$previousRunUrl = is_string($previousRunUrl) && $previousRunUrl !== '' ? $previousRunUrl : null;
|
|
||||||
|
|
||||||
$acknowledgements = $acknowledgements ?? [];
|
|
||||||
$acknowledgements = is_array($acknowledgements) ? $acknowledgements : [];
|
|
||||||
$redactionNotes = $redactionNotes ?? [];
|
|
||||||
$redactionNotes = is_array($redactionNotes) ? array_values(array_filter($redactionNotes, 'is_string')) : [];
|
|
||||||
|
|
||||||
$summary = $report['summary'] ?? null;
|
|
||||||
$summary = is_array($summary) ? $summary : null;
|
|
||||||
|
|
||||||
$counts = is_array($summary['counts'] ?? null) ? $summary['counts'] : [];
|
|
||||||
|
|
||||||
$checks = $report['checks'] ?? null;
|
|
||||||
$checks = is_array($checks) ? $checks : [];
|
|
||||||
|
|
||||||
$ackByKey = [];
|
|
||||||
|
|
||||||
foreach ($acknowledgements as $checkKey => $ack) {
|
|
||||||
if (! is_string($checkKey) || $checkKey === '' || ! is_array($ack)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ackByKey[$checkKey] = $ack;
|
|
||||||
}
|
|
||||||
|
|
||||||
$blockers = [];
|
|
||||||
$failures = [];
|
|
||||||
$warnings = [];
|
|
||||||
$acknowledgedIssues = [];
|
|
||||||
$passed = [];
|
|
||||||
|
|
||||||
foreach ($checks as $check) {
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
|
|
||||||
$key = $check['key'] ?? null;
|
|
||||||
$key = is_string($key) ? trim($key) : '';
|
|
||||||
|
|
||||||
if ($key === '') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$statusValue = $check['status'] ?? null;
|
|
||||||
$statusValue = is_string($statusValue) ? strtolower(trim($statusValue)) : '';
|
|
||||||
|
|
||||||
$blocking = $check['blocking'] ?? false;
|
|
||||||
$blocking = is_bool($blocking) ? $blocking : false;
|
|
||||||
|
|
||||||
if (array_key_exists($key, $ackByKey)) {
|
|
||||||
$acknowledgedIssues[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'pass') {
|
|
||||||
$passed[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'fail' && $blocking) {
|
|
||||||
$blockers[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'fail') {
|
|
||||||
$failures[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'warn') {
|
|
||||||
$warnings[] = $check;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sortChecks = static function (array $a, array $b): int {
|
|
||||||
return strcmp((string) ($a['key'] ?? ''), (string) ($b['key'] ?? ''));
|
|
||||||
};
|
|
||||||
|
|
||||||
usort($blockers, $sortChecks);
|
|
||||||
usort($failures, $sortChecks);
|
|
||||||
usort($warnings, $sortChecks);
|
|
||||||
usort($acknowledgedIssues, $sortChecks);
|
|
||||||
usort($passed, $sortChecks);
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div
|
||||||
@if ($report === null || $summary === null)
|
data-shared-detail-family="verification-report"
|
||||||
<div class="rounded-lg border border-gray-200 bg-white p-4 text-sm text-gray-600 shadow-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300">
|
data-host-kind="{{ (string) ($surface['hostKind'] ?? 'operation_run_detail') }}"
|
||||||
|
class="space-y-4"
|
||||||
|
>
|
||||||
|
@if ($coreState === 'unavailable')
|
||||||
|
<div
|
||||||
|
data-shared-zone="unavailable"
|
||||||
|
class="rounded-lg border border-gray-200 bg-white p-4 text-sm text-gray-600 shadow-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300"
|
||||||
|
>
|
||||||
<div class="font-medium text-gray-900 dark:text-white">
|
<div class="font-medium text-gray-900 dark:text-white">
|
||||||
Verification report unavailable
|
{{ $emptyState['title'] ?? 'Verification report unavailable' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
This operation doesn’t have a report yet. If it’s still running, refresh in a moment. If it already completed, start verification again.
|
{{ $emptyState['message'] ?? 'This operation does not have a report yet.' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 text-xs text-gray-600 dark:text-gray-300">
|
<div class="mt-2 text-xs text-gray-600 dark:text-gray-300">
|
||||||
<span class="font-semibold">Read-only:</span> this view uses stored data and makes no external calls.
|
<span class="font-semibold">Read-only:</span> this view uses stored data and makes no external calls.
|
||||||
@ -117,68 +43,10 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
@php
|
@include('filament.components.verification-report.summary', [
|
||||||
$overallSpec = \App\Support\Badges\BadgeRenderer::spec(
|
'surface' => $surface,
|
||||||
\App\Support\Badges\BadgeDomain::VerificationReportOverall,
|
'redactionNotes' => $redactionNotes,
|
||||||
$summary['overall'] ?? null,
|
])
|
||||||
);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<x-filament::badge :color="$overallSpec->color" :icon="$overallSpec->icon">
|
|
||||||
{{ $overallSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
|
|
||||||
<x-filament::badge color="gray">
|
|
||||||
{{ (int) ($counts['total'] ?? 0) }} total
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="success">
|
|
||||||
{{ (int) ($counts['pass'] ?? 0) }} pass
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="danger">
|
|
||||||
{{ (int) ($counts['fail'] ?? 0) }} fail
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="warning">
|
|
||||||
{{ (int) ($counts['warn'] ?? 0) }} warn
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="gray">
|
|
||||||
{{ (int) ($counts['skip'] ?? 0) }} skip
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="info">
|
|
||||||
{{ (int) ($counts['running'] ?? 0) }} running
|
|
||||||
</x-filament::badge>
|
|
||||||
|
|
||||||
@if ($changeIndicator !== null)
|
|
||||||
@php
|
|
||||||
$state = $changeIndicator['state'] ?? null;
|
|
||||||
$state = is_string($state) ? $state : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($state === 'no_changes')
|
|
||||||
<x-filament::badge color="success">
|
|
||||||
No changes since previous verification
|
|
||||||
</x-filament::badge>
|
|
||||||
@elseif ($state === 'changed')
|
|
||||||
<x-filament::badge color="warning">
|
|
||||||
Changed since previous verification
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-2 text-xs text-gray-600 dark:text-gray-300">
|
|
||||||
<span class="font-semibold">Read-only:</span> this view uses stored data and makes no external calls.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($redactionNotes !== [])
|
|
||||||
<div class="mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100">
|
|
||||||
@foreach ($redactionNotes as $note)
|
|
||||||
<div>{{ $note }}</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-data="{ tab: 'issues' }" class="space-y-4">
|
<div x-data="{ tab: 'issues' }" class="space-y-4">
|
||||||
<x-filament::tabs label="Verification report tabs">
|
<x-filament::tabs label="Verification report tabs">
|
||||||
@ -196,313 +64,28 @@
|
|||||||
>
|
>
|
||||||
Passed
|
Passed
|
||||||
</x-filament::tabs.item>
|
</x-filament::tabs.item>
|
||||||
<x-filament::tabs.item
|
|
||||||
:active="false"
|
|
||||||
alpine-active="tab === 'technical'"
|
|
||||||
x-on:click="tab = 'technical'"
|
|
||||||
>
|
|
||||||
Technical details
|
|
||||||
</x-filament::tabs.item>
|
|
||||||
</x-filament::tabs>
|
</x-filament::tabs>
|
||||||
|
|
||||||
<div x-show="tab === 'issues'">
|
<div x-show="tab === 'issues'">
|
||||||
@if ($blockers === [] && $failures === [] && $warnings === [] && $acknowledgedIssues === [])
|
@include('filament.components.verification-report.issues', [
|
||||||
<div class="text-sm text-gray-700 dark:text-gray-200">
|
'surface' => $surface,
|
||||||
No issues found in this report.
|
'canAcknowledge' => $canAcknowledge,
|
||||||
</div>
|
'ackAction' => $ackAction,
|
||||||
@else
|
'showAssist' => $showAssist,
|
||||||
<div class="space-y-3">
|
'assistActionName' => $assistActionName,
|
||||||
@php
|
'linkBehavior' => $linkBehavior,
|
||||||
$issueGroups = [
|
])
|
||||||
['label' => 'Blockers', 'checks' => $blockers],
|
|
||||||
['label' => 'Failures', 'checks' => $failures],
|
|
||||||
['label' => 'Warnings', 'checks' => $warnings],
|
|
||||||
];
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@foreach ($issueGroups as $group)
|
|
||||||
@php
|
|
||||||
$label = $group['label'];
|
|
||||||
$groupChecks = $group['checks'];
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($groupChecks !== [])
|
|
||||||
<div class="space-y-2">
|
|
||||||
<div class="text-sm font-semibold text-gray-900 dark:text-white">
|
|
||||||
{{ $label }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-2">
|
|
||||||
@foreach ($groupChecks as $check)
|
|
||||||
@php
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
|
|
||||||
$title = $check['title'] ?? 'Check';
|
|
||||||
$title = is_string($title) && trim($title) !== '' ? trim($title) : 'Check';
|
|
||||||
|
|
||||||
$message = $check['message'] ?? null;
|
|
||||||
$message = is_string($message) && trim($message) !== '' ? trim($message) : null;
|
|
||||||
|
|
||||||
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
|
||||||
$check['status'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$severitySpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckSeverity,
|
|
||||||
$check['severity'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$nextSteps = $check['next_steps'] ?? [];
|
|
||||||
$nextSteps = is_array($nextSteps) ? array_slice($nextSteps, 0, 2) : [];
|
|
||||||
|
|
||||||
$blocking = $check['blocking'] ?? false;
|
|
||||||
$blocking = is_bool($blocking) ? $blocking : false;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $title }}
|
|
||||||
</div>
|
|
||||||
@if ($message)
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
{{ $message }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
|
||||||
@if ($blocking)
|
|
||||||
<x-filament::badge color="danger" size="sm">
|
|
||||||
Blocker
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<x-filament::badge :color="$severitySpec->color" :icon="$severitySpec->icon" size="sm">
|
|
||||||
{{ $severitySpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
|
||||||
{{ $statusSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($nextSteps !== [])
|
|
||||||
<div class="mt-4">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
|
||||||
Next steps
|
|
||||||
</div>
|
|
||||||
<ul class="mt-2 space-y-1 text-sm">
|
|
||||||
@foreach ($nextSteps as $step)
|
|
||||||
@php
|
|
||||||
$step = is_array($step) ? $step : [];
|
|
||||||
$label = $step['label'] ?? null;
|
|
||||||
$url = $step['url'] ?? null;
|
|
||||||
$isExternal = is_string($url) && (str_starts_with($url, 'http://') || str_starts_with($url, 'https://'));
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($label) && $label !== '' && is_string($url) && $url !== '')
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="{{ $url }}"
|
|
||||||
class="text-primary-600 hover:underline dark:text-primary-400"
|
|
||||||
@if ($isExternal)
|
|
||||||
target="_blank" rel="noreferrer"
|
|
||||||
@endif
|
|
||||||
>
|
|
||||||
{{ $label }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if ($acknowledgedIssues !== [])
|
|
||||||
<details class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<summary class="cursor-pointer text-sm font-semibold text-gray-900 dark:text-white">
|
|
||||||
Acknowledged issues
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
<div class="mt-4 space-y-2">
|
|
||||||
@foreach ($acknowledgedIssues as $check)
|
|
||||||
@php
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
$checkKey = is_string($check['key'] ?? null) ? trim((string) $check['key']) : '';
|
|
||||||
|
|
||||||
$title = $check['title'] ?? 'Check';
|
|
||||||
$title = is_string($title) && trim($title) !== '' ? trim($title) : 'Check';
|
|
||||||
|
|
||||||
$message = $check['message'] ?? null;
|
|
||||||
$message = is_string($message) && trim($message) !== '' ? trim($message) : null;
|
|
||||||
|
|
||||||
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
|
||||||
$check['status'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$severitySpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckSeverity,
|
|
||||||
$check['severity'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$ack = $checkKey !== '' ? ($ackByKey[$checkKey] ?? null) : null;
|
|
||||||
$ack = is_array($ack) ? $ack : null;
|
|
||||||
|
|
||||||
$ackReason = $ack['ack_reason'] ?? null;
|
|
||||||
$ackReason = is_string($ackReason) && trim($ackReason) !== '' ? trim($ackReason) : null;
|
|
||||||
|
|
||||||
$ackAt = $ack['acknowledged_at'] ?? null;
|
|
||||||
$ackAt = is_string($ackAt) && trim($ackAt) !== '' ? trim($ackAt) : null;
|
|
||||||
|
|
||||||
$ackBy = $ack['acknowledged_by'] ?? null;
|
|
||||||
$ackBy = is_array($ackBy) ? $ackBy : null;
|
|
||||||
|
|
||||||
$ackByName = $ackBy['name'] ?? null;
|
|
||||||
$ackByName = is_string($ackByName) && trim($ackByName) !== '' ? trim($ackByName) : null;
|
|
||||||
|
|
||||||
$expiresAt = $ack['expires_at'] ?? null;
|
|
||||||
$expiresAt = is_string($expiresAt) && trim($expiresAt) !== '' ? trim($expiresAt) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="rounded-lg border border-gray-100 bg-gray-50 p-4 dark:border-gray-800 dark:bg-gray-950">
|
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $title }}
|
|
||||||
</div>
|
|
||||||
@if ($message)
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
{{ $message }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
|
||||||
<x-filament::badge :color="$severitySpec->color" :icon="$severitySpec->icon" size="sm">
|
|
||||||
{{ $severitySpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
|
||||||
{{ $statusSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($ackReason || $ackAt || $ackByName || $expiresAt)
|
|
||||||
<div class="mt-3 space-y-1 text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
@if ($ackReason)
|
|
||||||
<div>
|
|
||||||
<span class="font-semibold">Reason:</span> {{ $ackReason }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@if ($ackByName || $ackAt)
|
|
||||||
<div>
|
|
||||||
<span class="font-semibold">Acknowledged:</span>
|
|
||||||
@if ($ackByName)
|
|
||||||
{{ $ackByName }}
|
|
||||||
@endif
|
|
||||||
@if ($ackAt)
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">({{ $ackAt }})</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@if ($expiresAt)
|
|
||||||
<div>
|
|
||||||
<span class="font-semibold">Expires:</span>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">{{ $expiresAt }}</span>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div x-show="tab === 'passed'" style="display: none;">
|
<div x-show="tab === 'passed'" style="display: none;">
|
||||||
@if ($passed === [])
|
@include('filament.components.verification-report.passed', [
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
'surface' => $surface,
|
||||||
No passing checks recorded.
|
])
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<div class="space-y-2">
|
|
||||||
@foreach ($passed as $check)
|
|
||||||
@php
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
|
|
||||||
$title = $check['title'] ?? 'Check';
|
|
||||||
$title = is_string($title) && trim($title) !== '' ? trim($title) : 'Check';
|
|
||||||
|
|
||||||
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
|
||||||
$check['status'] ?? null,
|
|
||||||
);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between gap-3 rounded-lg border border-gray-200 bg-white p-3 text-sm shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<div class="font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $title }}
|
|
||||||
</div>
|
|
||||||
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
|
||||||
{{ $statusSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'technical'" style="display: none;">
|
|
||||||
<div class="space-y-4 text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
|
||||||
Identifiers
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
@if ($run !== null)
|
|
||||||
<div>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">Operation ID:</span>
|
|
||||||
<span class="font-mono">{{ (int) ($run['id'] ?? 0) }}</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">Flow:</span>
|
|
||||||
<span class="font-mono">{{ (string) ($run['type'] ?? '') }}</span>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@if ($fingerprint)
|
|
||||||
<div>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">Fingerprint:</span>
|
|
||||||
<span class="font-mono text-xs break-all">{{ $fingerprint }}</span>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($previousRunUrl !== null)
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
href="{{ $previousRunUrl }}"
|
|
||||||
class="font-medium text-primary-600 hover:underline dark:text-primary-400"
|
|
||||||
>
|
|
||||||
Open previous operation
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@include('filament.components.verification-report.diagnostics', [
|
||||||
|
'surface' => $surface,
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
@php
|
||||||
|
$diagnostics = is_array($surface['diagnostics'] ?? null) ? $surface['diagnostics'] : [];
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div
|
||||||
|
data-shared-zone="diagnostics"
|
||||||
|
class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"
|
||||||
|
>
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
||||||
|
Diagnostics
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3 space-y-1 text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
<div>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400">Operation ID:</span>
|
||||||
|
<span class="font-mono">{{ (int) ($diagnostics['operationRunId'] ?? 0) }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400">Flow:</span>
|
||||||
|
<span class="font-mono">{{ (string) ($diagnostics['flow'] ?? '') }}</span>
|
||||||
|
</div>
|
||||||
|
@if (filled($diagnostics['completedAt'] ?? null))
|
||||||
|
<div>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400">Completed:</span>
|
||||||
|
<span>{{ $diagnostics['completedAt'] }}</span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if (filled($diagnostics['fingerprint'] ?? null))
|
||||||
|
<div>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400">Fingerprint:</span>
|
||||||
|
<span class="font-mono text-xs break-all">{{ $diagnostics['fingerprint'] }}</span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if (filled($diagnostics['previousRunUrl'] ?? null))
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
href="{{ $diagnostics['previousRunUrl'] }}"
|
||||||
|
class="font-medium text-primary-600 hover:underline dark:text-primary-400"
|
||||||
|
>
|
||||||
|
Open previous operation
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,226 @@
|
|||||||
|
@php
|
||||||
|
$issueGroups = collect($surface['issueGroups'] ?? [])
|
||||||
|
->filter(static fn (mixed $group): bool => is_array($group))
|
||||||
|
->values();
|
||||||
|
$canAcknowledge = (bool) ($canAcknowledge ?? false);
|
||||||
|
$ackAction = $ackAction ?? null;
|
||||||
|
$showAssist = (bool) ($showAssist ?? false);
|
||||||
|
$assistActionName = is_string($assistActionName ?? null) && trim((string) $assistActionName) !== ''
|
||||||
|
? trim((string) $assistActionName)
|
||||||
|
: 'wizardVerificationRequiredPermissionsAssist';
|
||||||
|
$linkBehavior = $linkBehavior ?? app(\App\Support\Verification\VerificationLinkBehavior::class);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div data-shared-zone="issues">
|
||||||
|
@if ($issueGroups->isEmpty())
|
||||||
|
<div class="text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
No issues found in this report.
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="space-y-3">
|
||||||
|
@foreach ($issueGroups as $group)
|
||||||
|
@php
|
||||||
|
$label = is_string($group['label'] ?? null) ? (string) $group['label'] : 'Issues';
|
||||||
|
$checks = collect($group['checks'] ?? [])->filter(static fn (mixed $check): bool => is_array($check))->values();
|
||||||
|
$acknowledged = (bool) ($group['acknowledged'] ?? false);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($acknowledged)
|
||||||
|
<details class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
||||||
|
<summary class="cursor-pointer text-sm font-semibold text-gray-900 dark:text-white">
|
||||||
|
{{ $label }}
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
<div class="mt-4 space-y-2">
|
||||||
|
@foreach ($checks as $check)
|
||||||
|
@php
|
||||||
|
$title = is_string($check['title'] ?? null) && trim((string) $check['title']) !== '' ? trim((string) $check['title']) : 'Check';
|
||||||
|
$message = is_string($check['message'] ?? null) && trim((string) $check['message']) !== '' ? trim((string) $check['message']) : null;
|
||||||
|
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
||||||
|
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
||||||
|
$check['status'] ?? null,
|
||||||
|
);
|
||||||
|
$severitySpec = \App\Support\Badges\BadgeRenderer::spec(
|
||||||
|
\App\Support\Badges\BadgeDomain::VerificationCheckSeverity,
|
||||||
|
$check['severity'] ?? null,
|
||||||
|
);
|
||||||
|
$acknowledgement = is_array($check['acknowledgement'] ?? null) ? $check['acknowledgement'] : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="rounded-lg border border-gray-100 bg-gray-50 p-4 dark:border-gray-800 dark:bg-gray-950">
|
||||||
|
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||||
|
<div class="space-y-1">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
|
{{ $title }}
|
||||||
|
</div>
|
||||||
|
@if ($message)
|
||||||
|
<div class="text-sm text-gray-600 dark:text-gray-300">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
||||||
|
<x-filament::badge :color="$severitySpec->color" :icon="$severitySpec->icon" size="sm">
|
||||||
|
{{ $severitySpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
||||||
|
{{ $statusSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if ($acknowledgement)
|
||||||
|
<div class="mt-3 space-y-1 text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
@if (filled($acknowledgement['ack_reason'] ?? null))
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold">Reason:</span> {{ $acknowledgement['ack_reason'] }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if (filled($acknowledgement['acknowledged_by']['name'] ?? null) || filled($acknowledgement['acknowledged_at'] ?? null))
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold">Acknowledged:</span>
|
||||||
|
@if (filled($acknowledgement['acknowledged_by']['name'] ?? null))
|
||||||
|
{{ $acknowledgement['acknowledged_by']['name'] }}
|
||||||
|
@endif
|
||||||
|
@if (filled($acknowledgement['acknowledged_at'] ?? null))
|
||||||
|
<span class="text-gray-500 dark:text-gray-400">({{ $acknowledgement['acknowledged_at'] }})</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if (filled($acknowledgement['expires_at'] ?? null))
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold">Expires:</span>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400">{{ $acknowledgement['expires_at'] }}</span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
@else
|
||||||
|
<div class="space-y-2">
|
||||||
|
<div class="text-sm font-semibold text-gray-900 dark:text-white">
|
||||||
|
{{ $label }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-2">
|
||||||
|
@foreach ($checks as $check)
|
||||||
|
@php
|
||||||
|
$checkKey = is_string($check['key'] ?? null) ? trim((string) $check['key']) : '';
|
||||||
|
$title = is_string($check['title'] ?? null) && trim((string) $check['title']) !== '' ? trim((string) $check['title']) : 'Check';
|
||||||
|
$message = is_string($check['message'] ?? null) && trim((string) $check['message']) !== '' ? trim((string) $check['message']) : null;
|
||||||
|
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
||||||
|
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
||||||
|
$check['status'] ?? null,
|
||||||
|
);
|
||||||
|
$severitySpec = \App\Support\Badges\BadgeRenderer::spec(
|
||||||
|
\App\Support\Badges\BadgeDomain::VerificationCheckSeverity,
|
||||||
|
$check['severity'] ?? null,
|
||||||
|
);
|
||||||
|
$nextSteps = collect($check['next_steps'] ?? [])->filter(static fn (mixed $step): bool => is_array($step))->take(2)->values();
|
||||||
|
$blocking = (bool) ($check['blocking'] ?? false);
|
||||||
|
$routeNextStepsThroughAssist = $linkBehavior->shouldRouteThroughAssist($check, $showAssist);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
||||||
|
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||||
|
<div class="space-y-1">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
|
{{ $title }}
|
||||||
|
</div>
|
||||||
|
@if ($message)
|
||||||
|
<div class="text-sm text-gray-600 dark:text-gray-300">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
||||||
|
@if ($blocking)
|
||||||
|
<x-filament::badge color="danger" size="sm">
|
||||||
|
Blocker
|
||||||
|
</x-filament::badge>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<x-filament::badge :color="$severitySpec->color" :icon="$severitySpec->icon" size="sm">
|
||||||
|
{{ $severitySpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
||||||
|
{{ $statusSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
|
||||||
|
@if ($ackAction !== null && $canAcknowledge && $checkKey !== '')
|
||||||
|
{{ ($ackAction)(['check_key' => $checkKey]) }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if ($nextSteps->isNotEmpty())
|
||||||
|
<div class="mt-4">
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
||||||
|
Next steps
|
||||||
|
</div>
|
||||||
|
<ul class="mt-2 space-y-1 text-sm">
|
||||||
|
@foreach ($nextSteps as $step)
|
||||||
|
@php
|
||||||
|
$label = is_string($step['label'] ?? null) ? trim((string) $step['label']) : '';
|
||||||
|
$url = is_string($step['url'] ?? null) ? trim((string) $step['url']) : '';
|
||||||
|
$testId = $label !== '' ? 'verification-next-step-'.\Illuminate\Support\Str::slug($label) : null;
|
||||||
|
$behavior = $routeNextStepsThroughAssist
|
||||||
|
? null
|
||||||
|
: $linkBehavior->describe($label, $url);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($label !== '' && $url !== '')
|
||||||
|
<li>
|
||||||
|
@if ($routeNextStepsThroughAssist)
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex items-center gap-2 text-primary-600 hover:underline dark:text-primary-400"
|
||||||
|
wire:click="mountAction('{{ $assistActionName }}')"
|
||||||
|
@if ($testId)
|
||||||
|
data-testid="{{ $testId }}"
|
||||||
|
@endif
|
||||||
|
>
|
||||||
|
<span>{{ $label }}</span>
|
||||||
|
<span class="text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
Open in assist
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
@else
|
||||||
|
<a
|
||||||
|
href="{{ $url }}"
|
||||||
|
class="inline-flex items-center gap-2 text-primary-600 hover:underline dark:text-primary-400"
|
||||||
|
@if ($testId)
|
||||||
|
data-testid="{{ $testId }}"
|
||||||
|
@endif
|
||||||
|
@if ((bool) ($behavior['opens_in_new_tab'] ?? false))
|
||||||
|
target="_blank" rel="noopener noreferrer"
|
||||||
|
@endif
|
||||||
|
>
|
||||||
|
<span>{{ $label }}</span>
|
||||||
|
@if ((bool) ($behavior['show_new_tab_hint'] ?? false))
|
||||||
|
<span class="text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
Opens in new tab
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
@php
|
||||||
|
$passedChecks = collect($surface['passedChecks'] ?? [])
|
||||||
|
->filter(static fn (mixed $check): bool => is_array($check))
|
||||||
|
->values();
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div data-shared-zone="passed">
|
||||||
|
@if ($passedChecks->isEmpty())
|
||||||
|
<div class="text-sm text-gray-600 dark:text-gray-300">
|
||||||
|
No passing checks recorded.
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="space-y-2">
|
||||||
|
@foreach ($passedChecks as $check)
|
||||||
|
@php
|
||||||
|
$title = is_string($check['title'] ?? null) && trim((string) $check['title']) !== '' ? trim((string) $check['title']) : 'Check';
|
||||||
|
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
||||||
|
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
||||||
|
$check['status'] ?? null,
|
||||||
|
);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between gap-3 rounded-lg border border-gray-200 bg-white p-3 text-sm shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
||||||
|
<div class="font-medium text-gray-900 dark:text-white">
|
||||||
|
{{ $title }}
|
||||||
|
</div>
|
||||||
|
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
||||||
|
{{ $statusSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
@php
|
||||||
|
$summary = is_array($surface['summary'] ?? null) ? $surface['summary'] : [];
|
||||||
|
$counts = is_array($summary['counts'] ?? null) ? $summary['counts'] : [];
|
||||||
|
$overallSpec = \App\Support\Badges\BadgeRenderer::spec(
|
||||||
|
\App\Support\Badges\BadgeDomain::VerificationReportOverall,
|
||||||
|
$summary['overall'] ?? null,
|
||||||
|
);
|
||||||
|
$changeIndicator = is_array($summary['changeIndicator'] ?? null) ? $summary['changeIndicator'] : null;
|
||||||
|
$redactionNotes = is_array($redactionNotes ?? null)
|
||||||
|
? array_values(array_filter($redactionNotes, 'is_string'))
|
||||||
|
: [];
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div
|
||||||
|
data-shared-zone="summary"
|
||||||
|
class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"
|
||||||
|
>
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<x-filament::badge :color="$overallSpec->color" :icon="$overallSpec->icon">
|
||||||
|
{{ $overallSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
|
||||||
|
<x-filament::badge color="gray">
|
||||||
|
{{ (int) ($counts['total'] ?? 0) }} total
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="success">
|
||||||
|
{{ (int) ($counts['pass'] ?? 0) }} pass
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="danger">
|
||||||
|
{{ (int) ($counts['fail'] ?? 0) }} fail
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="warning">
|
||||||
|
{{ (int) ($counts['warn'] ?? 0) }} warn
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="gray">
|
||||||
|
{{ (int) ($counts['skip'] ?? 0) }} skip
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="info">
|
||||||
|
{{ (int) ($counts['running'] ?? 0) }} running
|
||||||
|
</x-filament::badge>
|
||||||
|
|
||||||
|
@if (($changeIndicator['state'] ?? null) === 'no_changes')
|
||||||
|
<x-filament::badge color="success">
|
||||||
|
No changes since previous verification
|
||||||
|
</x-filament::badge>
|
||||||
|
@elseif (($changeIndicator['state'] ?? null) === 'changed')
|
||||||
|
<x-filament::badge color="warning">
|
||||||
|
Changed since previous verification
|
||||||
|
</x-filament::badge>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-2 text-xs text-gray-600 dark:text-gray-300">
|
||||||
|
<span class="font-semibold">Read-only:</span> this view uses stored data and makes no external calls.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if ($redactionNotes !== [])
|
||||||
|
<div class="mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100">
|
||||||
|
@foreach ($redactionNotes as $note)
|
||||||
|
<div>{{ $note }}</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@ -1,70 +1,26 @@
|
|||||||
@php
|
@php
|
||||||
$fieldWrapperView = $getFieldWrapperView();
|
$fieldWrapperView = $getFieldWrapperView();
|
||||||
|
$run = is_array($run ?? null) ? $run : null;
|
||||||
$run = $run ?? null;
|
$runUrl = is_string($runUrl ?? null) && trim((string) $runUrl) !== '' ? trim((string) $runUrl) : null;
|
||||||
$run = is_array($run) ? $run : null;
|
$surface = is_array($surface ?? null) ? $surface : [];
|
||||||
|
$redactionNotes = is_array($redactionNotes ?? null)
|
||||||
$runUrl = $runUrl ?? null;
|
? array_values(array_filter($redactionNotes, 'is_string'))
|
||||||
$runUrl = is_string($runUrl) && $runUrl !== '' ? $runUrl : null;
|
: [];
|
||||||
|
$assistVisibility = is_array($assistVisibility ?? null) ? $assistVisibility : [];
|
||||||
$report = $report ?? null;
|
$assistActionName = is_string($assistActionName ?? null) && trim((string) $assistActionName) !== ''
|
||||||
$report = is_array($report) ? $report : null;
|
? trim((string) $assistActionName)
|
||||||
|
|
||||||
$fingerprint = $fingerprint ?? null;
|
|
||||||
$fingerprint = is_string($fingerprint) && trim($fingerprint) !== '' ? trim($fingerprint) : null;
|
|
||||||
|
|
||||||
$changeIndicator = $changeIndicator ?? null;
|
|
||||||
$changeIndicator = is_array($changeIndicator) ? $changeIndicator : null;
|
|
||||||
|
|
||||||
$previousRunUrl = $previousRunUrl ?? null;
|
|
||||||
$previousRunUrl = is_string($previousRunUrl) && $previousRunUrl !== '' ? $previousRunUrl : null;
|
|
||||||
|
|
||||||
$advancedRunUrl = $advancedRunUrl ?? null;
|
|
||||||
$advancedRunUrl = is_string($advancedRunUrl) && $advancedRunUrl !== '' ? $advancedRunUrl : null;
|
|
||||||
|
|
||||||
$canAcknowledge = (bool) ($canAcknowledge ?? false);
|
|
||||||
|
|
||||||
$acknowledgements = $acknowledgements ?? [];
|
|
||||||
$acknowledgements = is_array($acknowledgements) ? $acknowledgements : [];
|
|
||||||
|
|
||||||
$assistVisibility = $assistVisibility ?? [];
|
|
||||||
$assistVisibility = is_array($assistVisibility) ? $assistVisibility : [];
|
|
||||||
|
|
||||||
$assistActionName = $assistActionName ?? 'wizardVerificationRequiredPermissionsAssist';
|
|
||||||
$assistActionName = is_string($assistActionName) && trim($assistActionName) !== ''
|
|
||||||
? trim($assistActionName)
|
|
||||||
: 'wizardVerificationRequiredPermissionsAssist';
|
: 'wizardVerificationRequiredPermissionsAssist';
|
||||||
|
$technicalDetailsActionName = is_string($technicalDetailsActionName ?? null) && trim((string) $technicalDetailsActionName) !== ''
|
||||||
$technicalDetailsActionName = $technicalDetailsActionName ?? 'wizardVerificationTechnicalDetails';
|
? trim((string) $technicalDetailsActionName)
|
||||||
$technicalDetailsActionName = is_string($technicalDetailsActionName) && trim($technicalDetailsActionName) !== ''
|
|
||||||
? trim($technicalDetailsActionName)
|
|
||||||
: 'wizardVerificationTechnicalDetails';
|
: 'wizardVerificationTechnicalDetails';
|
||||||
|
|
||||||
$showAssist = (bool) ($assistVisibility['is_visible'] ?? false);
|
$showAssist = (bool) ($assistVisibility['is_visible'] ?? false);
|
||||||
$assistReason = $assistVisibility['reason'] ?? 'hidden_irrelevant';
|
$assistReason = is_string($assistVisibility['reason'] ?? null) ? (string) $assistVisibility['reason'] : 'hidden_irrelevant';
|
||||||
$assistReason = is_string($assistReason) ? $assistReason : 'hidden_irrelevant';
|
|
||||||
|
|
||||||
$assistDescription = match ($assistReason) {
|
$assistDescription = match ($assistReason) {
|
||||||
'permission_blocked' => 'Stored permission diagnostics show blockers. Review them without leaving onboarding.',
|
'permission_blocked' => 'Stored permission diagnostics show blockers. Review them without leaving onboarding.',
|
||||||
'permission_attention' => 'Stored permission diagnostics need attention before you rerun verification.',
|
'permission_attention' => 'Stored permission diagnostics need attention before you rerun verification.',
|
||||||
default => 'Review required permissions without leaving onboarding.',
|
default => 'Review required permissions without leaving onboarding.',
|
||||||
};
|
};
|
||||||
|
$completedAt = is_string($run['completed_at'] ?? null) && trim((string) $run['completed_at']) !== '' ? (string) $run['completed_at'] : null;
|
||||||
$status = $run['status'] ?? null;
|
|
||||||
$status = is_string($status) ? $status : null;
|
|
||||||
|
|
||||||
$outcome = $run['outcome'] ?? null;
|
|
||||||
$outcome = is_string($outcome) ? $outcome : null;
|
|
||||||
|
|
||||||
$targetScope = $run['target_scope'] ?? [];
|
|
||||||
$targetScope = is_array($targetScope) ? $targetScope : [];
|
|
||||||
|
|
||||||
$failures = $run['failures'] ?? [];
|
|
||||||
$failures = is_array($failures) ? $failures : [];
|
|
||||||
|
|
||||||
$completedAt = $run['completed_at'] ?? null;
|
|
||||||
$completedAt = is_string($completedAt) && $completedAt !== '' ? $completedAt : null;
|
|
||||||
|
|
||||||
$completedAtLabel = null;
|
$completedAtLabel = null;
|
||||||
|
|
||||||
if ($completedAt !== null) {
|
if ($completedAt !== null) {
|
||||||
@ -75,81 +31,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$summary = $report['summary'] ?? null;
|
$status = is_string($run['status'] ?? null) ? (string) $run['status'] : null;
|
||||||
$summary = is_array($summary) ? $summary : null;
|
$runState = is_string($runState ?? null) ? (string) $runState : null;
|
||||||
|
|
||||||
$counts = is_array($summary['counts'] ?? null) ? $summary['counts'] : [];
|
if (! in_array($runState, ['no_run', 'active', 'completed'], true)) {
|
||||||
|
$runState = $run === null
|
||||||
$checks = $report['checks'] ?? null;
|
? 'no_run'
|
||||||
$checks = is_array($checks) ? $checks : [];
|
: ($status === 'completed' ? 'completed' : 'active');
|
||||||
|
|
||||||
$ackByKey = [];
|
|
||||||
|
|
||||||
foreach ($acknowledgements as $checkKey => $ack) {
|
|
||||||
if (! is_string($checkKey) || $checkKey === '' || ! is_array($ack)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ackByKey[$checkKey] = $ack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$blockers = [];
|
|
||||||
$failures = [];
|
|
||||||
$warnings = [];
|
|
||||||
$acknowledgedIssues = [];
|
|
||||||
$passed = [];
|
|
||||||
|
|
||||||
foreach ($checks as $check) {
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
|
|
||||||
$key = $check['key'] ?? null;
|
|
||||||
$key = is_string($key) ? trim($key) : '';
|
|
||||||
|
|
||||||
if ($key === '') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$statusValue = $check['status'] ?? null;
|
|
||||||
$statusValue = is_string($statusValue) ? strtolower(trim($statusValue)) : '';
|
|
||||||
|
|
||||||
$blocking = $check['blocking'] ?? false;
|
|
||||||
$blocking = is_bool($blocking) ? $blocking : false;
|
|
||||||
|
|
||||||
if (array_key_exists($key, $ackByKey)) {
|
|
||||||
$acknowledgedIssues[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'pass') {
|
|
||||||
$passed[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'fail' && $blocking) {
|
|
||||||
$blockers[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'fail') {
|
|
||||||
$failures[] = $check;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statusValue === 'warn') {
|
|
||||||
$warnings[] = $check;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sortChecks = static function (array $a, array $b): int {
|
|
||||||
return strcmp((string) ($a['key'] ?? ''), (string) ($b['key'] ?? ''));
|
|
||||||
};
|
|
||||||
|
|
||||||
usort($blockers, $sortChecks);
|
|
||||||
usort($failures, $sortChecks);
|
|
||||||
usort($warnings, $sortChecks);
|
|
||||||
usort($acknowledgedIssues, $sortChecks);
|
|
||||||
usort($passed, $sortChecks);
|
|
||||||
|
|
||||||
$ackAction = null;
|
$ackAction = null;
|
||||||
|
|
||||||
if (isset($this) && method_exists($this, 'acknowledgeVerificationCheckAction')) {
|
if (isset($this) && method_exists($this, 'acknowledgeVerificationCheckAction')) {
|
||||||
@ -157,15 +47,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$linkBehavior = app(\App\Support\Verification\VerificationLinkBehavior::class);
|
$linkBehavior = app(\App\Support\Verification\VerificationLinkBehavior::class);
|
||||||
|
|
||||||
$runState = $runState ?? null;
|
|
||||||
$runState = is_string($runState) ? $runState : null;
|
|
||||||
|
|
||||||
if (! in_array($runState, ['no_run', 'active', 'completed'], true)) {
|
|
||||||
$runState = $run === null
|
|
||||||
? 'no_run'
|
|
||||||
: ($status === 'completed' ? 'completed' : 'active');
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||||
@ -211,65 +92,6 @@
|
|||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
@php
|
|
||||||
$overallSpec = $summary === null
|
|
||||||
? null
|
|
||||||
: \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationReportOverall,
|
|
||||||
$summary['overall'] ?? null,
|
|
||||||
);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
@if ($overallSpec)
|
|
||||||
<x-filament::badge :color="$overallSpec->color" :icon="$overallSpec->icon">
|
|
||||||
{{ $overallSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<x-filament::badge color="gray">
|
|
||||||
{{ (int) ($counts['total'] ?? 0) }} total
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="success">
|
|
||||||
{{ (int) ($counts['pass'] ?? 0) }} pass
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="danger">
|
|
||||||
{{ (int) ($counts['fail'] ?? 0) }} fail
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="warning">
|
|
||||||
{{ (int) ($counts['warn'] ?? 0) }} warn
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="gray">
|
|
||||||
{{ (int) ($counts['skip'] ?? 0) }} skip
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="info">
|
|
||||||
{{ (int) ($counts['running'] ?? 0) }} running
|
|
||||||
</x-filament::badge>
|
|
||||||
|
|
||||||
@if ($changeIndicator !== null)
|
|
||||||
@php
|
|
||||||
$state = $changeIndicator['state'] ?? null;
|
|
||||||
$state = is_string($state) ? $state : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($state === 'no_changes')
|
|
||||||
<x-filament::badge color="success">
|
|
||||||
No changes since previous verification
|
|
||||||
</x-filament::badge>
|
|
||||||
@elseif ($state === 'changed')
|
|
||||||
<x-filament::badge color="warning">
|
|
||||||
Changed since previous verification
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-2 text-xs text-gray-600 dark:text-gray-300">
|
|
||||||
<span class="font-semibold">Read-only:</span> this view uses stored data and makes no external calls.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
@if ($runUrl)
|
@if ($runUrl)
|
||||||
<x-filament::button
|
<x-filament::button
|
||||||
@ -315,338 +137,15 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($report === null || $summary === null)
|
@include('filament.components.verification-report-viewer', [
|
||||||
<div class="rounded-lg border border-gray-200 bg-white p-4 text-sm text-gray-600 shadow-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300">
|
'surface' => $surface,
|
||||||
<div class="font-medium text-gray-900 dark:text-white">
|
'redactionNotes' => $redactionNotes,
|
||||||
Verification report unavailable
|
'canAcknowledge' => (bool) ($canAcknowledge ?? false),
|
||||||
</div>
|
'ackAction' => $ackAction,
|
||||||
<div class="mt-1">
|
'showAssist' => $showAssist,
|
||||||
This operation doesn’t have a report yet. If it already completed, start verification again.
|
'assistActionName' => $assistActionName,
|
||||||
</div>
|
'linkBehavior' => $linkBehavior,
|
||||||
</div>
|
])
|
||||||
@else
|
|
||||||
<div
|
|
||||||
x-data="{ tab: 'issues' }"
|
|
||||||
class="space-y-4"
|
|
||||||
>
|
|
||||||
<x-filament::tabs label="Verification report tabs">
|
|
||||||
<x-filament::tabs.item
|
|
||||||
:active="true"
|
|
||||||
alpine-active="tab === 'issues'"
|
|
||||||
x-on:click="tab = 'issues'"
|
|
||||||
>
|
|
||||||
Issues
|
|
||||||
</x-filament::tabs.item>
|
|
||||||
<x-filament::tabs.item
|
|
||||||
:active="false"
|
|
||||||
alpine-active="tab === 'passed'"
|
|
||||||
x-on:click="tab = 'passed'"
|
|
||||||
>
|
|
||||||
Passed
|
|
||||||
</x-filament::tabs.item>
|
|
||||||
</x-filament::tabs>
|
|
||||||
|
|
||||||
<div x-show="tab === 'issues'">
|
|
||||||
@if ($blockers === [] && $failures === [] && $warnings === [] && $acknowledgedIssues === [])
|
|
||||||
<div class="text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
No issues found in this report.
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<div class="space-y-3">
|
|
||||||
@php
|
|
||||||
$issueGroups = [
|
|
||||||
['label' => 'Blockers', 'checks' => $blockers],
|
|
||||||
['label' => 'Failures', 'checks' => $failures],
|
|
||||||
['label' => 'Warnings', 'checks' => $warnings],
|
|
||||||
];
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@foreach ($issueGroups as $group)
|
|
||||||
@php
|
|
||||||
$label = $group['label'];
|
|
||||||
$groupChecks = $group['checks'];
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($groupChecks !== [])
|
|
||||||
<div class="space-y-2">
|
|
||||||
<div class="text-sm font-semibold text-gray-900 dark:text-white">
|
|
||||||
{{ $label }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-2">
|
|
||||||
@foreach ($groupChecks as $check)
|
|
||||||
@php
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
$checkKey = is_string($check['key'] ?? null) ? trim((string) $check['key']) : '';
|
|
||||||
|
|
||||||
$title = $check['title'] ?? 'Check';
|
|
||||||
$title = is_string($title) && trim($title) !== '' ? trim($title) : 'Check';
|
|
||||||
|
|
||||||
$message = $check['message'] ?? null;
|
|
||||||
$message = is_string($message) && trim($message) !== '' ? trim($message) : null;
|
|
||||||
|
|
||||||
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
|
||||||
$check['status'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$severitySpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckSeverity,
|
|
||||||
$check['severity'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$nextSteps = $check['next_steps'] ?? [];
|
|
||||||
$nextSteps = is_array($nextSteps) ? array_slice($nextSteps, 0, 2) : [];
|
|
||||||
|
|
||||||
$blocking = $check['blocking'] ?? false;
|
|
||||||
$blocking = is_bool($blocking) ? $blocking : false;
|
|
||||||
$routeNextStepsThroughAssist = $linkBehavior->shouldRouteThroughAssist($check, $showAssist);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $title }}
|
|
||||||
</div>
|
|
||||||
@if ($message)
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
{{ $message }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
|
||||||
@if ($blocking)
|
|
||||||
<x-filament::badge color="danger" size="sm">
|
|
||||||
Blocker
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<x-filament::badge :color="$severitySpec->color" :icon="$severitySpec->icon" size="sm">
|
|
||||||
{{ $severitySpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
|
||||||
{{ $statusSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
|
|
||||||
@if ($ackAction !== null && $canAcknowledge && $checkKey !== '')
|
|
||||||
{{ ($ackAction)(['check_key' => $checkKey]) }}
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($nextSteps !== [])
|
|
||||||
<div class="mt-4">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
|
||||||
Next steps
|
|
||||||
</div>
|
|
||||||
<ul class="mt-2 space-y-1 text-sm">
|
|
||||||
@foreach ($nextSteps as $step)
|
|
||||||
@php
|
|
||||||
$step = is_array($step) ? $step : [];
|
|
||||||
$label = $step['label'] ?? null;
|
|
||||||
$url = $step['url'] ?? null;
|
|
||||||
$testId = is_string($label) && $label !== ''
|
|
||||||
? 'verification-next-step-'.\Illuminate\Support\Str::slug($label)
|
|
||||||
: null;
|
|
||||||
$behavior = $routeNextStepsThroughAssist
|
|
||||||
? null
|
|
||||||
: $linkBehavior->describe(
|
|
||||||
is_string($label) ? $label : null,
|
|
||||||
is_string($url) ? $url : null,
|
|
||||||
);
|
|
||||||
$opensInNewTab = (bool) ($behavior['opens_in_new_tab'] ?? false);
|
|
||||||
$showNewTabHint = (bool) ($behavior['show_new_tab_hint'] ?? false);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($label) && $label !== '' && is_string($url) && $url !== '')
|
|
||||||
<li>
|
|
||||||
@if ($routeNextStepsThroughAssist)
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="inline-flex items-center gap-2 text-primary-600 hover:underline dark:text-primary-400"
|
|
||||||
wire:click="mountAction('{{ $assistActionName }}')"
|
|
||||||
@if ($testId)
|
|
||||||
data-testid="{{ $testId }}"
|
|
||||||
@endif
|
|
||||||
>
|
|
||||||
<span>{{ $label }}</span>
|
|
||||||
<span class="text-xs text-gray-500 dark:text-gray-400">
|
|
||||||
Open in assist
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
@else
|
|
||||||
<a
|
|
||||||
href="{{ $url }}"
|
|
||||||
class="inline-flex items-center gap-2 text-primary-600 hover:underline dark:text-primary-400"
|
|
||||||
@if ($testId)
|
|
||||||
data-testid="{{ $testId }}"
|
|
||||||
@endif
|
|
||||||
@if ($opensInNewTab)
|
|
||||||
target="_blank" rel="noopener noreferrer"
|
|
||||||
@endif
|
|
||||||
>
|
|
||||||
<span>{{ $label }}</span>
|
|
||||||
@if ($showNewTabHint)
|
|
||||||
<span class="text-xs text-gray-500 dark:text-gray-400">
|
|
||||||
Opens in new tab
|
|
||||||
</span>
|
|
||||||
@endif
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
</li>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if ($acknowledgedIssues !== [])
|
|
||||||
<details class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<summary class="cursor-pointer text-sm font-semibold text-gray-900 dark:text-white">
|
|
||||||
Acknowledged issues
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
<div class="mt-4 space-y-2">
|
|
||||||
@foreach ($acknowledgedIssues as $check)
|
|
||||||
@php
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
$checkKey = is_string($check['key'] ?? null) ? trim((string) $check['key']) : '';
|
|
||||||
|
|
||||||
$title = $check['title'] ?? 'Check';
|
|
||||||
$title = is_string($title) && trim($title) !== '' ? trim($title) : 'Check';
|
|
||||||
|
|
||||||
$message = $check['message'] ?? null;
|
|
||||||
$message = is_string($message) && trim($message) !== '' ? trim($message) : null;
|
|
||||||
|
|
||||||
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
|
||||||
$check['status'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$severitySpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckSeverity,
|
|
||||||
$check['severity'] ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$ack = $checkKey !== '' ? ($ackByKey[$checkKey] ?? null) : null;
|
|
||||||
$ack = is_array($ack) ? $ack : null;
|
|
||||||
|
|
||||||
$ackReason = $ack['ack_reason'] ?? null;
|
|
||||||
$ackReason = is_string($ackReason) && trim($ackReason) !== '' ? trim($ackReason) : null;
|
|
||||||
|
|
||||||
$ackAt = $ack['acknowledged_at'] ?? null;
|
|
||||||
$ackAt = is_string($ackAt) && trim($ackAt) !== '' ? trim($ackAt) : null;
|
|
||||||
|
|
||||||
$ackBy = $ack['acknowledged_by'] ?? null;
|
|
||||||
$ackBy = is_array($ackBy) ? $ackBy : null;
|
|
||||||
|
|
||||||
$ackByName = $ackBy['name'] ?? null;
|
|
||||||
$ackByName = is_string($ackByName) && trim($ackByName) !== '' ? trim($ackByName) : null;
|
|
||||||
|
|
||||||
$expiresAt = $ack['expires_at'] ?? null;
|
|
||||||
$expiresAt = is_string($expiresAt) && trim($expiresAt) !== '' ? trim($expiresAt) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="rounded-lg border border-gray-100 bg-gray-50 p-4 dark:border-gray-800 dark:bg-gray-950">
|
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $title }}
|
|
||||||
</div>
|
|
||||||
@if ($message)
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
{{ $message }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
|
||||||
<x-filament::badge :color="$severitySpec->color" :icon="$severitySpec->icon" size="sm">
|
|
||||||
{{ $severitySpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
|
||||||
{{ $statusSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($ackReason || $ackAt || $ackByName || $expiresAt)
|
|
||||||
<div class="mt-3 space-y-1 text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
@if ($ackReason)
|
|
||||||
<div>
|
|
||||||
<span class="font-semibold">Reason:</span> {{ $ackReason }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@if ($ackByName || $ackAt)
|
|
||||||
<div>
|
|
||||||
<span class="font-semibold">Acknowledged:</span>
|
|
||||||
@if ($ackByName)
|
|
||||||
{{ $ackByName }}
|
|
||||||
@endif
|
|
||||||
@if ($ackAt)
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">({{ $ackAt }})</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@if ($expiresAt)
|
|
||||||
<div>
|
|
||||||
<span class="font-semibold">Expires:</span>
|
|
||||||
<span class="text-gray-500 dark:text-gray-400">{{ $expiresAt }}</span>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'passed'" style="display: none;">
|
|
||||||
@if ($passed === [])
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
No passing checks recorded.
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<div class="space-y-2">
|
|
||||||
@foreach ($passed as $check)
|
|
||||||
@php
|
|
||||||
$check = is_array($check) ? $check : [];
|
|
||||||
|
|
||||||
$title = $check['title'] ?? 'Check';
|
|
||||||
$title = is_string($title) && trim($title) !== '' ? trim($title) : 'Check';
|
|
||||||
|
|
||||||
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
|
|
||||||
\App\Support\Badges\BadgeDomain::VerificationCheckStatus,
|
|
||||||
$check['status'] ?? null,
|
|
||||||
);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between gap-3 rounded-lg border border-gray-200 bg-white p-3 text-sm shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
||||||
<div class="font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $title }}
|
|
||||||
</div>
|
|
||||||
<x-filament::badge :color="$statusSpec->color" :icon="$statusSpec->icon" size="sm">
|
|
||||||
{{ $statusSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</x-filament::section>
|
</x-filament::section>
|
||||||
|
|||||||
@ -1,787 +1,2 @@
|
|||||||
@php
|
{{-- NormalizedDiffSurface normalized-diff wrapper --}}
|
||||||
$diff = $getState() ?? ['summary' => [], 'added' => [], 'removed' => [], 'changed' => []];
|
@include('filament.infolists.entries.normalized-diff.wrapper', ['state' => $getState() ?? []])
|
||||||
$summary = $diff['summary'] ?? [];
|
|
||||||
$policyType = $diff['policy_type'] ?? null;
|
|
||||||
|
|
||||||
$groupByBlock = static function (array $items): array {
|
|
||||||
$groups = [];
|
|
||||||
|
|
||||||
foreach ($items as $path => $value) {
|
|
||||||
if (! is_string($path) || $path === '') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parts = explode(' > ', $path, 2);
|
|
||||||
|
|
||||||
if (count($parts) === 2) {
|
|
||||||
[$group, $label] = $parts;
|
|
||||||
} else {
|
|
||||||
$group = 'Other';
|
|
||||||
$label = $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups[$group][$label] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
ksort($groups);
|
|
||||||
|
|
||||||
return $groups;
|
|
||||||
};
|
|
||||||
|
|
||||||
$stringify = static function (mixed $value): string {
|
|
||||||
if ($value === null) {
|
|
||||||
return '—';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_bool($value)) {
|
|
||||||
return $value ? 'Enabled' : 'Disabled';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_scalar($value)) {
|
|
||||||
return (string) $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?: '';
|
|
||||||
};
|
|
||||||
|
|
||||||
$isExpandable = static function (mixed $value): bool {
|
|
||||||
if (is_array($value)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_string($value) && strlen($value) > 160;
|
|
||||||
};
|
|
||||||
|
|
||||||
$isScriptKey = static function (mixed $name): bool {
|
|
||||||
return in_array((string) $name, ['scriptContent', 'detectionScriptContent', 'remediationScriptContent'], true);
|
|
||||||
};
|
|
||||||
|
|
||||||
$canHighlightScripts = static function (?string $policyType): bool {
|
|
||||||
return (bool) config('tenantpilot.display.show_script_content', false)
|
|
||||||
&& in_array($policyType, ['deviceManagementScript', 'deviceShellScript', 'deviceHealthScript', 'deviceComplianceScript'], true);
|
|
||||||
};
|
|
||||||
|
|
||||||
$selectGrammar = static function (?string $policyType, string $code): string {
|
|
||||||
if ($policyType === 'deviceShellScript') {
|
|
||||||
$firstLine = strtok($code, "\n") ?: '';
|
|
||||||
$shebang = trim($firstLine);
|
|
||||||
|
|
||||||
if (str_starts_with($shebang, '#!')) {
|
|
||||||
if (str_contains($shebang, 'zsh')) {
|
|
||||||
return 'zsh';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($shebang, 'bash')) {
|
|
||||||
return 'bash';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'sh';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'sh';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'powershell';
|
|
||||||
};
|
|
||||||
|
|
||||||
$highlight = static function (?string $policyType, string $code, string $fallbackClass = '') use ($selectGrammar): ?string {
|
|
||||||
if (! class_exists(\Torchlight\Engine\Engine::class)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return (new \Torchlight\Engine\Engine())->codeToHtml(
|
|
||||||
code: $code,
|
|
||||||
grammar: $selectGrammar($policyType, $code),
|
|
||||||
theme: [
|
|
||||||
'light' => 'github-light',
|
|
||||||
'dark' => 'github-dark',
|
|
||||||
],
|
|
||||||
withGutter: false,
|
|
||||||
withWrapper: true,
|
|
||||||
);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$highlightInline = static function (?string $policyType, string $code) use ($selectGrammar): ?string {
|
|
||||||
if (! class_exists(\Torchlight\Engine\Engine::class)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($code === '') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$html = (new \Torchlight\Engine\Engine())->codeToHtml(
|
|
||||||
code: $code,
|
|
||||||
grammar: $selectGrammar($policyType, $code),
|
|
||||||
theme: [
|
|
||||||
'light' => 'github-light',
|
|
||||||
'dark' => 'github-dark',
|
|
||||||
],
|
|
||||||
withGutter: false,
|
|
||||||
withWrapper: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
$html = (string) preg_replace('/<!--\s*Syntax highlighted by[^>]*-->/', '', $html);
|
|
||||||
|
|
||||||
if (! preg_match('/<code\b[^>]*>.*?<\\/code>/s', $html, $matches)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return trim((string) ($matches[0] ?? ''));
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$splitLines = static function (string $text): array {
|
|
||||||
$text = str_replace(["\r\n", "\r"], "\n", $text);
|
|
||||||
|
|
||||||
return $text === '' ? [] : explode("\n", $text);
|
|
||||||
};
|
|
||||||
|
|
||||||
$myersLineDiff = static function (array $a, array $b): array {
|
|
||||||
$n = count($a);
|
|
||||||
$m = count($b);
|
|
||||||
$max = $n + $m;
|
|
||||||
|
|
||||||
$v = [1 => 0];
|
|
||||||
$trace = [];
|
|
||||||
|
|
||||||
for ($d = 0; $d <= $max; $d++) {
|
|
||||||
$trace[$d] = $v;
|
|
||||||
|
|
||||||
for ($k = -$d; $k <= $d; $k += 2) {
|
|
||||||
$kPlus = $v[$k + 1] ?? 0;
|
|
||||||
$kMinus = $v[$k - 1] ?? 0;
|
|
||||||
|
|
||||||
if ($k === -$d || ($k !== $d && $kMinus < $kPlus)) {
|
|
||||||
$x = $kPlus;
|
|
||||||
} else {
|
|
||||||
$x = $kMinus + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$y = $x - $k;
|
|
||||||
|
|
||||||
while ($x < $n && $y < $m && $a[$x] === $b[$y]) {
|
|
||||||
$x++;
|
|
||||||
$y++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$v[$k] = $x;
|
|
||||||
|
|
||||||
if ($x >= $n && $y >= $m) {
|
|
||||||
break 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$ops = [];
|
|
||||||
$x = $n;
|
|
||||||
$y = $m;
|
|
||||||
|
|
||||||
for ($d = count($trace) - 1; $d >= 0; $d--) {
|
|
||||||
$v = $trace[$d];
|
|
||||||
$k = $x - $y;
|
|
||||||
|
|
||||||
$kPlus = $v[$k + 1] ?? 0;
|
|
||||||
$kMinus = $v[$k - 1] ?? 0;
|
|
||||||
|
|
||||||
if ($k === -$d || ($k !== $d && $kMinus < $kPlus)) {
|
|
||||||
$prevK = $k + 1;
|
|
||||||
} else {
|
|
||||||
$prevK = $k - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$prevX = $v[$prevK] ?? 0;
|
|
||||||
$prevY = $prevX - $prevK;
|
|
||||||
|
|
||||||
while ($x > $prevX && $y > $prevY) {
|
|
||||||
$ops[] = ['type' => 'equal', 'line' => $a[$x - 1]];
|
|
||||||
$x--;
|
|
||||||
$y--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($d === 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($x === $prevX) {
|
|
||||||
$ops[] = ['type' => 'insert', 'line' => $b[$y - 1] ?? ''];
|
|
||||||
$y--;
|
|
||||||
} else {
|
|
||||||
$ops[] = ['type' => 'delete', 'line' => $a[$x - 1] ?? ''];
|
|
||||||
$x--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return array_reverse($ops);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scriptLineDiff = static function (string $fromText, string $toText) use ($splitLines, $myersLineDiff): array {
|
|
||||||
return $myersLineDiff($splitLines($fromText), $splitLines($toText));
|
|
||||||
};
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
|
||||||
<x-filament::section
|
|
||||||
heading="Normalized diff"
|
|
||||||
:description="$summary['message'] ?? sprintf('%d added, %d removed, %d changed', $summary['added'] ?? 0, $summary['removed'] ?? 0, $summary['changed'] ?? 0)"
|
|
||||||
>
|
|
||||||
<div class="flex flex-wrap gap-2">
|
|
||||||
<x-filament::badge color="success">
|
|
||||||
{{ (int) ($summary['added'] ?? 0) }} added
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="danger">
|
|
||||||
{{ (int) ($summary['removed'] ?? 0) }} removed
|
|
||||||
</x-filament::badge>
|
|
||||||
<x-filament::badge color="warning">
|
|
||||||
{{ (int) ($summary['changed'] ?? 0) }} changed
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
|
|
||||||
@foreach (['changed' => ['label' => 'Changed', 'collapsed' => false], 'added' => ['label' => 'Added', 'collapsed' => true], 'removed' => ['label' => 'Removed', 'collapsed' => true]] as $key => $meta)
|
|
||||||
@php
|
|
||||||
$items = $diff[$key] ?? [];
|
|
||||||
$groups = $groupByBlock(is_array($items) ? $items : []);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($groups !== [])
|
|
||||||
<x-filament::section
|
|
||||||
:heading="$meta['label']"
|
|
||||||
collapsible
|
|
||||||
:collapsed="$meta['collapsed']"
|
|
||||||
>
|
|
||||||
<div class="space-y-6">
|
|
||||||
@foreach ($groups as $group => $groupItems)
|
|
||||||
<div>
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ $group }}
|
|
||||||
</div>
|
|
||||||
<x-filament::badge size="sm" color="gray">
|
|
||||||
{{ count($groupItems) }}
|
|
||||||
</x-filament::badge>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-2 divide-y divide-gray-200 rounded-lg border border-gray-200 dark:divide-white/10 dark:border-white/10">
|
|
||||||
@foreach ($groupItems as $name => $value)
|
|
||||||
<div class="px-4 py-3">
|
|
||||||
@if ($key === 'changed' && is_array($value) && array_key_exists('from', $value) && array_key_exists('to', $value))
|
|
||||||
@php
|
|
||||||
$from = $value['from'];
|
|
||||||
$to = $value['to'];
|
|
||||||
$fromText = $stringify($from);
|
|
||||||
$toText = $stringify($to);
|
|
||||||
|
|
||||||
$isScriptContent = $canHighlightScripts($policyType) && $isScriptKey($name);
|
|
||||||
$ops = $isScriptContent ? $scriptLineDiff((string) $fromText, (string) $toText) : [];
|
|
||||||
$useTorchlight = $isScriptContent && class_exists(\Torchlight\Engine\Engine::class);
|
|
||||||
|
|
||||||
$rows = [];
|
|
||||||
if ($isScriptContent) {
|
|
||||||
$count = count($ops);
|
|
||||||
|
|
||||||
for ($i = 0; $i < $count; $i++) {
|
|
||||||
$op = $ops[$i];
|
|
||||||
$next = $ops[$i + 1] ?? null;
|
|
||||||
$type = $op['type'] ?? null;
|
|
||||||
$line = (string) ($op['line'] ?? '');
|
|
||||||
|
|
||||||
if ($type === 'equal') {
|
|
||||||
$rows[] = [
|
|
||||||
'left' => ['type' => 'equal', 'line' => $line],
|
|
||||||
'right' => ['type' => 'equal', 'line' => $line],
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type === 'delete' && is_array($next) && ($next['type'] ?? null) === 'insert') {
|
|
||||||
$rows[] = [
|
|
||||||
'left' => ['type' => 'delete', 'line' => $line],
|
|
||||||
'right' => ['type' => 'insert', 'line' => (string) ($next['line'] ?? '')],
|
|
||||||
];
|
|
||||||
$i++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type === 'delete') {
|
|
||||||
$rows[] = [
|
|
||||||
'left' => ['type' => 'delete', 'line' => $line],
|
|
||||||
'right' => ['type' => 'blank', 'line' => ''],
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type === 'insert') {
|
|
||||||
$rows[] = [
|
|
||||||
'left' => ['type' => 'blank', 'line' => ''],
|
|
||||||
'right' => ['type' => 'insert', 'line' => $line],
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ (string) $name }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($isScriptContent)
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300 sm:col-span-2">
|
|
||||||
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Script</span>
|
|
||||||
<details class="mt-1" x-data="{ fullscreenOpen: false }">
|
|
||||||
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
View
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
<div x-data="{ tab: 'diff' }" class="mt-2 space-y-3">
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<x-filament::button size="xs" color="gray" type="button" x-on:click="tab = 'diff'" x-bind:class="tab === 'diff' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
|
||||||
Diff
|
|
||||||
</x-filament::button>
|
|
||||||
<x-filament::button size="xs" color="gray" type="button" x-on:click="tab = 'before'" x-bind:class="tab === 'before' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
|
||||||
Before
|
|
||||||
</x-filament::button>
|
|
||||||
<x-filament::button size="xs" color="gray" type="button" x-on:click="tab = 'after'" x-bind:class="tab === 'after' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
|
||||||
After
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<x-filament::button size="xs" color="gray" type="button" x-on:click="fullscreenOpen = true">
|
|
||||||
⤢ Fullscreen
|
|
||||||
</x-filament::button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'diff'" x-cloak>
|
|
||||||
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
||||||
<div>
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Old</div>
|
|
||||||
<pre class="mt-1 max-h-96 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">@php
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$left = $row['left'];
|
|
||||||
$leftType = $left['type'];
|
|
||||||
$leftLine = (string) ($left['line'] ?? '');
|
|
||||||
|
|
||||||
$leftHighlighted = $useTorchlight ? $highlightInline($policyType, $leftLine) : null;
|
|
||||||
$leftRendered = (is_string($leftHighlighted) && $leftHighlighted !== '') ? $leftHighlighted : e($leftLine);
|
|
||||||
|
|
||||||
if ($leftType === 'equal') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="tp-script-diff-line">'.$leftRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($leftType === 'delete') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="block tp-script-diff-line bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
}
|
|
||||||
@endphp</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">New</div>
|
|
||||||
<pre class="mt-1 max-h-96 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">@php
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$right = $row['right'];
|
|
||||||
$rightType = $right['type'];
|
|
||||||
$rightLine = (string) ($right['line'] ?? '');
|
|
||||||
|
|
||||||
$rightHighlighted = $useTorchlight ? $highlightInline($policyType, $rightLine) : null;
|
|
||||||
$rightRendered = (is_string($rightHighlighted) && $rightHighlighted !== '') ? $rightHighlighted : e($rightLine);
|
|
||||||
|
|
||||||
if ($rightType === 'equal') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="tp-script-diff-line">'.$rightRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rightType === 'insert') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="block tp-script-diff-line bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
}
|
|
||||||
@endphp</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'before'" x-cloak>
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Before</div>
|
|
||||||
@php
|
|
||||||
$highlightedBefore = $useTorchlight ? $highlight($policyType, (string) $fromText) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($highlightedBefore) && $highlightedBefore !== '')
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
@endonce
|
|
||||||
|
|
||||||
<div class="mt-1 max-h-96 overflow-auto">{!! $highlightedBefore !!}</div>
|
|
||||||
@else
|
|
||||||
<pre class="mt-1 max-h-96 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">{{ (string) $fromText }}</pre>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'after'" x-cloak>
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">After</div>
|
|
||||||
@php
|
|
||||||
$highlightedAfter = $useTorchlight ? $highlight($policyType, (string) $toText) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($highlightedAfter) && $highlightedAfter !== '')
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
@endonce
|
|
||||||
|
|
||||||
<div class="mt-1 max-h-96 overflow-auto">{!! $highlightedAfter !!}</div>
|
|
||||||
@else
|
|
||||||
<pre class="mt-1 max-h-96 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">{{ (string) $toText }}</pre>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
x-show="fullscreenOpen"
|
|
||||||
x-cloak
|
|
||||||
x-on:keydown.escape.window="fullscreenOpen = false"
|
|
||||||
class="fixed inset-0 z-50"
|
|
||||||
>
|
|
||||||
<div class="absolute inset-0 bg-gray-950/50"></div>
|
|
||||||
<div class="relative flex h-full w-full flex-col bg-white dark:bg-gray-900">
|
|
||||||
<div class="flex items-center justify-between gap-3 border-b border-gray-200 px-4 py-3 dark:border-white/10">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">Script diff</div>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<x-filament::button size="sm" color="gray" type="button" x-on:click="fullscreenOpen = false">
|
|
||||||
Close
|
|
||||||
</x-filament::button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex-1 overflow-hidden p-4">
|
|
||||||
<div
|
|
||||||
x-data="{
|
|
||||||
tab: 'diff',
|
|
||||||
syncing: false,
|
|
||||||
syncHorizontal: true,
|
|
||||||
sync(from, to) {
|
|
||||||
if (this.syncing) return;
|
|
||||||
this.syncing = true;
|
|
||||||
|
|
||||||
to.scrollTop = from.scrollTop;
|
|
||||||
|
|
||||||
const bothHorizontal = this.syncHorizontal
|
|
||||||
&& from.scrollWidth > from.clientWidth
|
|
||||||
&& to.scrollWidth > to.clientWidth;
|
|
||||||
|
|
||||||
if (bothHorizontal) {
|
|
||||||
to.scrollLeft = from.scrollLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestAnimationFrame(() => { this.syncing = false; });
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
x-init="$nextTick(() => {
|
|
||||||
const left = $refs.left;
|
|
||||||
const right = $refs.right;
|
|
||||||
|
|
||||||
if (!left || !right) return;
|
|
||||||
|
|
||||||
left.addEventListener('scroll', () => sync(left, right), { passive: true });
|
|
||||||
right.addEventListener('scroll', () => sync(right, left), { passive: true });
|
|
||||||
})"
|
|
||||||
class="h-full space-y-3"
|
|
||||||
>
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<x-filament::button size="sm" color="gray" type="button" x-on:click="tab = 'diff'" x-bind:class="tab === 'diff' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
|
||||||
Diff
|
|
||||||
</x-filament::button>
|
|
||||||
<x-filament::button size="sm" color="gray" type="button" x-on:click="tab = 'before'" x-bind:class="tab === 'before' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
|
||||||
Before
|
|
||||||
</x-filament::button>
|
|
||||||
<x-filament::button size="sm" color="gray" type="button" x-on:click="tab = 'after'" x-bind:class="tab === 'after' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
|
||||||
After
|
|
||||||
</x-filament::button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'diff'" x-cloak class="h-[calc(100%-3rem)]">
|
|
||||||
<div class="grid h-full grid-cols-1 gap-4 lg:grid-cols-2">
|
|
||||||
<div class="flex h-full flex-col">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Old</div>
|
|
||||||
<pre x-ref="left" class="mt-2 flex-1 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">@php
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$left = $row['left'];
|
|
||||||
$leftType = $left['type'];
|
|
||||||
$leftLine = (string) ($left['line'] ?? '');
|
|
||||||
|
|
||||||
$leftHighlighted = $useTorchlight ? $highlightInline($policyType, $leftLine) : null;
|
|
||||||
$leftRendered = (is_string($leftHighlighted) && $leftHighlighted !== '') ? $leftHighlighted : e($leftLine);
|
|
||||||
|
|
||||||
if ($leftType === 'equal') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="tp-script-diff-line">'.$leftRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($leftType === 'delete') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="block tp-script-diff-line bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
}
|
|
||||||
@endphp</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex h-full flex-col">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">New</div>
|
|
||||||
<pre x-ref="right" class="mt-2 flex-1 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">@php
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$right = $row['right'];
|
|
||||||
$rightType = $right['type'];
|
|
||||||
$rightLine = (string) ($right['line'] ?? '');
|
|
||||||
|
|
||||||
$rightHighlighted = $useTorchlight ? $highlightInline($policyType, $rightLine) : null;
|
|
||||||
$rightRendered = (is_string($rightHighlighted) && $rightHighlighted !== '') ? $rightHighlighted : e($rightLine);
|
|
||||||
|
|
||||||
if ($rightType === 'equal') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="tp-script-diff-line">'.$rightRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rightType === 'insert') {
|
|
||||||
if ($useTorchlight) {
|
|
||||||
@endphp
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
<style>
|
|
||||||
.tp-script-diff-line code.torchlight {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@endonce
|
|
||||||
@php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="block tp-script-diff-line bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
}
|
|
||||||
@endphp</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'before'" x-cloak class="h-[calc(100%-3rem)]">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Before</div>
|
|
||||||
@php
|
|
||||||
$highlightedBeforeFullscreen = $useTorchlight ? $highlight($policyType, (string) $fromText) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($highlightedBeforeFullscreen) && $highlightedBeforeFullscreen !== '')
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
@endonce
|
|
||||||
|
|
||||||
<div class="mt-2 h-full overflow-auto">{!! $highlightedBeforeFullscreen !!}</div>
|
|
||||||
@else
|
|
||||||
<pre class="mt-2 h-full overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">{{ (string) $fromText }}</pre>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'after'" x-cloak class="h-[calc(100%-3rem)]">
|
|
||||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">After</div>
|
|
||||||
@php
|
|
||||||
$highlightedAfterFullscreen = $useTorchlight ? $highlight($policyType, (string) $toText) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($highlightedAfterFullscreen) && $highlightedAfterFullscreen !== '')
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
@endonce
|
|
||||||
|
|
||||||
<div class="mt-2 h-full overflow-auto">{!! $highlightedAfterFullscreen !!}</div>
|
|
||||||
@else
|
|
||||||
<pre class="mt-2 h-full overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">{{ (string) $toText }}</pre>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">From</span>
|
|
||||||
@if ($isExpandable($from))
|
|
||||||
<details class="mt-1">
|
|
||||||
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
View
|
|
||||||
</summary>
|
|
||||||
<pre class="mt-2 overflow-x-auto text-xs text-gray-800 dark:text-gray-200">{{ $fromText }}</pre>
|
|
||||||
</details>
|
|
||||||
@else
|
|
||||||
<div class="mt-1">{{ $fromText }}</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
|
||||||
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">To</span>
|
|
||||||
@if ($isExpandable($to))
|
|
||||||
<details class="mt-1">
|
|
||||||
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
View
|
|
||||||
</summary>
|
|
||||||
<pre class="mt-2 overflow-x-auto text-xs text-gray-800 dark:text-gray-200">{{ $toText }}</pre>
|
|
||||||
</details>
|
|
||||||
@else
|
|
||||||
<div class="mt-1">{{ $toText }}</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
@php
|
|
||||||
$text = $stringify($value);
|
|
||||||
@endphp
|
|
||||||
<div class="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
|
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
|
||||||
{{ (string) $name }}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm text-gray-700 dark:text-gray-200 sm:max-w-[70%]">
|
|
||||||
@if ($isExpandable($value))
|
|
||||||
<details>
|
|
||||||
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
|
||||||
View
|
|
||||||
</summary>
|
|
||||||
@php
|
|
||||||
$isScriptContent = $canHighlightScripts($policyType) && $isScriptKey($name);
|
|
||||||
$highlighted = $isScriptContent ? $highlight($policyType, (string) $text) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (is_string($highlighted) && $highlighted !== '')
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
@endonce
|
|
||||||
|
|
||||||
<div class="mt-2 overflow-x-auto">{!! $highlighted !!}</div>
|
|
||||||
@else
|
|
||||||
<pre class="mt-2 overflow-x-auto text-xs text-gray-800 dark:text-gray-200">{{ $text }}</pre>
|
|
||||||
@endif
|
|
||||||
</details>
|
|
||||||
@else
|
|
||||||
<div class="break-words">{{ $text }}</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
@php
|
||||||
|
$emptyState = is_array($emptyState ?? null) ? $emptyState : [];
|
||||||
|
$availabilityState = is_string($availabilityState ?? null) ? (string) $availabilityState : 'available';
|
||||||
|
$toneClasses = match ($availabilityState) {
|
||||||
|
'unavailable' => 'border-danger-200 bg-danger-50 text-danger-900 dark:border-danger-500/30 dark:bg-danger-500/10 dark:text-danger-100',
|
||||||
|
'partial' => 'border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100',
|
||||||
|
default => 'border-gray-200 bg-white text-gray-700 dark:border-white/10 dark:bg-gray-900 dark:text-gray-200',
|
||||||
|
};
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div data-shared-zone="empty" class="rounded-lg border px-4 py-3 text-sm {{ $toneClasses }}">
|
||||||
|
<div class="font-medium">
|
||||||
|
{{ $emptyState['title'] ?? 'No normalized changes' }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ $emptyState['message'] ?? 'No normalized changes were found.' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,772 @@
|
|||||||
|
@php
|
||||||
|
$diff = is_array($surface['raw'] ?? null) ? $surface['raw'] : ['changed' => [], 'added' => [], 'removed' => []];
|
||||||
|
$groupMeta = collect($surface['groups'] ?? [])
|
||||||
|
->filter(static fn (mixed $group): bool => is_array($group))
|
||||||
|
->values();
|
||||||
|
$policyType = is_string($surface['scriptRendering']['policyType'] ?? null) ? (string) $surface['scriptRendering']['policyType'] : null;
|
||||||
|
|
||||||
|
$groupByBlock = static function (array $items): array {
|
||||||
|
$groups = [];
|
||||||
|
|
||||||
|
foreach ($items as $path => $value) {
|
||||||
|
if (! is_string($path) || $path === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(' > ', $path, 2);
|
||||||
|
|
||||||
|
if (count($parts) === 2) {
|
||||||
|
[$group, $label] = $parts;
|
||||||
|
} else {
|
||||||
|
$group = 'Other';
|
||||||
|
$label = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
$groups[$group][$label] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($groups);
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
};
|
||||||
|
|
||||||
|
$stringify = static function (mixed $value): string {
|
||||||
|
if ($value === null) {
|
||||||
|
return '—';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_bool($value)) {
|
||||||
|
return $value ? 'Enabled' : 'Disabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_scalar($value)) {
|
||||||
|
return (string) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?: '';
|
||||||
|
};
|
||||||
|
|
||||||
|
$isExpandable = static function (mixed $value): bool {
|
||||||
|
if (is_array($value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_string($value) && strlen($value) > 160;
|
||||||
|
};
|
||||||
|
|
||||||
|
$isScriptKey = static function (mixed $name): bool {
|
||||||
|
return in_array((string) $name, ['scriptContent', 'detectionScriptContent', 'remediationScriptContent'], true);
|
||||||
|
};
|
||||||
|
|
||||||
|
$canHighlightScripts = static function (?string $policyType): bool {
|
||||||
|
return (bool) config('tenantpilot.display.show_script_content', false)
|
||||||
|
&& in_array($policyType, ['deviceManagementScript', 'deviceShellScript', 'deviceHealthScript', 'deviceComplianceScript'], true);
|
||||||
|
};
|
||||||
|
|
||||||
|
$selectGrammar = static function (?string $policyType, string $code): string {
|
||||||
|
if ($policyType === 'deviceShellScript') {
|
||||||
|
$firstLine = strtok($code, "\n") ?: '';
|
||||||
|
$shebang = trim($firstLine);
|
||||||
|
|
||||||
|
if (str_starts_with($shebang, '#!')) {
|
||||||
|
if (str_contains($shebang, 'zsh')) {
|
||||||
|
return 'zsh';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str_contains($shebang, 'bash')) {
|
||||||
|
return 'bash';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'sh';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'sh';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'powershell';
|
||||||
|
};
|
||||||
|
|
||||||
|
$highlight = static function (?string $policyType, string $code) use ($selectGrammar): ?string {
|
||||||
|
if (! class_exists(\Torchlight\Engine\Engine::class)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return (new \Torchlight\Engine\Engine())->codeToHtml(
|
||||||
|
code: $code,
|
||||||
|
grammar: $selectGrammar($policyType, $code),
|
||||||
|
theme: [
|
||||||
|
'light' => 'github-light',
|
||||||
|
'dark' => 'github-dark',
|
||||||
|
],
|
||||||
|
withGutter: false,
|
||||||
|
withWrapper: true,
|
||||||
|
);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$highlightInline = static function (?string $policyType, string $code) use ($selectGrammar): ?string {
|
||||||
|
if (! class_exists(\Torchlight\Engine\Engine::class)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($code === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$html = (new \Torchlight\Engine\Engine())->codeToHtml(
|
||||||
|
code: $code,
|
||||||
|
grammar: $selectGrammar($policyType, $code),
|
||||||
|
theme: [
|
||||||
|
'light' => 'github-light',
|
||||||
|
'dark' => 'github-dark',
|
||||||
|
],
|
||||||
|
withGutter: false,
|
||||||
|
withWrapper: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
$html = (string) preg_replace('/<!--\s*Syntax highlighted by[^>]*-->/', '', $html);
|
||||||
|
|
||||||
|
if (! preg_match('/<code\b[^>]*>.*?<\\/code>/s', $html, $matches)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return trim((string) ($matches[0] ?? ''));
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$splitLines = static function (string $text): array {
|
||||||
|
$text = str_replace(["\r\n", "\r"], "\n", $text);
|
||||||
|
|
||||||
|
return $text === '' ? [] : explode("\n", $text);
|
||||||
|
};
|
||||||
|
|
||||||
|
$myersLineDiff = static function (array $a, array $b): array {
|
||||||
|
$n = count($a);
|
||||||
|
$m = count($b);
|
||||||
|
$max = $n + $m;
|
||||||
|
$v = [1 => 0];
|
||||||
|
$trace = [];
|
||||||
|
|
||||||
|
for ($d = 0; $d <= $max; $d++) {
|
||||||
|
$trace[$d] = $v;
|
||||||
|
|
||||||
|
for ($k = -$d; $k <= $d; $k += 2) {
|
||||||
|
$kPlus = $v[$k + 1] ?? 0;
|
||||||
|
$kMinus = $v[$k - 1] ?? 0;
|
||||||
|
|
||||||
|
if ($k === -$d || ($k !== $d && $kMinus < $kPlus)) {
|
||||||
|
$x = $kPlus;
|
||||||
|
} else {
|
||||||
|
$x = $kMinus + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$y = $x - $k;
|
||||||
|
|
||||||
|
while ($x < $n && $y < $m && $a[$x] === $b[$y]) {
|
||||||
|
$x++;
|
||||||
|
$y++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$v[$k] = $x;
|
||||||
|
|
||||||
|
if ($x >= $n && $y >= $m) {
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ops = [];
|
||||||
|
$x = $n;
|
||||||
|
$y = $m;
|
||||||
|
|
||||||
|
for ($d = count($trace) - 1; $d >= 0; $d--) {
|
||||||
|
$v = $trace[$d];
|
||||||
|
$k = $x - $y;
|
||||||
|
|
||||||
|
$kPlus = $v[$k + 1] ?? 0;
|
||||||
|
$kMinus = $v[$k - 1] ?? 0;
|
||||||
|
|
||||||
|
if ($k === -$d || ($k !== $d && $kMinus < $kPlus)) {
|
||||||
|
$prevK = $k + 1;
|
||||||
|
} else {
|
||||||
|
$prevK = $k - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$prevX = $v[$prevK] ?? 0;
|
||||||
|
$prevY = $prevX - $prevK;
|
||||||
|
|
||||||
|
while ($x > $prevX && $y > $prevY) {
|
||||||
|
$ops[] = ['type' => 'equal', 'line' => $a[$x - 1]];
|
||||||
|
$x--;
|
||||||
|
$y--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($d === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($x === $prevX) {
|
||||||
|
$ops[] = ['type' => 'insert', 'line' => $b[$y - 1] ?? ''];
|
||||||
|
$y--;
|
||||||
|
} else {
|
||||||
|
$ops[] = ['type' => 'delete', 'line' => $a[$x - 1] ?? ''];
|
||||||
|
$x--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_reverse($ops);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scriptLineDiff = static function (string $fromText, string $toText) use ($splitLines, $myersLineDiff): array {
|
||||||
|
return $myersLineDiff($splitLines($fromText), $splitLines($toText));
|
||||||
|
};
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div data-shared-zone="groups" class="space-y-4">
|
||||||
|
@foreach ($groupMeta as $group)
|
||||||
|
@php
|
||||||
|
$key = is_string($group['key'] ?? null) ? (string) $group['key'] : 'changed';
|
||||||
|
$label = is_string($group['label'] ?? null) ? (string) $group['label'] : ucfirst($key);
|
||||||
|
$collapsed = (bool) ($group['collapsed'] ?? false);
|
||||||
|
$items = is_array($diff[$key] ?? null) ? $diff[$key] : [];
|
||||||
|
$groups = $groupByBlock($items);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($groups !== [])
|
||||||
|
<x-filament::section
|
||||||
|
:heading="$label"
|
||||||
|
collapsible
|
||||||
|
:collapsed="$collapsed"
|
||||||
|
>
|
||||||
|
<div class="space-y-6">
|
||||||
|
@foreach ($groups as $groupLabel => $groupItems)
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
|
{{ $groupLabel }}
|
||||||
|
</div>
|
||||||
|
<x-filament::badge size="sm" color="gray">
|
||||||
|
{{ count($groupItems) }}
|
||||||
|
</x-filament::badge>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-2 divide-y divide-gray-200 rounded-lg border border-gray-200 dark:divide-white/10 dark:border-white/10">
|
||||||
|
@foreach ($groupItems as $name => $value)
|
||||||
|
<div class="px-4 py-3">
|
||||||
|
@if ($key === 'changed' && is_array($value) && array_key_exists('from', $value) && array_key_exists('to', $value))
|
||||||
|
@php
|
||||||
|
$from = $value['from'];
|
||||||
|
$to = $value['to'];
|
||||||
|
$fromText = $stringify($from);
|
||||||
|
$toText = $stringify($to);
|
||||||
|
$isScriptContent = $canHighlightScripts($policyType) && $isScriptKey($name);
|
||||||
|
$ops = $isScriptContent ? $scriptLineDiff((string) $fromText, (string) $toText) : [];
|
||||||
|
$useTorchlight = $isScriptContent && class_exists(\Torchlight\Engine\Engine::class);
|
||||||
|
|
||||||
|
$rows = [];
|
||||||
|
if ($isScriptContent) {
|
||||||
|
$count = count($ops);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
$op = $ops[$i];
|
||||||
|
$next = $ops[$i + 1] ?? null;
|
||||||
|
$type = $op['type'] ?? null;
|
||||||
|
$line = (string) ($op['line'] ?? '');
|
||||||
|
|
||||||
|
if ($type === 'equal') {
|
||||||
|
$rows[] = [
|
||||||
|
'left' => ['type' => 'equal', 'line' => $line],
|
||||||
|
'right' => ['type' => 'equal', 'line' => $line],
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'delete' && is_array($next) && ($next['type'] ?? null) === 'insert') {
|
||||||
|
$rows[] = [
|
||||||
|
'left' => ['type' => 'delete', 'line' => $line],
|
||||||
|
'right' => ['type' => 'insert', 'line' => (string) ($next['line'] ?? '')],
|
||||||
|
];
|
||||||
|
$i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'delete') {
|
||||||
|
$rows[] = [
|
||||||
|
'left' => ['type' => 'delete', 'line' => $line],
|
||||||
|
'right' => ['type' => 'blank', 'line' => ''],
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === 'insert') {
|
||||||
|
$rows[] = [
|
||||||
|
'left' => ['type' => 'blank', 'line' => ''],
|
||||||
|
'right' => ['type' => 'insert', 'line' => $line],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 gap-2 sm:grid-cols-3">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
|
{{ (string) $name }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if ($isScriptContent)
|
||||||
|
<div class="text-sm text-gray-600 dark:text-gray-300 sm:col-span-2">
|
||||||
|
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Script</span>
|
||||||
|
<details class="mt-1" x-data="{ fullscreenOpen: false }">
|
||||||
|
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
View
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
<div x-data="{ tab: 'diff' }" class="mt-2 space-y-3">
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<x-filament::button size="xs" color="gray" type="button" x-on:click="tab = 'diff'" x-bind:class="tab === 'diff' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
||||||
|
Diff
|
||||||
|
</x-filament::button>
|
||||||
|
<x-filament::button size="xs" color="gray" type="button" x-on:click="tab = 'before'" x-bind:class="tab === 'before' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
||||||
|
Before
|
||||||
|
</x-filament::button>
|
||||||
|
<x-filament::button size="xs" color="gray" type="button" x-on:click="tab = 'after'" x-bind:class="tab === 'after' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
||||||
|
After
|
||||||
|
</x-filament::button>
|
||||||
|
<x-filament::button size="xs" color="gray" type="button" x-on:click="fullscreenOpen = true">
|
||||||
|
⤢ Fullscreen
|
||||||
|
</x-filament::button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="tab === 'diff'" x-cloak>
|
||||||
|
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Old</div>
|
||||||
|
<pre class="mt-1 max-h-96 overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">@php
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$left = $row['left'];
|
||||||
|
$leftType = $left['type'];
|
||||||
|
$leftLine = (string) ($left['line'] ?? '');
|
||||||
|
|
||||||
|
$leftHighlighted = $useTorchlight ? $highlightInline($policyType, $leftLine) : null;
|
||||||
|
$leftRendered = (is_string($leftHighlighted) && $leftHighlighted !== '') ? $leftHighlighted : e($leftLine);
|
||||||
|
|
||||||
|
if ($leftType === 'equal') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="tp-script-diff-line">'.$leftRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($leftType === 'delete') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="block tp-script-diff-line bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
@endphp</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">New</div>
|
||||||
|
<pre class="mt-1 max-h-96 overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">@php
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$right = $row['right'];
|
||||||
|
$rightType = $right['type'];
|
||||||
|
$rightLine = (string) ($right['line'] ?? '');
|
||||||
|
|
||||||
|
$rightHighlighted = $useTorchlight ? $highlightInline($policyType, $rightLine) : null;
|
||||||
|
$rightRendered = (is_string($rightHighlighted) && $rightHighlighted !== '') ? $rightHighlighted : e($rightLine);
|
||||||
|
|
||||||
|
if ($rightType === 'equal') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="tp-script-diff-line">'.$rightRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rightType === 'insert') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="block tp-script-diff-line bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
@endphp</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="tab === 'before'" x-cloak>
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Before</div>
|
||||||
|
@php
|
||||||
|
$highlightedBefore = $useTorchlight ? $highlight($policyType, (string) $fromText) : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if (is_string($highlightedBefore) && $highlightedBefore !== '')
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
@endonce
|
||||||
|
|
||||||
|
<div class="mt-1 max-h-96 overflow-auto">{!! $highlightedBefore !!}</div>
|
||||||
|
@else
|
||||||
|
<pre class="mt-1 max-h-96 overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">{{ (string) $fromText }}</pre>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="tab === 'after'" x-cloak>
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">After</div>
|
||||||
|
@php
|
||||||
|
$highlightedAfter = $useTorchlight ? $highlight($policyType, (string) $toText) : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if (is_string($highlightedAfter) && $highlightedAfter !== '')
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
@endonce
|
||||||
|
|
||||||
|
<div class="mt-1 max-h-96 overflow-auto">{!! $highlightedAfter !!}</div>
|
||||||
|
@else
|
||||||
|
<pre class="mt-1 max-h-96 overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">{{ (string) $toText }}</pre>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
x-show="fullscreenOpen"
|
||||||
|
x-cloak
|
||||||
|
x-on:keydown.escape.window="fullscreenOpen = false"
|
||||||
|
class="fixed inset-0 z-50"
|
||||||
|
>
|
||||||
|
<div class="absolute inset-0 bg-gray-950/50"></div>
|
||||||
|
<div class="relative flex h-full w-full flex-col bg-white dark:bg-gray-900">
|
||||||
|
<div class="flex items-center justify-between gap-3 border-b border-gray-200 px-4 py-3 dark:border-white/10">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-white">Script diff</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<x-filament::button size="sm" color="gray" type="button" x-on:click="fullscreenOpen = false">
|
||||||
|
Close
|
||||||
|
</x-filament::button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-1 overflow-hidden p-4">
|
||||||
|
<div
|
||||||
|
x-data="{
|
||||||
|
tab: 'diff',
|
||||||
|
syncing: false,
|
||||||
|
syncHorizontal: true,
|
||||||
|
sync(from, to) {
|
||||||
|
if (this.syncing) return;
|
||||||
|
this.syncing = true;
|
||||||
|
to.scrollTop = from.scrollTop;
|
||||||
|
|
||||||
|
const bothHorizontal = this.syncHorizontal
|
||||||
|
&& from.scrollWidth > from.clientWidth
|
||||||
|
&& to.scrollWidth > to.clientWidth;
|
||||||
|
|
||||||
|
if (bothHorizontal) {
|
||||||
|
to.scrollLeft = from.scrollLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(() => { this.syncing = false; });
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
x-init="$nextTick(() => {
|
||||||
|
const left = $refs.left;
|
||||||
|
const right = $refs.right;
|
||||||
|
|
||||||
|
if (! left || ! right) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
left.addEventListener('scroll', () => sync(left, right), { passive: true });
|
||||||
|
right.addEventListener('scroll', () => sync(right, left), { passive: true });
|
||||||
|
})"
|
||||||
|
class="h-full space-y-3"
|
||||||
|
>
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<x-filament::button size="sm" color="gray" type="button" x-on:click="tab = 'diff'" x-bind:class="tab === 'diff' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
||||||
|
Diff
|
||||||
|
</x-filament::button>
|
||||||
|
<x-filament::button size="sm" color="gray" type="button" x-on:click="tab = 'before'" x-bind:class="tab === 'before' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
||||||
|
Before
|
||||||
|
</x-filament::button>
|
||||||
|
<x-filament::button size="sm" color="gray" type="button" x-on:click="tab = 'after'" x-bind:class="tab === 'after' ? 'ring-1 ring-gray-300 dark:ring-white/20' : ''">
|
||||||
|
After
|
||||||
|
</x-filament::button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="tab === 'diff'" x-cloak class="h-[calc(100%-3rem)]">
|
||||||
|
<div class="grid h-full grid-cols-1 gap-4 lg:grid-cols-2">
|
||||||
|
<div class="flex h-full flex-col">
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Old</div>
|
||||||
|
<pre x-ref="left" class="mt-2 flex-1 overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">@php
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$left = $row['left'];
|
||||||
|
$leftType = $left['type'];
|
||||||
|
$leftLine = (string) ($left['line'] ?? '');
|
||||||
|
|
||||||
|
$leftHighlighted = $useTorchlight ? $highlightInline($policyType, $leftLine) : null;
|
||||||
|
$leftRendered = (is_string($leftHighlighted) && $leftHighlighted !== '') ? $leftHighlighted : e($leftLine);
|
||||||
|
|
||||||
|
if ($leftType === 'equal') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="tp-script-diff-line">'.$leftRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($leftType === 'delete') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="block tp-script-diff-line bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
@endphp</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex h-full flex-col">
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">New</div>
|
||||||
|
<pre x-ref="right" class="mt-2 flex-1 overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">@php
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$right = $row['right'];
|
||||||
|
$rightType = $right['type'];
|
||||||
|
$rightLine = (string) ($right['line'] ?? '');
|
||||||
|
|
||||||
|
$rightHighlighted = $useTorchlight ? $highlightInline($policyType, $rightLine) : null;
|
||||||
|
$rightRendered = (is_string($rightHighlighted) && $rightHighlighted !== '') ? $rightHighlighted : e($rightLine);
|
||||||
|
|
||||||
|
if ($rightType === 'equal') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="tp-script-diff-line">'.$rightRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rightType === 'insert') {
|
||||||
|
if ($useTorchlight) {
|
||||||
|
@endphp
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
<style>
|
||||||
|
.tp-script-diff-line code.torchlight {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endonce
|
||||||
|
@php
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="block tp-script-diff-line bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
@endphp</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="tab === 'before'" x-cloak class="h-[calc(100%-3rem)]">
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Before</div>
|
||||||
|
@php
|
||||||
|
$highlightedBeforeFullscreen = $useTorchlight ? $highlight($policyType, (string) $fromText) : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if (is_string($highlightedBeforeFullscreen) && $highlightedBeforeFullscreen !== '')
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
@endonce
|
||||||
|
|
||||||
|
<div class="mt-2 h-full overflow-auto">{!! $highlightedBeforeFullscreen !!}</div>
|
||||||
|
@else
|
||||||
|
<pre class="mt-2 h-full overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">{{ (string) $fromText }}</pre>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="tab === 'after'" x-cloak class="h-[calc(100%-3rem)]">
|
||||||
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">After</div>
|
||||||
|
@php
|
||||||
|
$highlightedAfterFullscreen = $useTorchlight ? $highlight($policyType, (string) $toText) : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if (is_string($highlightedAfterFullscreen) && $highlightedAfterFullscreen !== '')
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
@endonce
|
||||||
|
|
||||||
|
<div class="mt-2 h-full overflow-auto">{!! $highlightedAfterFullscreen !!}</div>
|
||||||
|
@else
|
||||||
|
<pre class="mt-2 h-full overflow-auto whitespace-pre font-mono text-xs text-gray-800 dark:text-gray-200">{{ (string) $toText }}</pre>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="text-sm text-gray-600 dark:text-gray-300">
|
||||||
|
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">From</span>
|
||||||
|
@if ($isExpandable($from))
|
||||||
|
<details class="mt-1">
|
||||||
|
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
View
|
||||||
|
</summary>
|
||||||
|
<pre class="mt-2 overflow-x-auto text-xs text-gray-800 dark:text-gray-200">{{ $fromText }}</pre>
|
||||||
|
</details>
|
||||||
|
@else
|
||||||
|
<div class="mt-1">{{ $fromText }}</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-600 dark:text-gray-300">
|
||||||
|
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">To</span>
|
||||||
|
@if ($isExpandable($to))
|
||||||
|
<details class="mt-1">
|
||||||
|
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
View
|
||||||
|
</summary>
|
||||||
|
<pre class="mt-2 overflow-x-auto text-xs text-gray-800 dark:text-gray-200">{{ $toText }}</pre>
|
||||||
|
</details>
|
||||||
|
@else
|
||||||
|
<div class="mt-1">{{ $toText }}</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
@php
|
||||||
|
$text = $stringify($value);
|
||||||
|
$isScriptContent = $canHighlightScripts($policyType) && $isScriptKey($name);
|
||||||
|
$highlighted = $isScriptContent ? $highlight($policyType, (string) $text) : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
|
{{ (string) $name }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-700 dark:text-gray-200 sm:max-w-[70%]">
|
||||||
|
@if ($isExpandable($value))
|
||||||
|
<details>
|
||||||
|
<summary class="cursor-pointer text-sm text-gray-700 dark:text-gray-200">
|
||||||
|
View
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
@if (is_string($highlighted) && $highlighted !== '')
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
@endonce
|
||||||
|
|
||||||
|
<div class="mt-2 overflow-x-auto">{!! $highlighted !!}</div>
|
||||||
|
@else
|
||||||
|
<pre class="mt-2 overflow-x-auto text-xs text-gray-800 dark:text-gray-200">{{ $text }}</pre>
|
||||||
|
@endif
|
||||||
|
</details>
|
||||||
|
@else
|
||||||
|
<div class="break-words">{{ $text }}</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</x-filament::section>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
@php
|
||||||
|
$summary = is_array($surface['summary'] ?? null) ? $surface['summary'] : [];
|
||||||
|
$availabilityState = is_string($surface['availabilityState'] ?? null) ? (string) $surface['availabilityState'] : 'available';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div data-shared-zone="summary">
|
||||||
|
<x-filament::section heading="Normalized diff">
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
@if ($availabilityState === 'unavailable')
|
||||||
|
<x-filament::badge color="danger">
|
||||||
|
Unavailable
|
||||||
|
</x-filament::badge>
|
||||||
|
@elseif ($availabilityState === 'partial')
|
||||||
|
<x-filament::badge color="warning">
|
||||||
|
Partial
|
||||||
|
</x-filament::badge>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<x-filament::badge color="success">
|
||||||
|
{{ (int) ($summary['added'] ?? 0) }} added
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="danger">
|
||||||
|
{{ (int) ($summary['removed'] ?? 0) }} removed
|
||||||
|
</x-filament::badge>
|
||||||
|
<x-filament::badge color="warning">
|
||||||
|
{{ (int) ($summary['changed'] ?? 0) }} changed
|
||||||
|
</x-filament::badge>
|
||||||
|
</div>
|
||||||
|
</x-filament::section>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
@php
|
||||||
|
$state = is_array($state ?? null) ? $state : [];
|
||||||
|
|
||||||
|
$surface = array_key_exists('renderExpectations', $state)
|
||||||
|
? $state
|
||||||
|
: \App\Filament\Support\NormalizedDiffSurface::build($state, 'unknown');
|
||||||
|
|
||||||
|
$summary = is_array($surface['summary'] ?? null) ? $surface['summary'] : [];
|
||||||
|
$availabilityState = is_string($surface['availabilityState'] ?? null) ? (string) $surface['availabilityState'] : 'available';
|
||||||
|
$emptyState = is_array($surface['emptyState'] ?? null) ? $surface['emptyState'] : null;
|
||||||
|
$hasChanges = ((int) ($summary['added'] ?? 0) + (int) ($summary['removed'] ?? 0) + (int) ($summary['changed'] ?? 0)) > 0;
|
||||||
|
|
||||||
|
if ($emptyState === null && ! $hasChanges && $availabilityState === 'available') {
|
||||||
|
$message = is_string($summary['message'] ?? null) && trim((string) $summary['message']) !== ''
|
||||||
|
? trim((string) $summary['message'])
|
||||||
|
: 'No normalized changes were found.';
|
||||||
|
|
||||||
|
$emptyState = [
|
||||||
|
'title' => 'No normalized changes',
|
||||||
|
'message' => $message,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="space-y-4"
|
||||||
|
data-shared-detail-family="normalized-diff"
|
||||||
|
data-shared-normalized-diff-host="{{ $surface['hostKind'] ?? 'unknown' }}"
|
||||||
|
data-shared-normalized-diff-state="{{ $availabilityState }}"
|
||||||
|
>
|
||||||
|
@include('filament.infolists.entries.normalized-diff.summary', [
|
||||||
|
'surface' => $surface,
|
||||||
|
])
|
||||||
|
|
||||||
|
@if ($emptyState !== null)
|
||||||
|
@include('filament.infolists.entries.normalized-diff.empty-state', [
|
||||||
|
'emptyState' => $emptyState,
|
||||||
|
'availabilityState' => $availabilityState,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($hasChanges)
|
||||||
|
@include('filament.infolists.entries.normalized-diff.groups', [
|
||||||
|
'surface' => $surface,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@ -1,233 +1,2 @@
|
|||||||
@php
|
{{-- NormalizedSettingsSurface normalized-settings wrapper --}}
|
||||||
$normalized = $getState() ?? [];
|
@include('filament.infolists.entries.normalized-settings.wrapper', ['state' => $getState() ?? []])
|
||||||
$warnings = $normalized['warnings'] ?? [];
|
|
||||||
$settings = $normalized['settings'] ?? [];
|
|
||||||
$settingsTable = $normalized['settings_table'] ?? null;
|
|
||||||
$settingsTableRows = is_array($settingsTable) ? ($settingsTable['rows'] ?? []) : [];
|
|
||||||
$context = $normalized['context'] ?? 'policy';
|
|
||||||
$recordId = $normalized['record_id'] ?? null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="space-y-3">
|
|
||||||
@if (! empty($warnings))
|
|
||||||
<div class="rounded-md border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800">
|
|
||||||
<div class="font-semibold">Warnings</div>
|
|
||||||
<ul class="mt-1 list-disc space-y-1 pl-5">
|
|
||||||
@foreach ($warnings as $warning)
|
|
||||||
<li>{{ $warning }}</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if (empty($settings) && empty($settingsTableRows))
|
|
||||||
<p class="text-sm text-gray-600">No settings available.</p>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if (! empty($settingsTableRows))
|
|
||||||
@php
|
|
||||||
$settingsTableTitle = is_array($settingsTable) ? ($settingsTable['title'] ?? null) : null;
|
|
||||||
$shouldShowTitle = is_string($settingsTableTitle)
|
|
||||||
&& $settingsTableTitle !== ''
|
|
||||||
&& ! ($context === 'policy' && strtolower($settingsTableTitle) === 'settings');
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="space-y-2">
|
|
||||||
@if ($shouldShowTitle)
|
|
||||||
<div class="text-sm font-semibold text-gray-800">{{ $settingsTableTitle }}</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<livewire:settings-catalog-settings-table
|
|
||||||
:settings-rows="$settingsTableRows"
|
|
||||||
:context="$context"
|
|
||||||
:key="$recordId ? ('sc-settings-'.$context.'-'.$recordId) : ('sc-settings-'.$context)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@foreach ($settings as $block)
|
|
||||||
@php
|
|
||||||
$title = $block['title'] ?? 'Settings';
|
|
||||||
$isGeneral = is_string($title) && strtolower($title) === 'general';
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($isGeneral)
|
|
||||||
<x-filament::section
|
|
||||||
:heading="$title"
|
|
||||||
collapsible
|
|
||||||
:collapsed="true"
|
|
||||||
data-block="general"
|
|
||||||
>
|
|
||||||
<x-slot name="headerEnd">
|
|
||||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
|
||||||
{{ count($block['entries'] ?? []) }} fields
|
|
||||||
</span>
|
|
||||||
</x-slot>
|
|
||||||
|
|
||||||
@if (($block['type'] ?? 'keyValue') === 'table')
|
|
||||||
@php
|
|
||||||
$columns = $block['columns'] ?? null;
|
|
||||||
$hasColumns = is_array($columns) && ! empty($columns);
|
|
||||||
$columnMeta = [
|
|
||||||
'definitionId' => ['width' => 'w-[35%]', 'style' => 'width: 35%;', 'cell' => 'font-mono text-xs break-all whitespace-normal', 'cellStyle' => 'word-break: break-all; overflow-wrap: anywhere; white-space: normal;'],
|
|
||||||
'instanceType' => ['width' => 'w-[20%]', 'style' => 'width: 20%;', 'cell' => 'font-mono text-xs break-all whitespace-normal', 'cellStyle' => 'word-break: break-all; overflow-wrap: anywhere; white-space: normal;'],
|
|
||||||
'value' => ['width' => 'w-[25%]', 'style' => 'width: 25%;', 'cell' => 'break-words whitespace-pre-wrap', 'cellStyle' => 'overflow-wrap: anywhere; white-space: pre-wrap;'],
|
|
||||||
'path' => ['width' => 'w-[20%]', 'style' => 'width: 20%;', 'cell' => 'font-mono text-xs break-all whitespace-normal', 'cellStyle' => 'word-break: break-all; overflow-wrap: anywhere; white-space: normal;'],
|
|
||||||
];
|
|
||||||
@endphp
|
|
||||||
<div class="overflow-x-auto rounded-lg border border-gray-200" style="overflow-x: auto;">
|
|
||||||
<table class="min-w-[900px] w-full table-fixed text-left text-sm" style="table-layout: fixed; width: 100%; min-width: 900px;">
|
|
||||||
<thead class="bg-gray-50 text-gray-700">
|
|
||||||
<tr>
|
|
||||||
@if ($hasColumns)
|
|
||||||
@foreach ($columns as $column)
|
|
||||||
@php
|
|
||||||
$key = $column['key'] ?? null;
|
|
||||||
$meta = is_string($key) ? ($columnMeta[$key] ?? []) : [];
|
|
||||||
@endphp
|
|
||||||
<th class="px-3 py-2 {{ $meta['width'] ?? '' }}" style="{{ $meta['style'] ?? '' }}">{{ $column['label'] ?? $column['key'] ?? '-' }}</th>
|
|
||||||
@endforeach
|
|
||||||
@else
|
|
||||||
<th class="px-3 py-2">Path</th>
|
|
||||||
<th class="px-3 py-2">Value</th>
|
|
||||||
@endif
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="divide-y divide-gray-100">
|
|
||||||
@foreach ($block['rows'] ?? [] as $row)
|
|
||||||
<tr>
|
|
||||||
@if ($hasColumns)
|
|
||||||
@foreach ($columns as $column)
|
|
||||||
@php
|
|
||||||
$key = $column['key'] ?? null;
|
|
||||||
$cell = is_string($key) ? ($row[$key] ?? null) : null;
|
|
||||||
$meta = is_string($key) ? ($columnMeta[$key] ?? []) : [];
|
|
||||||
@endphp
|
|
||||||
<td class="px-3 py-2 align-top text-gray-800 {{ $meta['cell'] ?? 'whitespace-pre-wrap' }}" style="{{ $meta['cellStyle'] ?? '' }}">
|
|
||||||
@if (is_array($cell))
|
|
||||||
<pre class="overflow-x-auto text-xs">{{ json_encode($cell, JSON_PRETTY_PRINT) }}</pre>
|
|
||||||
@elseif (is_bool($cell))
|
|
||||||
<span>{{ $cell ? 'true' : 'false' }}</span>
|
|
||||||
@else
|
|
||||||
<span title="{{ is_string($cell) ? $cell : '' }}">{{ $cell ?? '-' }}</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
@endforeach
|
|
||||||
@else
|
|
||||||
<td class="px-3 py-2 align-top">
|
|
||||||
<div class="font-mono text-xs font-medium text-gray-800 break-all whitespace-normal" style="word-break: break-all; overflow-wrap: anywhere; white-space: normal;">{{ $row['path'] ?? '-' }}</div>
|
|
||||||
@if (! empty($row['label']))
|
|
||||||
<div class="text-xs text-gray-600">{{ $row['label'] }}</div>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td class="px-3 py-2 align-top text-gray-800 break-words whitespace-pre-wrap" style="overflow-wrap: anywhere; white-space: pre-wrap;">
|
|
||||||
{{ is_array($row['value'] ?? null) ? json_encode($row['value'], JSON_PRETTY_PRINT) : ($row['value'] ?? '-') }}
|
|
||||||
</td>
|
|
||||||
@endif
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
||||||
@foreach ($block['entries'] ?? [] as $entry)
|
|
||||||
<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4">
|
|
||||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
||||||
{{ $entry['key'] ?? '-' }}
|
|
||||||
</dt>
|
|
||||||
<dd class="mt-1 sm:mt-0 sm:col-span-2">
|
|
||||||
<span class="text-sm text-gray-900 dark:text-white whitespace-pre-wrap break-words">
|
|
||||||
{{ is_array($entry['value'] ?? null) ? json_encode($entry['value'], JSON_PRETTY_PRINT) : ($entry['value'] ?? '-') }}
|
|
||||||
</span>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</x-filament::section>
|
|
||||||
@else
|
|
||||||
<div class="space-y-2 rounded-md border border-gray-200 bg-white p-3 shadow-sm">
|
|
||||||
<div class="text-sm font-semibold text-gray-800">{{ $title }}</div>
|
|
||||||
|
|
||||||
@if (($block['type'] ?? 'keyValue') === 'table')
|
|
||||||
@php
|
|
||||||
$columns = $block['columns'] ?? null;
|
|
||||||
$hasColumns = is_array($columns) && ! empty($columns);
|
|
||||||
$columnMeta = [
|
|
||||||
'definitionId' => ['width' => 'w-[35%]', 'style' => 'width: 35%;', 'cell' => 'font-mono text-xs break-all whitespace-normal', 'cellStyle' => 'word-break: break-all; overflow-wrap: anywhere; white-space: normal;'],
|
|
||||||
'instanceType' => ['width' => 'w-[20%]', 'style' => 'width: 20%;', 'cell' => 'font-mono text-xs break-all whitespace-normal', 'cellStyle' => 'word-break: break-all; overflow-wrap: anywhere; white-space: normal;'],
|
|
||||||
'value' => ['width' => 'w-[25%]', 'style' => 'width: 25%;', 'cell' => 'break-words whitespace-pre-wrap', 'cellStyle' => 'overflow-wrap: anywhere; white-space: pre-wrap;'],
|
|
||||||
'path' => ['width' => 'w-[20%]', 'style' => 'width: 20%;', 'cell' => 'font-mono text-xs break-all whitespace-normal', 'cellStyle' => 'word-break: break-all; overflow-wrap: anywhere; white-space: normal;'],
|
|
||||||
];
|
|
||||||
@endphp
|
|
||||||
<div class="overflow-x-auto rounded-lg border border-gray-200" style="overflow-x: auto;">
|
|
||||||
<table class="min-w-[900px] w-full table-fixed text-left text-sm" style="table-layout: fixed; width: 100%; min-width: 900px;">
|
|
||||||
<thead class="bg-gray-50 text-gray-700">
|
|
||||||
<tr>
|
|
||||||
@if ($hasColumns)
|
|
||||||
@foreach ($columns as $column)
|
|
||||||
@php
|
|
||||||
$key = $column['key'] ?? null;
|
|
||||||
$meta = is_string($key) ? ($columnMeta[$key] ?? []) : [];
|
|
||||||
@endphp
|
|
||||||
<th class="px-3 py-2 {{ $meta['width'] ?? '' }}" style="{{ $meta['style'] ?? '' }}">{{ $column['label'] ?? $column['key'] ?? '-' }}</th>
|
|
||||||
@endforeach
|
|
||||||
@else
|
|
||||||
<th class="px-3 py-2">Path</th>
|
|
||||||
<th class="px-3 py-2">Value</th>
|
|
||||||
@endif
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="divide-y divide-gray-100">
|
|
||||||
@foreach ($block['rows'] ?? [] as $row)
|
|
||||||
<tr>
|
|
||||||
@if ($hasColumns)
|
|
||||||
@foreach ($columns as $column)
|
|
||||||
@php
|
|
||||||
$key = $column['key'] ?? null;
|
|
||||||
$cell = is_string($key) ? ($row[$key] ?? null) : null;
|
|
||||||
$meta = is_string($key) ? ($columnMeta[$key] ?? []) : [];
|
|
||||||
@endphp
|
|
||||||
<td class="px-3 py-2 align-top text-gray-800 {{ $meta['cell'] ?? 'whitespace-pre-wrap' }}" style="{{ $meta['cellStyle'] ?? '' }}">
|
|
||||||
@if (is_array($cell))
|
|
||||||
<pre class="overflow-x-auto text-xs">{{ json_encode($cell, JSON_PRETTY_PRINT) }}</pre>
|
|
||||||
@elseif (is_bool($cell))
|
|
||||||
<span>{{ $cell ? 'true' : 'false' }}</span>
|
|
||||||
@else
|
|
||||||
<span title="{{ is_string($cell) ? $cell : '' }}">{{ $cell ?? '-' }}</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
@endforeach
|
|
||||||
@else
|
|
||||||
<td class="px-3 py-2 align-top">
|
|
||||||
<div class="font-mono text-xs font-medium text-gray-800 break-all whitespace-normal" style="word-break: break-all; overflow-wrap: anywhere; white-space: normal;">{{ $row['path'] ?? '-' }}</div>
|
|
||||||
@if (! empty($row['label']))
|
|
||||||
<div class="text-xs text-gray-600">{{ $row['label'] }}</div>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td class="px-3 py-2 align-top text-gray-800 break-words whitespace-pre-wrap" style="overflow-wrap: anywhere; white-space: pre-wrap;">
|
|
||||||
{{ is_array($row['value'] ?? null) ? json_encode($row['value'], JSON_PRETTY_PRINT) : ($row['value'] ?? '-') }}
|
|
||||||
</td>
|
|
||||||
@endif
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<dl class="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
||||||
@foreach ($block['entries'] ?? [] as $entry)
|
|
||||||
<div class="rounded border border-gray-100 bg-gray-50 p-3">
|
|
||||||
<dt class="text-xs uppercase tracking-wide text-gray-500">{{ $entry['key'] ?? '-' }}</dt>
|
|
||||||
<dd class="whitespace-pre-wrap text-sm text-gray-800">
|
|
||||||
{{ is_array($entry['value'] ?? null) ? json_encode($entry['value'], JSON_PRETTY_PRINT) : ($entry['value'] ?? '-') }}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</dl>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
@php
|
||||||
|
$settingsTable = is_array($settingsTable ?? null) ? $settingsTable : null;
|
||||||
|
$settingsTableRows = is_array($settingsTable['rows'] ?? null) ? $settingsTable['rows'] : [];
|
||||||
|
$context = is_string($context ?? null) && $context !== '' ? $context : 'policy';
|
||||||
|
$recordId = is_scalar($recordId ?? null) ? (string) $recordId : null;
|
||||||
|
$settingsTableTitle = is_string($settingsTable['title'] ?? null) ? $settingsTable['title'] : null;
|
||||||
|
$shouldShowTitle = is_string($settingsTableTitle)
|
||||||
|
&& $settingsTableTitle !== ''
|
||||||
|
&& ! ($context === 'policy' && strtolower($settingsTableTitle) === 'settings');
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="space-y-2" data-shared-zone="settings-table">
|
||||||
|
@if ($shouldShowTitle)
|
||||||
|
<div class="text-sm font-semibold text-gray-800 dark:text-gray-200">{{ $settingsTableTitle }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<livewire:settings-catalog-settings-table
|
||||||
|
:settings-rows="$settingsTableRows"
|
||||||
|
:context="$context"
|
||||||
|
:key="$recordId ? ('sc-settings-'.$context.'-'.$recordId) : ('sc-settings-'.$context)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,273 @@
|
|||||||
|
@php
|
||||||
|
use App\Support\Badges\BadgeCatalog;
|
||||||
|
use App\Support\Badges\BadgeDomain;
|
||||||
|
use App\Support\Badges\BadgeSpec;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
$blocks = is_array($blocks ?? null) ? $blocks : [];
|
||||||
|
$policyType = is_string($policyType ?? null) ? $policyType : null;
|
||||||
|
|
||||||
|
$stringifyValue = function (mixed $value): string {
|
||||||
|
if (is_null($value)) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_bool($value)) {
|
||||||
|
return $value ? 'Enabled' : 'Disabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_scalar($value)) {
|
||||||
|
return (string) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($value)) {
|
||||||
|
$encoded = json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
|
return is_string($encoded) ? $encoded : 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_object($value)) {
|
||||||
|
if (method_exists($value, '__toString')) {
|
||||||
|
return (string) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$encoded = json_encode((array) $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
|
return is_string($encoded) ? $encoded : 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'N/A';
|
||||||
|
};
|
||||||
|
|
||||||
|
$shouldRenderBadges = function (mixed $value): bool {
|
||||||
|
if (! is_array($value) || $value === []) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! array_is_list($value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($value as $item) {
|
||||||
|
if (! is_scalar($item) && ! is_null($item)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$asEnabledDisabledBadgeSpec = function (mixed $value): ?BadgeSpec {
|
||||||
|
$spec = BadgeCatalog::spec(BadgeDomain::BooleanEnabled, $value);
|
||||||
|
|
||||||
|
return $spec->label === 'Unknown' ? null : $spec;
|
||||||
|
};
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="space-y-4" data-shared-zone="blocks">
|
||||||
|
@foreach ($blocks as $block)
|
||||||
|
@php
|
||||||
|
$blockType = is_array($block) ? ($block['type'] ?? null) : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($blockType === 'table')
|
||||||
|
<x-filament::section
|
||||||
|
:heading="$block['title'] ?? 'Settings'"
|
||||||
|
collapsible
|
||||||
|
>
|
||||||
|
<x-slot name="headerEnd">
|
||||||
|
<span class="text-sm text-gray-500 dark:text-gray-400">
|
||||||
|
{{ count($block['rows'] ?? []) }} {{ Str::plural('item', count($block['rows'] ?? [])) }}
|
||||||
|
</span>
|
||||||
|
</x-slot>
|
||||||
|
|
||||||
|
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
@foreach ($block['rows'] ?? [] as $row)
|
||||||
|
<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||||
|
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400 break-words">
|
||||||
|
{{ $row['label'] ?? $row['path'] ?? 'Setting' }}
|
||||||
|
|
||||||
|
@if (! empty($row['path']) && ($row['label'] ?? null) !== ($row['path'] ?? null))
|
||||||
|
<p class="mt-0.5 break-all text-xs font-mono text-gray-400 dark:text-gray-500">
|
||||||
|
{{ (string) $row['path'] }}
|
||||||
|
</p>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if (! empty($row['description']))
|
||||||
|
<p class="mt-0.5 text-xs text-gray-400">{{ Str::limit($row['description'], 80) }}</p>
|
||||||
|
@endif
|
||||||
|
</dt>
|
||||||
|
<dd class="mt-1 sm:col-span-2 sm:mt-0">
|
||||||
|
@php
|
||||||
|
$badgeSpec = $asEnabledDisabledBadgeSpec($row['value'] ?? null);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($badgeSpec)
|
||||||
|
<x-filament::badge :color="$badgeSpec->color" :icon="$badgeSpec->icon" size="sm">
|
||||||
|
{{ $badgeSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
@elseif (is_numeric($row['value'] ?? null))
|
||||||
|
<span class="font-mono text-sm font-semibold text-gray-900 dark:text-white">
|
||||||
|
{{ $row['value'] }}
|
||||||
|
</span>
|
||||||
|
@elseif ($shouldRenderBadges($row['value'] ?? null))
|
||||||
|
<div class="flex flex-wrap gap-1.5">
|
||||||
|
@foreach (($row['value'] ?? []) as $item)
|
||||||
|
@php
|
||||||
|
$itemSpec = $asEnabledDisabledBadgeSpec($item);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($itemSpec)
|
||||||
|
<x-filament::badge :color="$itemSpec->color" :icon="$itemSpec->icon" size="sm">
|
||||||
|
{{ $itemSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
@else
|
||||||
|
<x-filament::badge color="gray" size="sm">
|
||||||
|
{{ is_null($item) ? '—' : (string) $item }}
|
||||||
|
</x-filament::badge>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<span class="break-words text-sm text-gray-900 dark:text-white">
|
||||||
|
{{ Str::limit($stringifyValue($row['value'] ?? null), 200) }}
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</x-filament::section>
|
||||||
|
@elseif ($blockType === 'keyValue')
|
||||||
|
<x-filament::section
|
||||||
|
:heading="$block['title'] ?? 'Settings'"
|
||||||
|
collapsible
|
||||||
|
>
|
||||||
|
<x-slot name="headerEnd">
|
||||||
|
<span class="text-sm text-gray-500 dark:text-gray-400">
|
||||||
|
{{ count($block['entries'] ?? []) }} {{ Str::plural('entry', count($block['entries'] ?? [])) }}
|
||||||
|
</span>
|
||||||
|
</x-slot>
|
||||||
|
|
||||||
|
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
@foreach ($block['entries'] ?? [] as $entry)
|
||||||
|
<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4">
|
||||||
|
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
||||||
|
{{ $entry['key'] ?? 'Setting' }}
|
||||||
|
</dt>
|
||||||
|
<dd class="mt-1 sm:col-span-2 sm:mt-0">
|
||||||
|
@php
|
||||||
|
$rawValue = $entry['value'] ?? null;
|
||||||
|
$isScriptContent = in_array($entry['key'] ?? null, ['scriptContent', 'detectionScriptContent', 'remediationScriptContent'], true)
|
||||||
|
&& (bool) config('tenantpilot.display.show_script_content', false);
|
||||||
|
$badgeSpec = $asEnabledDisabledBadgeSpec($rawValue);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($isScriptContent)
|
||||||
|
@php
|
||||||
|
$code = is_string($rawValue) ? $rawValue : $stringifyValue($rawValue);
|
||||||
|
$firstLine = strtok($code, "\n") ?: '';
|
||||||
|
$grammar = 'powershell';
|
||||||
|
|
||||||
|
if ($policyType === 'deviceShellScript') {
|
||||||
|
$shebang = trim($firstLine);
|
||||||
|
|
||||||
|
if (str_starts_with($shebang, '#!')) {
|
||||||
|
if (str_contains($shebang, 'zsh')) {
|
||||||
|
$grammar = 'zsh';
|
||||||
|
} elseif (str_contains($shebang, 'bash')) {
|
||||||
|
$grammar = 'bash';
|
||||||
|
} else {
|
||||||
|
$grammar = 'sh';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$grammar = 'sh';
|
||||||
|
}
|
||||||
|
} elseif ($policyType === 'deviceManagementScript' || $policyType === 'deviceHealthScript') {
|
||||||
|
$grammar = 'powershell';
|
||||||
|
}
|
||||||
|
|
||||||
|
$highlightedHtml = null;
|
||||||
|
|
||||||
|
if (class_exists(\Torchlight\Engine\Engine::class)) {
|
||||||
|
try {
|
||||||
|
$highlightedHtml = (new \Torchlight\Engine\Engine())->codeToHtml(
|
||||||
|
code: $code,
|
||||||
|
grammar: $grammar,
|
||||||
|
theme: [
|
||||||
|
'light' => 'github-light',
|
||||||
|
'dark' => 'github-dark',
|
||||||
|
],
|
||||||
|
withGutter: false,
|
||||||
|
withWrapper: true,
|
||||||
|
);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$highlightedHtml = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div x-data="{ open: false }" class="space-y-2">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<x-filament::button
|
||||||
|
size="xs"
|
||||||
|
color="gray"
|
||||||
|
type="button"
|
||||||
|
x-on:click="open = !open"
|
||||||
|
>
|
||||||
|
<span x-cloak x-show="!open">Show</span>
|
||||||
|
<span x-cloak x-show="open">Hide</span>
|
||||||
|
</x-filament::button>
|
||||||
|
|
||||||
|
<span class="text-xs text-gray-500 dark:text-gray-400">
|
||||||
|
{{ number_format(Str::length($code)) }} chars
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-cloak x-show="open">
|
||||||
|
@if (is_string($highlightedHtml) && $highlightedHtml !== '')
|
||||||
|
@once
|
||||||
|
@include('filament.partials.torchlight-dark-overrides')
|
||||||
|
@endonce
|
||||||
|
|
||||||
|
<div class="overflow-x-auto">{!! $highlightedHtml !!}</div>
|
||||||
|
@else
|
||||||
|
<pre class="whitespace-pre-wrap break-words text-xs font-mono text-gray-900 dark:text-white">{{ $code }}</pre>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@elseif ($shouldRenderBadges($rawValue))
|
||||||
|
<div class="flex flex-wrap gap-1.5">
|
||||||
|
@foreach (($rawValue ?? []) as $item)
|
||||||
|
@php
|
||||||
|
$itemSpec = $asEnabledDisabledBadgeSpec($item);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($itemSpec)
|
||||||
|
<x-filament::badge :color="$itemSpec->color" :icon="$itemSpec->icon" size="sm">
|
||||||
|
{{ $itemSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
@else
|
||||||
|
<x-filament::badge color="gray" size="sm">
|
||||||
|
{{ is_null($item) ? '—' : (string) $item }}
|
||||||
|
</x-filament::badge>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@elseif ($badgeSpec)
|
||||||
|
<x-filament::badge :color="$badgeSpec->color" :icon="$badgeSpec->icon" size="sm">
|
||||||
|
{{ $badgeSpec->label }}
|
||||||
|
</x-filament::badge>
|
||||||
|
@else
|
||||||
|
<span class="break-words text-sm text-gray-900 dark:text-white">
|
||||||
|
{{ Str::limit($stringifyValue($rawValue), 200) }}
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</x-filament::section>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
@php
|
||||||
|
$state = is_array($state ?? null) ? $state : [];
|
||||||
|
|
||||||
|
$surface = array_key_exists('renderExpectations', $state)
|
||||||
|
? $state
|
||||||
|
: \App\Filament\Support\NormalizedSettingsSurface::build(
|
||||||
|
$state,
|
||||||
|
($state['context'] ?? 'policy') === 'policy' ? 'policy' : 'policy_version'
|
||||||
|
);
|
||||||
|
|
||||||
|
$warnings = is_array($surface['warnings'] ?? null) ? $surface['warnings'] : [];
|
||||||
|
$settingsTable = is_array($surface['settingsTable'] ?? null) ? $surface['settingsTable'] : null;
|
||||||
|
$settingsTableRows = is_array($settingsTable['rows'] ?? null) ? $settingsTable['rows'] : [];
|
||||||
|
$blocks = is_array($surface['blocks'] ?? null) ? $surface['blocks'] : [];
|
||||||
|
$emptyState = is_array($surface['emptyState'] ?? null) ? $surface['emptyState'] : null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="space-y-4"
|
||||||
|
data-shared-detail-family="normalized-settings"
|
||||||
|
data-shared-normalized-settings-host="{{ $surface['hostKind'] ?? 'unknown' }}"
|
||||||
|
data-shared-normalized-settings-variant="{{ $surface['variant'] ?? 'standard_blocks' }}"
|
||||||
|
>
|
||||||
|
@if ($warnings !== [])
|
||||||
|
<div class="rounded-md border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800" data-shared-zone="warnings">
|
||||||
|
<div class="font-semibold">Warnings</div>
|
||||||
|
<ul class="mt-1 list-disc space-y-1 pl-5">
|
||||||
|
@foreach ($warnings as $warning)
|
||||||
|
<li>{{ $warning }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($settingsTableRows !== [])
|
||||||
|
@include('filament.infolists.entries.normalized-settings.catalog-table', [
|
||||||
|
'settingsTable' => $settingsTable,
|
||||||
|
'context' => $surface['context'] ?? 'policy',
|
||||||
|
'recordId' => $surface['recordId'] ?? null,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($blocks !== [])
|
||||||
|
@include('filament.infolists.entries.normalized-settings.standard-blocks', [
|
||||||
|
'blocks' => $blocks,
|
||||||
|
'policyType' => $surface['policyType'] ?? null,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($settingsTableRows === [] && $blocks === [] && $emptyState !== null)
|
||||||
|
<div class="rounded-lg border border-dashed border-gray-300 bg-white px-6 py-8 text-center dark:border-white/15 dark:bg-gray-900/40" data-shared-zone="empty">
|
||||||
|
<p class="text-sm font-medium text-gray-900 dark:text-white">{{ $emptyState['title'] ?? 'No settings available.' }}</p>
|
||||||
|
<p class="mt-1 text-sm text-gray-600 dark:text-gray-300">{{ $emptyState['message'] ?? 'No normalized settings payload is available for this host.' }}</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@ -1,355 +1,2 @@
|
|||||||
@php
|
{{-- NormalizedSettingsSurface policy-settings-standard compatibility wrapper --}}
|
||||||
use App\Support\Badges\BadgeCatalog;
|
@include('filament.infolists.entries.normalized-settings.wrapper', ['state' => $getState() ?? []])
|
||||||
use App\Support\Badges\BadgeDomain;
|
|
||||||
use App\Support\Badges\BadgeSpec;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
// Extract state from Filament ViewEntry
|
|
||||||
$state = $getState();
|
|
||||||
$status = $state['status'] ?? 'success';
|
|
||||||
$warnings = $state['warnings'] ?? [];
|
|
||||||
$settings = $state['settings'] ?? [];
|
|
||||||
$settingsTable = $state['settings_table'] ?? null;
|
|
||||||
|
|
||||||
$policyType = $state['policy_type'] ?? null;
|
|
||||||
|
|
||||||
$stringifyValue = function (mixed $value): string {
|
|
||||||
if (is_null($value)) {
|
|
||||||
return 'N/A';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_bool($value)) {
|
|
||||||
return $value ? 'Enabled' : 'Disabled';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_scalar($value)) {
|
|
||||||
return (string) $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($value)) {
|
|
||||||
$encoded = json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
||||||
|
|
||||||
return is_string($encoded) ? $encoded : 'N/A';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_object($value)) {
|
|
||||||
if (method_exists($value, '__toString')) {
|
|
||||||
return (string) $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$encoded = json_encode((array) $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
||||||
|
|
||||||
return is_string($encoded) ? $encoded : 'N/A';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'N/A';
|
|
||||||
};
|
|
||||||
|
|
||||||
$shouldRenderBadges = function (mixed $value): bool {
|
|
||||||
if (! is_array($value) || $value === []) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! array_is_list($value)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($value as $item) {
|
|
||||||
if (! is_scalar($item) && ! is_null($item)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
$asEnabledDisabledBadgeSpec = function (mixed $value): ?BadgeSpec {
|
|
||||||
$spec = BadgeCatalog::spec(BadgeDomain::BooleanEnabled, $value);
|
|
||||||
|
|
||||||
return $spec->label === 'Unknown' ? null : $spec;
|
|
||||||
};
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
|
||||||
{{-- Warnings --}}
|
|
||||||
@if(!empty($warnings))
|
|
||||||
<x-filament::section>
|
|
||||||
<div class="space-y-2">
|
|
||||||
@foreach($warnings as $warning)
|
|
||||||
<div class="flex items-start gap-2 text-sm text-warning-600 dark:text-warning-400">
|
|
||||||
<svg class="w-5 h-5 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
|
||||||
</svg>
|
|
||||||
<span>{{ $warning }}</span>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
{{-- Settings Table (for Settings Catalog legacy format) --}}
|
|
||||||
@if($settingsTable && !empty($settingsTable['rows']))
|
|
||||||
<x-filament::section
|
|
||||||
:heading="$settingsTable['title'] ?? 'Settings'"
|
|
||||||
:description="$settingsTable['description'] ?? null"
|
|
||||||
>
|
|
||||||
<x-slot name="headerEnd">
|
|
||||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
|
||||||
{{ count($settingsTable['rows']) }} {{ Str::plural('setting', count($settingsTable['rows'])) }}
|
|
||||||
</span>
|
|
||||||
</x-slot>
|
|
||||||
|
|
||||||
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
||||||
@foreach($settingsTable['rows'] as $row)
|
|
||||||
<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4">
|
|
||||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
||||||
{{ $row['definition'] ?? $row['label'] ?? $row['path'] ?? 'Setting' }}
|
|
||||||
</dt>
|
|
||||||
<dd class="mt-1 sm:mt-0 sm:col-span-2">
|
|
||||||
<span class="text-sm text-gray-900 dark:text-white">
|
|
||||||
@php
|
|
||||||
$badgeSpec = $asEnabledDisabledBadgeSpec($row['value'] ?? null);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if($badgeSpec)
|
|
||||||
<x-filament::badge :color="$badgeSpec->color" :icon="$badgeSpec->icon" size="sm">
|
|
||||||
{{ $badgeSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@elseif(is_numeric($row['value']))
|
|
||||||
<span class="font-mono font-semibold">{{ $row['value'] }}</span>
|
|
||||||
@else
|
|
||||||
{{ $row['value'] ?? 'N/A' }}
|
|
||||||
@endif
|
|
||||||
</span>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
{{-- Settings Blocks (for OMA Settings, Key/Value pairs, etc.) --}}
|
|
||||||
@foreach($settings as $block)
|
|
||||||
@php
|
|
||||||
$blockType = is_array($block) ? ($block['type'] ?? null) : null;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if($blockType === 'table')
|
|
||||||
<x-filament::section
|
|
||||||
:heading="$block['title'] ?? 'Settings'"
|
|
||||||
collapsible
|
|
||||||
>
|
|
||||||
<x-slot name="headerEnd">
|
|
||||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
|
||||||
{{ count($block['rows'] ?? []) }} {{ Str::plural('item', count($block['rows'] ?? [])) }}
|
|
||||||
</span>
|
|
||||||
</x-slot>
|
|
||||||
|
|
||||||
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
||||||
@foreach($block['rows'] ?? [] as $row)
|
|
||||||
<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4">
|
|
||||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400 break-words">
|
|
||||||
{{ $row['label'] ?? $row['path'] ?? 'Setting' }}
|
|
||||||
|
|
||||||
@if (! empty($row['path']) && ($row['label'] ?? null) !== ($row['path'] ?? null))
|
|
||||||
<p class="mt-0.5 text-xs font-mono text-gray-400 dark:text-gray-500 break-all">
|
|
||||||
{{ (string) $row['path'] }}
|
|
||||||
</p>
|
|
||||||
@endif
|
|
||||||
@if(!empty($row['description']))
|
|
||||||
<p class="text-xs text-gray-400 mt-0.5">{{ Str::limit($row['description'], 80) }}</p>
|
|
||||||
@endif
|
|
||||||
</dt>
|
|
||||||
<dd class="mt-1 sm:mt-0 sm:col-span-2">
|
|
||||||
@php
|
|
||||||
$badgeSpec = $asEnabledDisabledBadgeSpec($row['value'] ?? null);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if($badgeSpec)
|
|
||||||
<x-filament::badge :color="$badgeSpec->color" :icon="$badgeSpec->icon" size="sm">
|
|
||||||
{{ $badgeSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@elseif(is_numeric($row['value']))
|
|
||||||
<span class="font-mono text-sm font-semibold text-gray-900 dark:text-white">
|
|
||||||
{{ $row['value'] }}
|
|
||||||
</span>
|
|
||||||
@elseif($shouldRenderBadges($row['value'] ?? null))
|
|
||||||
<div class="flex flex-wrap gap-1.5">
|
|
||||||
@foreach(($row['value'] ?? []) as $item)
|
|
||||||
@php
|
|
||||||
$itemSpec = $asEnabledDisabledBadgeSpec($item);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if($itemSpec)
|
|
||||||
<x-filament::badge :color="$itemSpec->color" :icon="$itemSpec->icon" size="sm">
|
|
||||||
{{ $itemSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@else
|
|
||||||
<x-filament::badge color="gray" size="sm">
|
|
||||||
{{ is_null($item) ? '—' : (string) $item }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<span class="text-sm text-gray-900 dark:text-white break-words">
|
|
||||||
{{ Str::limit($stringifyValue($row['value'] ?? null), 200) }}
|
|
||||||
</span>
|
|
||||||
@endif
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
|
|
||||||
@elseif($blockType === 'keyValue')
|
|
||||||
<x-filament::section
|
|
||||||
:heading="$block['title'] ?? 'Settings'"
|
|
||||||
collapsible
|
|
||||||
>
|
|
||||||
<x-slot name="headerEnd">
|
|
||||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
|
||||||
{{ count($block['entries'] ?? []) }} {{ Str::plural('entry', count($block['entries'] ?? [])) }}
|
|
||||||
</span>
|
|
||||||
</x-slot>
|
|
||||||
|
|
||||||
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
||||||
@foreach($block['entries'] ?? [] as $entry)
|
|
||||||
<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4">
|
|
||||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
||||||
{{ $entry['key'] }}
|
|
||||||
</dt>
|
|
||||||
<dd class="mt-1 sm:mt-0 sm:col-span-2">
|
|
||||||
@php
|
|
||||||
$rawValue = $entry['value'] ?? null;
|
|
||||||
|
|
||||||
$isScriptContent = in_array($entry['key'] ?? null, ['scriptContent', 'detectionScriptContent', 'remediationScriptContent'], true)
|
|
||||||
&& (bool) config('tenantpilot.display.show_script_content', false);
|
|
||||||
|
|
||||||
$badgeSpec = $asEnabledDisabledBadgeSpec($rawValue);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if($isScriptContent)
|
|
||||||
@php
|
|
||||||
$code = is_string($rawValue) ? $rawValue : $stringifyValue($rawValue);
|
|
||||||
$firstLine = strtok($code, "\n") ?: '';
|
|
||||||
|
|
||||||
$grammar = 'powershell';
|
|
||||||
|
|
||||||
if ($policyType === 'deviceShellScript') {
|
|
||||||
$shebang = trim($firstLine);
|
|
||||||
|
|
||||||
if (str_starts_with($shebang, '#!')) {
|
|
||||||
if (str_contains($shebang, 'zsh')) {
|
|
||||||
$grammar = 'zsh';
|
|
||||||
} elseif (str_contains($shebang, 'bash')) {
|
|
||||||
$grammar = 'bash';
|
|
||||||
} else {
|
|
||||||
$grammar = 'sh';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$grammar = 'sh';
|
|
||||||
}
|
|
||||||
} elseif ($policyType === 'deviceManagementScript' || $policyType === 'deviceHealthScript') {
|
|
||||||
$grammar = 'powershell';
|
|
||||||
}
|
|
||||||
|
|
||||||
$highlightedHtml = null;
|
|
||||||
|
|
||||||
if (class_exists(\Torchlight\Engine\Engine::class)) {
|
|
||||||
try {
|
|
||||||
$highlightedHtml = (new \Torchlight\Engine\Engine())->codeToHtml(
|
|
||||||
code: $code,
|
|
||||||
grammar: $grammar,
|
|
||||||
theme: [
|
|
||||||
'light' => 'github-light',
|
|
||||||
'dark' => 'github-dark',
|
|
||||||
],
|
|
||||||
withGutter: false,
|
|
||||||
withWrapper: true,
|
|
||||||
);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$highlightedHtml = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<div x-data="{ open: false }" class="space-y-2">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<x-filament::button
|
|
||||||
size="xs"
|
|
||||||
color="gray"
|
|
||||||
type="button"
|
|
||||||
x-on:click="open = !open"
|
|
||||||
>
|
|
||||||
<span x-show="!open" x-cloak>Show</span>
|
|
||||||
<span x-show="open" x-cloak>Hide</span>
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<span class="text-xs text-gray-500 dark:text-gray-400">
|
|
||||||
{{ number_format(Str::length($code)) }} chars
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="open" x-cloak>
|
|
||||||
@if (is_string($highlightedHtml) && $highlightedHtml !== '')
|
|
||||||
@once
|
|
||||||
@include('filament.partials.torchlight-dark-overrides')
|
|
||||||
@endonce
|
|
||||||
|
|
||||||
<div class="overflow-x-auto">{!! $highlightedHtml !!}</div>
|
|
||||||
@else
|
|
||||||
<pre class="text-xs font-mono text-gray-900 dark:text-white whitespace-pre-wrap break-words">{{ $code }}</pre>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@elseif($shouldRenderBadges($rawValue))
|
|
||||||
<div class="flex flex-wrap gap-1.5">
|
|
||||||
@foreach(($rawValue ?? []) as $item)
|
|
||||||
@php
|
|
||||||
$itemSpec = $asEnabledDisabledBadgeSpec($item);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if($itemSpec)
|
|
||||||
<x-filament::badge :color="$itemSpec->color" :icon="$itemSpec->icon" size="sm">
|
|
||||||
{{ $itemSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@else
|
|
||||||
<x-filament::badge color="gray" size="sm">
|
|
||||||
{{ is_null($item) ? '—' : (string) $item }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@elseif($badgeSpec)
|
|
||||||
<x-filament::badge :color="$badgeSpec->color" :icon="$badgeSpec->icon" size="sm">
|
|
||||||
{{ $badgeSpec->label }}
|
|
||||||
</x-filament::badge>
|
|
||||||
@else
|
|
||||||
<span class="text-sm text-gray-900 dark:text-white break-words">
|
|
||||||
{{ Str::limit($stringifyValue($rawValue), 200) }}
|
|
||||||
</span>
|
|
||||||
@endif
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
{{-- Empty state --}}
|
|
||||||
@if(empty($settings) && (!$settingsTable || empty($settingsTable['rows'])))
|
|
||||||
<div class="text-center py-12">
|
|
||||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
||||||
</svg>
|
|
||||||
<p class="mt-4 text-sm text-gray-500 dark:text-gray-400">
|
|
||||||
No settings data available
|
|
||||||
</p>
|
|
||||||
<p class="mt-1 text-xs text-gray-400 dark:text-gray-500">
|
|
||||||
This policy may not contain settings, or they are in an unsupported format
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|||||||
@ -94,8 +94,7 @@
|
|||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
@include('filament.components.verification-report-viewer', [
|
@include('filament.components.verification-report-viewer', [
|
||||||
'run' => $runData,
|
'surface' => $surface ?? [],
|
||||||
'report' => $report,
|
|
||||||
'redactionNotes' => $redactionNotes ?? [],
|
'redactionNotes' => $redactionNotes ?? [],
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@
|
|||||||
'display_name' => 'My Policy 123',
|
'display_name' => 'My Policy 123',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->get(FindingResource::getUrl('view', ['record' => $finding], tenant: $tenant))
|
->get(FindingResource::getUrl('view', ['record' => $finding], tenant: $tenant))
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertSee('Normalized diff')
|
->assertSee('Normalized diff')
|
||||||
@ -96,4 +96,10 @@
|
|||||||
->assertSee('To')
|
->assertSee('To')
|
||||||
->assertSee('Old value')
|
->assertSee('Old value')
|
||||||
->assertSee('New value');
|
->assertSee('New value');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="finding"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="groups"');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->get(route('filament.tenant.resources.findings.view', array_merge(
|
->get(route('filament.tenant.resources.findings.view', array_merge(
|
||||||
filamentTenantRouteParams($tenant),
|
filamentTenantRouteParams($tenant),
|
||||||
['record' => $finding],
|
['record' => $finding],
|
||||||
@ -45,6 +45,11 @@
|
|||||||
->assertOk()
|
->assertOk()
|
||||||
->assertSee('Diff unavailable')
|
->assertSee('Diff unavailable')
|
||||||
->assertDontSee('No normalized changes were found');
|
->assertDontSee('No normalized changes were found');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="finding"')
|
||||||
|
->toContain('data-shared-normalized-diff-state="unavailable"');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders a diff against an empty baseline for unexpected_policy findings with a current policy version reference', function (): void {
|
it('renders a diff against an empty baseline for unexpected_policy findings with a current policy version reference', function (): void {
|
||||||
@ -101,7 +106,7 @@
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->get(route('filament.tenant.resources.findings.view', array_merge(
|
->get(route('filament.tenant.resources.findings.view', array_merge(
|
||||||
filamentTenantRouteParams($tenant),
|
filamentTenantRouteParams($tenant),
|
||||||
['record' => $finding],
|
['record' => $finding],
|
||||||
@ -110,6 +115,11 @@
|
|||||||
->assertDontSee('Diff unavailable')
|
->assertDontSee('Diff unavailable')
|
||||||
->assertSee('1 added')
|
->assertSee('1 added')
|
||||||
->assertSee('Password required');
|
->assertSee('Password required');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="finding"')
|
||||||
|
->toContain('data-shared-normalized-diff-state="available"');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders a diff against an empty current side for missing_policy findings with a baseline policy version reference', function (): void {
|
it('renders a diff against an empty current side for missing_policy findings with a baseline policy version reference', function (): void {
|
||||||
@ -166,7 +176,7 @@
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->get(route('filament.tenant.resources.findings.view', array_merge(
|
->get(route('filament.tenant.resources.findings.view', array_merge(
|
||||||
filamentTenantRouteParams($tenant),
|
filamentTenantRouteParams($tenant),
|
||||||
['record' => $finding],
|
['record' => $finding],
|
||||||
@ -175,4 +185,9 @@
|
|||||||
->assertDontSee('Diff unavailable')
|
->assertDontSee('Diff unavailable')
|
||||||
->assertSee('1 removed')
|
->assertSee('1 removed')
|
||||||
->assertSee('Password required');
|
->assertSee('Password required');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="finding"')
|
||||||
|
->toContain('data-shared-normalized-diff-state="available"');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Filament\Resources\PolicyVersionResource;
|
||||||
|
use App\Models\Policy;
|
||||||
|
use App\Models\PolicyVersion;
|
||||||
|
use App\Models\Tenant;
|
||||||
use App\Services\Intune\PolicyNormalizer;
|
use App\Services\Intune\PolicyNormalizer;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
test('group policy configuration normalized diff keys use definition display names', function () {
|
test('group policy configuration normalized diff keys use definition display names', function () {
|
||||||
$flat = app(PolicyNormalizer::class)->flattenForDiff(
|
$flat = app(PolicyNormalizer::class)->flattenForDiff(
|
||||||
@ -27,3 +35,77 @@
|
|||||||
expect($keys)->toContain('Administrative Template settings > Windows Components\\Security Options > Block legacy auth (def-1)');
|
expect($keys)->toContain('Administrative Template settings > Windows Components\\Security Options > Block legacy auth (def-1)');
|
||||||
expect(implode("\n", $keys))->not->toContain('graph.microsoft.com');
|
expect(implode("\n", $keys))->not->toContain('graph.microsoft.com');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('group policy configuration policy-version detail renders the shared normalized diff family', function () {
|
||||||
|
$tenant = Tenant::factory()->create([
|
||||||
|
'status' => 'active',
|
||||||
|
]);
|
||||||
|
|
||||||
|
[$user, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner');
|
||||||
|
|
||||||
|
$policy = Policy::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'external_id' => 'gpo-policy-1',
|
||||||
|
'policy_type' => 'groupPolicyConfiguration',
|
||||||
|
'display_name' => 'Admin Templates Alpha',
|
||||||
|
'platform' => 'windows',
|
||||||
|
]);
|
||||||
|
|
||||||
|
PolicyVersion::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'policy_id' => (int) $policy->getKey(),
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now()->subMinute(),
|
||||||
|
'snapshot' => [
|
||||||
|
'id' => 'gpo-1',
|
||||||
|
'displayName' => 'Admin Templates Alpha',
|
||||||
|
'@odata.type' => '#microsoft.graph.groupPolicyConfiguration',
|
||||||
|
'definitionValues' => [
|
||||||
|
[
|
||||||
|
'enabled' => false,
|
||||||
|
'definition@odata.bind' => 'https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions(\'def-1\')',
|
||||||
|
'#Definition_Id' => 'def-1',
|
||||||
|
'#Definition_displayName' => 'Block legacy auth',
|
||||||
|
'#Definition_categoryPath' => 'Windows Components\\Security Options',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$version = PolicyVersion::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'policy_id' => (int) $policy->getKey(),
|
||||||
|
'version_number' => 2,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'id' => 'gpo-1',
|
||||||
|
'displayName' => 'Admin Templates Alpha',
|
||||||
|
'@odata.type' => '#microsoft.graph.groupPolicyConfiguration',
|
||||||
|
'definitionValues' => [
|
||||||
|
[
|
||||||
|
'enabled' => true,
|
||||||
|
'definition@odata.bind' => 'https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions(\'def-1\')',
|
||||||
|
'#Definition_Id' => 'def-1',
|
||||||
|
'#Definition_displayName' => 'Block legacy auth',
|
||||||
|
'#Definition_categoryPath' => 'Windows Components\\Security Options',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->get(PolicyVersionResource::getUrl('view', ['record' => $version], tenant: $tenant));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Block legacy auth');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="policy_version"')
|
||||||
|
->toContain('data-shared-zone="groups"');
|
||||||
|
});
|
||||||
|
|||||||
@ -0,0 +1,172 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use App\Filament\Resources\FindingResource;
|
||||||
|
use App\Filament\Resources\PolicyResource;
|
||||||
|
use App\Filament\Resources\PolicyVersionResource;
|
||||||
|
use App\Models\Finding;
|
||||||
|
use App\Models\InventoryItem;
|
||||||
|
use App\Models\Policy;
|
||||||
|
use App\Models\PolicyVersion;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
|
it('renders shared normalized settings and diff families on policy and policy-version detail hosts', function (): void {
|
||||||
|
$tenant = \App\Models\Tenant::factory()->create([
|
||||||
|
'name' => 'Tenant One',
|
||||||
|
'status' => 'active',
|
||||||
|
]);
|
||||||
|
|
||||||
|
[$user, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner');
|
||||||
|
|
||||||
|
$policy = Policy::factory()->create([
|
||||||
|
'tenant_id' => $tenant->getKey(),
|
||||||
|
'external_id' => 'policy-1',
|
||||||
|
'policy_type' => 'deviceConfiguration',
|
||||||
|
'display_name' => 'Policy A',
|
||||||
|
'platform' => 'windows',
|
||||||
|
]);
|
||||||
|
|
||||||
|
PolicyVersion::factory()->create([
|
||||||
|
'tenant_id' => $tenant->getKey(),
|
||||||
|
'policy_id' => $policy->getKey(),
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now()->subMinute(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'Policy A',
|
||||||
|
'settings' => [
|
||||||
|
['displayName' => 'Enable feature', 'value' => ['value' => 'off']],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$version = PolicyVersion::factory()->create([
|
||||||
|
'tenant_id' => $tenant->getKey(),
|
||||||
|
'policy_id' => $policy->getKey(),
|
||||||
|
'version_number' => 2,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'Policy A',
|
||||||
|
'settings' => [
|
||||||
|
['displayName' => 'Enable feature', 'value' => ['value' => 'on']],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$policyResponse = $this->actingAs($user)
|
||||||
|
->get(PolicyResource::getUrl('view', ['record' => $policy], tenant: $tenant));
|
||||||
|
|
||||||
|
$policyResponse->assertSuccessful()->assertSee('Enable feature');
|
||||||
|
|
||||||
|
expect($policyResponse->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy"');
|
||||||
|
|
||||||
|
$versionResponse = $this->actingAs($user)
|
||||||
|
->get(PolicyVersionResource::getUrl('view', ['record' => $version], tenant: $tenant));
|
||||||
|
|
||||||
|
$versionResponse->assertSuccessful()->assertSee('Normalized diff');
|
||||||
|
|
||||||
|
expect($versionResponse->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy_version"')
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="policy_version"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the shared normalized diff family on finding detail hosts', function (): void {
|
||||||
|
bindFailHardGraphClient();
|
||||||
|
|
||||||
|
[$user, $tenant] = createUserWithTenant(role: 'manager');
|
||||||
|
|
||||||
|
$baseline = createInventorySyncOperationRun($tenant, [
|
||||||
|
'selection_hash' => hash('sha256', 'shared-detail-contract'),
|
||||||
|
'status' => 'success',
|
||||||
|
'finished_at' => now()->subDays(2),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$current = createInventorySyncOperationRun($tenant, [
|
||||||
|
'selection_hash' => $baseline->selection_hash,
|
||||||
|
'status' => 'success',
|
||||||
|
'finished_at' => now()->subDay(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$policy = Policy::factory()->for($tenant)->create([
|
||||||
|
'external_id' => 'policy-123',
|
||||||
|
'policy_type' => 'deviceConfiguration',
|
||||||
|
'platform' => 'windows10',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$baselineVersion = PolicyVersion::factory()->for($tenant)->create([
|
||||||
|
'policy_id' => $policy->getKey(),
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'captured_at' => $baseline->finished_at->copy()->subHour(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'My Policy',
|
||||||
|
'customSettingFoo' => 'Old value',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$currentVersion = PolicyVersion::factory()->for($tenant)->create([
|
||||||
|
'policy_id' => $policy->getKey(),
|
||||||
|
'version_number' => 2,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'captured_at' => $current->finished_at->copy()->subHour(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'My Policy',
|
||||||
|
'customSettingFoo' => 'New value',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$finding = Finding::factory()->for($tenant)->create([
|
||||||
|
'finding_type' => Finding::FINDING_TYPE_DRIFT,
|
||||||
|
'scope_key' => (string) $current->selection_hash,
|
||||||
|
'baseline_operation_run_id' => $baseline->getKey(),
|
||||||
|
'current_operation_run_id' => $current->getKey(),
|
||||||
|
'subject_type' => 'policy',
|
||||||
|
'subject_external_id' => $policy->external_id,
|
||||||
|
'evidence_jsonb' => [
|
||||||
|
'change_type' => 'modified',
|
||||||
|
'summary' => [
|
||||||
|
'kind' => 'policy_snapshot',
|
||||||
|
'changed_fields' => ['snapshot_hash'],
|
||||||
|
],
|
||||||
|
'baseline' => [
|
||||||
|
'policy_id' => $policy->external_id,
|
||||||
|
'policy_version_id' => $baselineVersion->getKey(),
|
||||||
|
'snapshot_hash' => 'baseline-hash',
|
||||||
|
],
|
||||||
|
'current' => [
|
||||||
|
'policy_id' => $policy->external_id,
|
||||||
|
'policy_version_id' => $currentVersion->getKey(),
|
||||||
|
'snapshot_hash' => 'current-hash',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
InventoryItem::factory()->for($tenant)->create([
|
||||||
|
'external_id' => $finding->subject_external_id,
|
||||||
|
'display_name' => 'My Policy 123',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->get(FindingResource::getUrl('view', ['record' => $finding], tenant: $tenant));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Normalized diff');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="finding"');
|
||||||
|
});
|
||||||
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
use App\Filament\Resources\PolicyResource\Pages\ListPolicies;
|
use App\Filament\Resources\PolicyResource\Pages\ListPolicies;
|
||||||
use App\Models\Policy;
|
use App\Models\Policy;
|
||||||
|
use App\Models\PolicyVersion;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\Support\Workspaces\WorkspaceContext;
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
@ -35,3 +37,68 @@
|
|||||||
->assertCanSeeTableRecords([$policyA])
|
->assertCanSeeTableRecords([$policyA])
|
||||||
->assertCanNotSeeTableRecords([$policyB]);
|
->assertCanNotSeeTableRecords([$policyB]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders remembered canonical tenant policy detail with shared normalized settings markers', function (): void {
|
||||||
|
$tenantA = Tenant::factory()->create();
|
||||||
|
[$user, $tenantA] = createUserWithTenant(tenant: $tenantA, role: 'owner');
|
||||||
|
$tenantB = Tenant::factory()->create(['workspace_id' => (int) $tenantA->workspace_id]);
|
||||||
|
createUserWithTenant(tenant: $tenantB, user: $user, role: 'owner');
|
||||||
|
|
||||||
|
$policyA = Policy::factory()->for($tenantA)->create(['display_name' => 'Remembered tenant policy']);
|
||||||
|
$policyB = Policy::factory()->for($tenantB)->create(['display_name' => 'Other tenant policy']);
|
||||||
|
|
||||||
|
PolicyVersion::factory()->for($tenantA)->for($policyA)->create([
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policyA->policy_type,
|
||||||
|
'platform' => $policyA->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'@odata.type' => '#microsoft.graph.windows10CustomConfiguration',
|
||||||
|
'omaSettings' => [
|
||||||
|
[
|
||||||
|
'displayName' => 'Setting A',
|
||||||
|
'omaUri' => './Vendor/MSFT/SettingA',
|
||||||
|
'value' => 'Enabled',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
PolicyVersion::factory()->for($tenantB)->for($policyB)->create([
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policyB->policy_type,
|
||||||
|
'platform' => $policyB->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'@odata.type' => '#microsoft.graph.windows10CustomConfiguration',
|
||||||
|
'omaSettings' => [],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($user);
|
||||||
|
Filament::setCurrentPanel('admin');
|
||||||
|
Filament::setTenant(null, true);
|
||||||
|
Filament::bootCurrentPanel();
|
||||||
|
|
||||||
|
$session = [
|
||||||
|
WorkspaceContext::SESSION_KEY => (int) $tenantA->workspace_id,
|
||||||
|
WorkspaceContext::LAST_TENANT_IDS_SESSION_KEY => [
|
||||||
|
(string) $tenantA->workspace_id => (int) $tenantA->getKey(),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withSession($session)
|
||||||
|
->get(\App\Filament\Resources\PolicyResource::getUrl('view', ['record' => $policyA], panel: 'admin'));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Setting A');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy"');
|
||||||
|
|
||||||
|
$this->withSession($session)
|
||||||
|
->get(\App\Filament\Resources\PolicyResource::getUrl('view', ['record' => $policyB], panel: 'admin'))
|
||||||
|
->assertNotFound();
|
||||||
|
});
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
use App\Models\PolicyVersion;
|
use App\Models\PolicyVersion;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\Support\Workspaces\WorkspaceContext;
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
@ -73,3 +74,78 @@
|
|||||||
->get(PolicyVersionResource::getUrl('view', ['record' => $versionB], panel: 'admin'))
|
->get(PolicyVersionResource::getUrl('view', ['record' => $versionB], panel: 'admin'))
|
||||||
->assertNotFound();
|
->assertNotFound();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders remembered canonical tenant policy-version detail with shared normalized detail markers', function (): void {
|
||||||
|
$tenantA = Tenant::factory()->create();
|
||||||
|
[$user, $tenantA] = createUserWithTenant(tenant: $tenantA, role: 'owner');
|
||||||
|
$tenantB = Tenant::factory()->create(['workspace_id' => (int) $tenantA->workspace_id]);
|
||||||
|
createUserWithTenant(tenant: $tenantB, user: $user, role: 'owner');
|
||||||
|
|
||||||
|
$policyA = Policy::factory()->for($tenantA)->create(['display_name' => 'Remembered policy']);
|
||||||
|
$policyB = Policy::factory()->for($tenantB)->create(['display_name' => 'Other policy']);
|
||||||
|
|
||||||
|
PolicyVersion::factory()->for($tenantA)->for($policyA)->create([
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policyA->policy_type,
|
||||||
|
'platform' => $policyA->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now()->subMinute(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'Remembered policy',
|
||||||
|
'settings' => [
|
||||||
|
['displayName' => 'Enable feature', 'value' => ['value' => 'off']],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$versionA = PolicyVersion::factory()->for($tenantA)->for($policyA)->create([
|
||||||
|
'version_number' => 2,
|
||||||
|
'policy_type' => $policyA->policy_type,
|
||||||
|
'platform' => $policyA->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'Remembered policy',
|
||||||
|
'settings' => [
|
||||||
|
['displayName' => 'Enable feature', 'value' => ['value' => 'on']],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
PolicyVersion::factory()->for($tenantB)->for($policyB)->create([
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policyB->policy_type,
|
||||||
|
'platform' => $policyB->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'Other policy',
|
||||||
|
'settings' => [
|
||||||
|
['displayName' => 'Enable feature', 'value' => ['value' => 'off']],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($user);
|
||||||
|
Filament::setCurrentPanel('admin');
|
||||||
|
Filament::setTenant(null, true);
|
||||||
|
Filament::bootCurrentPanel();
|
||||||
|
|
||||||
|
$session = [
|
||||||
|
WorkspaceContext::SESSION_KEY => (int) $tenantA->workspace_id,
|
||||||
|
WorkspaceContext::LAST_TENANT_IDS_SESSION_KEY => [
|
||||||
|
(string) $tenantA->workspace_id => (int) $tenantA->getKey(),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withSession($session)
|
||||||
|
->get(PolicyVersionResource::getUrl('view', ['record' => $versionA], panel: 'admin'));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Enable feature');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy_version"')
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="policy_version"');
|
||||||
|
});
|
||||||
|
|||||||
@ -50,6 +50,12 @@
|
|||||||
$response->assertSee('Normalized settings');
|
$response->assertSee('Normalized settings');
|
||||||
$response->assertSee('Enable feature');
|
$response->assertSee('Enable feature');
|
||||||
$response->assertSee('Normalized diff');
|
$response->assertSee('Normalized diff');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy_version"')
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="policy_version"');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('policy version detail shows enrollment notification template settings', function () {
|
test('policy version detail shows enrollment notification template settings', function () {
|
||||||
@ -139,4 +145,8 @@
|
|||||||
$response->assertSee('Push Subject');
|
$response->assertSee('Push Subject');
|
||||||
$response->assertSee('Push (en-us) Message');
|
$response->assertSee('Push (en-us) Message');
|
||||||
$response->assertSee('Push Body');
|
$response->assertSee('Push Body');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy_version"');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Filament\Resources\PolicyVersionResource;
|
||||||
|
use App\Models\Policy;
|
||||||
|
use App\Models\PolicyVersion;
|
||||||
use App\Models\SettingsCatalogCategory;
|
use App\Models\SettingsCatalogCategory;
|
||||||
use App\Models\SettingsCatalogDefinition;
|
use App\Models\SettingsCatalogDefinition;
|
||||||
|
use App\Models\Tenant;
|
||||||
use App\Services\Intune\PolicyNormalizer;
|
use App\Services\Intune\PolicyNormalizer;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
uses(RefreshDatabase::class);
|
uses(RefreshDatabase::class);
|
||||||
@ -53,3 +58,69 @@
|
|||||||
expect($keys)->toContain('Settings > Account Management > Deletion Policy');
|
expect($keys)->toContain('Settings > Account Management > Deletion Policy');
|
||||||
expect(implode("\n", $keys))->not->toContain('device_vendor_msft_accountmanagement_userprofilemanagement_deletionpolicy');
|
expect(implode("\n", $keys))->not->toContain('device_vendor_msft_accountmanagement_userprofilemanagement_deletionpolicy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('settings catalog policy version detail renders the shared normalized settings family', function () {
|
||||||
|
SettingsCatalogCategory::create([
|
||||||
|
'category_id' => 'cat-1',
|
||||||
|
'display_name' => 'Account Management',
|
||||||
|
'description' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
SettingsCatalogDefinition::create([
|
||||||
|
'definition_id' => 'device_vendor_msft_accountmanagement_userprofilemanagement_deletionpolicy',
|
||||||
|
'display_name' => 'Deletion Policy',
|
||||||
|
'description' => null,
|
||||||
|
'help_text' => null,
|
||||||
|
'category_id' => 'cat-1',
|
||||||
|
'ux_behavior' => null,
|
||||||
|
'raw' => [],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$tenant = Tenant::factory()->create([
|
||||||
|
'status' => 'active',
|
||||||
|
]);
|
||||||
|
|
||||||
|
[$user, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner');
|
||||||
|
|
||||||
|
$policy = Policy::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'external_id' => 'settings-catalog-policy-1',
|
||||||
|
'policy_type' => 'settingsCatalogPolicy',
|
||||||
|
'display_name' => 'Settings Catalog Policy',
|
||||||
|
'platform' => 'windows',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$version = PolicyVersion::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'policy_id' => (int) $policy->getKey(),
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'created_by' => 'tester@example.com',
|
||||||
|
'captured_at' => CarbonImmutable::now(),
|
||||||
|
'snapshot' => [
|
||||||
|
'@odata.type' => '#microsoft.graph.deviceManagementConfigurationPolicy',
|
||||||
|
'settings' => [
|
||||||
|
[
|
||||||
|
'id' => 's1',
|
||||||
|
'settingInstance' => [
|
||||||
|
'@odata.type' => '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance',
|
||||||
|
'settingDefinitionId' => 'device_vendor_msft_accountmanagement_userprofilemanagement_deletionpolicy',
|
||||||
|
'choiceSettingValue' => [
|
||||||
|
'value' => 'enabled',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->get(PolicyVersionResource::getUrl('view', ['record' => $version], tenant: $tenant));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Deletion Policy');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-settings"')
|
||||||
|
->toContain('data-shared-normalized-settings-host="policy_version"');
|
||||||
|
});
|
||||||
|
|||||||
@ -0,0 +1,188 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use App\Filament\Widgets\Tenant\TenantVerificationReport;
|
||||||
|
use App\Models\OperationRun;
|
||||||
|
use App\Models\ProviderConnection;
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Models\TenantOnboardingSession;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Workspace;
|
||||||
|
use App\Models\WorkspaceMembership;
|
||||||
|
use App\Support\Verification\VerificationReportWriter;
|
||||||
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
|
it('renders the shared verification family on central operation detail', function (): void {
|
||||||
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
||||||
|
|
||||||
|
$report = VerificationReportWriter::build('provider.connection.check', [
|
||||||
|
[
|
||||||
|
'key' => 'provider_connection',
|
||||||
|
'title' => 'Provider connection preflight',
|
||||||
|
'status' => 'fail',
|
||||||
|
'severity' => 'critical',
|
||||||
|
'blocking' => true,
|
||||||
|
'reason_code' => 'provider_connection_missing',
|
||||||
|
'message' => 'No provider connection configured.',
|
||||||
|
'evidence' => [],
|
||||||
|
'next_steps' => [],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$run = OperationRun::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'workspace_id' => (int) $tenant->workspace_id,
|
||||||
|
'user_id' => (int) $user->getKey(),
|
||||||
|
'type' => 'provider.connection.check',
|
||||||
|
'status' => 'completed',
|
||||||
|
'outcome' => 'blocked',
|
||||||
|
'context' => [
|
||||||
|
'verification_report' => $report,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
Filament::setTenant(null, true);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
||||||
|
->get(route('admin.operations.view', ['run' => (int) $run->getKey()]));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Verification report');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="operation_run_detail"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the shared verification family on onboarding verification', function (): void {
|
||||||
|
$workspace = Workspace::factory()->create();
|
||||||
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
WorkspaceMembership::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'user_id' => (int) $user->getKey(),
|
||||||
|
'role' => 'owner',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$tenant = Tenant::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'status' => Tenant::STATUS_ONBOARDING,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->tenants()->syncWithoutDetaching([
|
||||||
|
$tenant->getKey() => ['role' => 'owner'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$connection = ProviderConnection::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'is_default' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report = VerificationReportWriter::build('provider.connection.check', [
|
||||||
|
[
|
||||||
|
'key' => 'onboarding_permissions',
|
||||||
|
'title' => 'Graph permissions',
|
||||||
|
'status' => 'fail',
|
||||||
|
'severity' => 'high',
|
||||||
|
'blocking' => false,
|
||||||
|
'reason_code' => 'permission_denied',
|
||||||
|
'message' => 'Missing required Graph permissions.',
|
||||||
|
'evidence' => [],
|
||||||
|
'next_steps' => [],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$run = OperationRun::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'type' => 'provider.connection.check',
|
||||||
|
'status' => 'completed',
|
||||||
|
'outcome' => 'blocked',
|
||||||
|
'context' => [
|
||||||
|
'provider_connection_id' => (int) $connection->getKey(),
|
||||||
|
'verification_report' => $report,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
TenantOnboardingSession::query()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'entra_tenant_id' => (string) $tenant->tenant_id,
|
||||||
|
'current_step' => 'verify',
|
||||||
|
'state' => [
|
||||||
|
'provider_connection_id' => (int) $connection->getKey(),
|
||||||
|
'verification_operation_run_id' => (int) $run->getKey(),
|
||||||
|
],
|
||||||
|
'started_by_user_id' => (int) $user->getKey(),
|
||||||
|
'updated_by_user_id' => (int) $user->getKey(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $workspace->getKey()])
|
||||||
|
->followingRedirects()
|
||||||
|
->get('/admin/onboarding');
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Graph permissions');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="onboarding_wizard"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the shared verification family on the tenant widget host', function (): void {
|
||||||
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
||||||
|
|
||||||
|
Filament::setTenant($tenant, true);
|
||||||
|
|
||||||
|
$report = VerificationReportWriter::build('provider.connection.check', [
|
||||||
|
[
|
||||||
|
'key' => 'tenant_widget_report',
|
||||||
|
'title' => 'Tenant widget verification',
|
||||||
|
'status' => 'fail',
|
||||||
|
'severity' => 'high',
|
||||||
|
'blocking' => false,
|
||||||
|
'reason_code' => 'provider_permission_denied',
|
||||||
|
'message' => 'Insufficient permission — ask a tenant Owner.',
|
||||||
|
'evidence' => [],
|
||||||
|
'next_steps' => [],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
OperationRun::factory()->create([
|
||||||
|
'workspace_id' => (int) $tenant->workspace_id,
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'type' => 'provider.connection.check',
|
||||||
|
'status' => 'completed',
|
||||||
|
'outcome' => 'blocked',
|
||||||
|
'context' => [
|
||||||
|
'target_scope' => [
|
||||||
|
'entra_tenant_id' => (string) $tenant->tenant_id,
|
||||||
|
],
|
||||||
|
'verification_report' => $report,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$component = Livewire::actingAs($user)
|
||||||
|
->test(TenantVerificationReport::class, ['record' => $tenant])
|
||||||
|
->assertSee('Tenant widget verification');
|
||||||
|
|
||||||
|
expect($component->html())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="tenant_widget"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
|
});
|
||||||
@ -108,7 +108,7 @@
|
|||||||
bindFailHardGraphClient();
|
bindFailHardGraphClient();
|
||||||
|
|
||||||
assertNoOutboundHttp(function () use ($user): void {
|
assertNoOutboundHttp(function () use ($user): void {
|
||||||
Livewire::actingAs($user)
|
$component = Livewire::actingAs($user)
|
||||||
->test(TenantVerificationReport::class)
|
->test(TenantVerificationReport::class)
|
||||||
->assertSee('Provider connection preflight')
|
->assertSee('Provider connection preflight')
|
||||||
->assertSee(OperationRunLinks::openLabel())
|
->assertSee(OperationRunLinks::openLabel())
|
||||||
@ -116,6 +116,13 @@
|
|||||||
->assertSee(OperationRunLinks::identifierLabel().':')
|
->assertSee(OperationRunLinks::identifierLabel().':')
|
||||||
->assertSee('Read-only:')
|
->assertSee('Read-only:')
|
||||||
->assertSee('Insufficient permission — ask a tenant Owner.');
|
->assertSee('Insufficient permission — ask a tenant Owner.');
|
||||||
|
|
||||||
|
expect($component->html())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="tenant_widget"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
use App\Filament\Resources\FindingResource;
|
use App\Filament\Resources\FindingResource;
|
||||||
use App\Filament\Resources\FindingResource\Pages\ListFindings;
|
use App\Filament\Resources\FindingResource\Pages\ListFindings;
|
||||||
use App\Models\Finding;
|
use App\Models\Finding;
|
||||||
|
use App\Models\InventoryItem;
|
||||||
|
use App\Models\Policy;
|
||||||
|
use App\Models\PolicyVersion;
|
||||||
use App\Services\Findings\FindingWorkflowService;
|
use App\Services\Findings\FindingWorkflowService;
|
||||||
use App\Support\Workspaces\WorkspaceContext;
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@ -116,3 +119,89 @@
|
|||||||
expect($exception->status())->toBe(404);
|
expect($exception->status())->toBe(404);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders finding detail with shared normalized diff markers for entitled members', function (): void {
|
||||||
|
bindFailHardGraphClient();
|
||||||
|
|
||||||
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
||||||
|
|
||||||
|
$baseline = createInventorySyncOperationRun($tenant, [
|
||||||
|
'selection_hash' => hash('sha256', 'finding-rbac-shared-diff'),
|
||||||
|
'status' => 'success',
|
||||||
|
'finished_at' => now()->subDays(2),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$current = createInventorySyncOperationRun($tenant, [
|
||||||
|
'selection_hash' => $baseline->selection_hash,
|
||||||
|
'status' => 'success',
|
||||||
|
'finished_at' => now()->subDay(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$policy = Policy::factory()->for($tenant)->create([
|
||||||
|
'external_id' => 'policy-finding-rbac',
|
||||||
|
'policy_type' => 'deviceConfiguration',
|
||||||
|
'platform' => 'windows10',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$baselineVersion = PolicyVersion::factory()->for($tenant)->create([
|
||||||
|
'policy_id' => $policy->getKey(),
|
||||||
|
'version_number' => 1,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'RBAC Policy',
|
||||||
|
'customSettingFoo' => 'Old value',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$currentVersion = PolicyVersion::factory()->for($tenant)->create([
|
||||||
|
'policy_id' => $policy->getKey(),
|
||||||
|
'version_number' => 2,
|
||||||
|
'policy_type' => $policy->policy_type,
|
||||||
|
'platform' => $policy->platform,
|
||||||
|
'snapshot' => [
|
||||||
|
'displayName' => 'RBAC Policy',
|
||||||
|
'customSettingFoo' => 'New value',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$finding = Finding::factory()->for($tenant)->create([
|
||||||
|
'finding_type' => Finding::FINDING_TYPE_DRIFT,
|
||||||
|
'scope_key' => (string) $current->selection_hash,
|
||||||
|
'baseline_operation_run_id' => $baseline->getKey(),
|
||||||
|
'current_operation_run_id' => $current->getKey(),
|
||||||
|
'subject_type' => 'policy',
|
||||||
|
'subject_external_id' => $policy->external_id,
|
||||||
|
'evidence_jsonb' => [
|
||||||
|
'change_type' => 'modified',
|
||||||
|
'summary' => [
|
||||||
|
'kind' => 'policy_snapshot',
|
||||||
|
'changed_fields' => ['snapshot_hash'],
|
||||||
|
],
|
||||||
|
'baseline' => [
|
||||||
|
'policy_id' => $policy->external_id,
|
||||||
|
'policy_version_id' => $baselineVersion->getKey(),
|
||||||
|
'snapshot_hash' => 'baseline-hash',
|
||||||
|
],
|
||||||
|
'current' => [
|
||||||
|
'policy_id' => $policy->external_id,
|
||||||
|
'policy_version_id' => $currentVersion->getKey(),
|
||||||
|
'snapshot_hash' => 'current-hash',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
InventoryItem::factory()->for($tenant)->create([
|
||||||
|
'external_id' => $finding->subject_external_id,
|
||||||
|
'display_name' => 'RBAC Policy',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->get(FindingResource::getUrl('view', ['record' => $finding], tenant: $tenant));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Normalized diff');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="normalized-diff"')
|
||||||
|
->toContain('data-shared-normalized-diff-host="finding"');
|
||||||
|
});
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
|
it('keeps verification tab ownership inside the shared viewer', function (): void {
|
||||||
|
$sharedViewer = (string) file_get_contents(resource_path('views/filament/components/verification-report-viewer.blade.php'));
|
||||||
|
|
||||||
|
expect($sharedViewer)
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('Verification report tabs');
|
||||||
|
|
||||||
|
$hostViews = [
|
||||||
|
resource_path('views/filament/forms/components/managed-tenant-onboarding-verification-report.blade.php'),
|
||||||
|
resource_path('views/filament/widgets/tenant/tenant-verification-report.blade.php'),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($hostViews as $path) {
|
||||||
|
expect((string) file_get_contents($path))->not->toContain('Verification report tabs');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps policy-settings-standard as a compatibility wrapper only', function (): void {
|
||||||
|
$compatibilityView = (string) file_get_contents(resource_path('views/filament/infolists/entries/policy-settings-standard.blade.php'));
|
||||||
|
|
||||||
|
expect($compatibilityView)->toContain('normalized-settings.wrapper');
|
||||||
|
|
||||||
|
$directUsages = collect(File::allFiles(resource_path('views/filament')))
|
||||||
|
->reject(static fn (\SplFileInfo $file): bool => $file->getPathname() === resource_path('views/filament/infolists/entries/policy-settings-standard.blade.php'))
|
||||||
|
->filter(static fn (\SplFileInfo $file): bool => str_contains((string) file_get_contents($file->getPathname()), 'policy-settings-standard'))
|
||||||
|
->map(static fn (\SplFileInfo $file): string => str_replace(resource_path('views/'), '', $file->getPathname()))
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
expect($directUsages)->toBe([]);
|
||||||
|
});
|
||||||
@ -6,6 +6,7 @@
|
|||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Services\Graph\GraphClientInterface;
|
use App\Services\Graph\GraphClientInterface;
|
||||||
|
use App\Support\Verification\VerificationReportWriter;
|
||||||
use App\Support\Workspaces\WorkspaceContext;
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
|
|
||||||
@ -142,3 +143,45 @@
|
|||||||
->get(route('admin.operations.view', ['run' => (int) $run->getKey()]))
|
->get(route('admin.operations.view', ['run' => (int) $run->getKey()]))
|
||||||
->assertNotFound();
|
->assertNotFound();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders shared verification family markers on monitoring operation detail for workspace members', function (): void {
|
||||||
|
$tenant = Tenant::factory()->create();
|
||||||
|
[$user, $tenant] = createUserWithTenant($tenant, role: 'owner');
|
||||||
|
|
||||||
|
$run = OperationRun::factory()->create([
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'workspace_id' => (int) $tenant->workspace_id,
|
||||||
|
'type' => 'provider.connection.check',
|
||||||
|
'status' => 'completed',
|
||||||
|
'outcome' => 'blocked',
|
||||||
|
'initiator_name' => 'System',
|
||||||
|
'run_identity_hash' => 'hash123',
|
||||||
|
'context' => [
|
||||||
|
'verification_report' => VerificationReportWriter::build('provider.connection.check', [
|
||||||
|
[
|
||||||
|
'key' => 'provider_connection',
|
||||||
|
'title' => 'Provider connection preflight',
|
||||||
|
'status' => 'fail',
|
||||||
|
'severity' => 'critical',
|
||||||
|
'blocking' => true,
|
||||||
|
'reason_code' => 'provider_connection_missing',
|
||||||
|
'message' => 'No provider connection configured.',
|
||||||
|
'evidence' => [],
|
||||||
|
'next_steps' => [],
|
||||||
|
],
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
Filament::setTenant(null, true);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
||||||
|
->get(route('admin.operations.view', ['run' => (int) $run->getKey()]));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Provider connection preflight');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="operation_run_detail"');
|
||||||
|
});
|
||||||
|
|||||||
@ -3,11 +3,13 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use App\Filament\Pages\Workspaces\ManagedTenantOnboardingWizard;
|
use App\Filament\Pages\Workspaces\ManagedTenantOnboardingWizard;
|
||||||
|
use App\Models\OperationRun;
|
||||||
use App\Models\ProviderConnection;
|
use App\Models\ProviderConnection;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Workspace;
|
use App\Models\Workspace;
|
||||||
use App\Models\WorkspaceMembership;
|
use App\Models\WorkspaceMembership;
|
||||||
|
use App\Support\Verification\VerificationReportWriter;
|
||||||
use App\Support\Workspaces\WorkspaceContext;
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
|
|
||||||
@ -148,6 +150,81 @@
|
|||||||
->assertForbidden();
|
->assertForbidden();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders shared verification family markers for an entitled requested verify draft', function (): void {
|
||||||
|
$workspace = Workspace::factory()->create();
|
||||||
|
$tenant = Tenant::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'status' => Tenant::STATUS_ONBOARDING,
|
||||||
|
]);
|
||||||
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
createUserWithTenant(
|
||||||
|
tenant: $tenant,
|
||||||
|
user: $user,
|
||||||
|
role: 'owner',
|
||||||
|
workspaceRole: 'owner',
|
||||||
|
ensureDefaultMicrosoftProviderConnection: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
$connection = ProviderConnection::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'provider' => 'microsoft',
|
||||||
|
'entra_tenant_id' => (string) $tenant->tenant_id,
|
||||||
|
'display_name' => 'Requested verify connection',
|
||||||
|
'is_default' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$run = OperationRun::factory()->create([
|
||||||
|
'workspace_id' => (int) $workspace->getKey(),
|
||||||
|
'tenant_id' => (int) $tenant->getKey(),
|
||||||
|
'type' => 'provider.connection.check',
|
||||||
|
'status' => 'completed',
|
||||||
|
'outcome' => 'blocked',
|
||||||
|
'context' => [
|
||||||
|
'provider_connection_id' => (int) $connection->getKey(),
|
||||||
|
'verification_report' => VerificationReportWriter::build('provider.connection.check', [
|
||||||
|
[
|
||||||
|
'key' => 'requested_verify_draft',
|
||||||
|
'title' => 'Requested verify draft check',
|
||||||
|
'status' => 'fail',
|
||||||
|
'severity' => 'high',
|
||||||
|
'blocking' => false,
|
||||||
|
'reason_code' => 'missing_configuration',
|
||||||
|
'message' => 'Draft needs attention.',
|
||||||
|
'evidence' => [],
|
||||||
|
'next_steps' => [],
|
||||||
|
],
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$draft = createOnboardingDraft([
|
||||||
|
'workspace' => $workspace,
|
||||||
|
'tenant' => $tenant,
|
||||||
|
'started_by' => $user,
|
||||||
|
'updated_by' => $user,
|
||||||
|
'current_step' => 'verify',
|
||||||
|
'state' => [
|
||||||
|
'entra_tenant_id' => (string) $tenant->tenant_id,
|
||||||
|
'tenant_name' => (string) $tenant->name,
|
||||||
|
'provider_connection_id' => (int) $connection->getKey(),
|
||||||
|
'verification_operation_run_id' => (int) $run->getKey(),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)
|
||||||
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $workspace->getKey()])
|
||||||
|
->followingRedirects()
|
||||||
|
->get(route('admin.onboarding.draft', ['onboardingDraft' => $draft->getKey()]));
|
||||||
|
|
||||||
|
$response->assertSuccessful()->assertSee('Requested verify draft check');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="onboarding_wizard"');
|
||||||
|
});
|
||||||
|
|
||||||
it('mounts the requested draft with canonical persisted continuity state even when other drafts exist', function (): void {
|
it('mounts the requested draft with canonical persisted continuity state even when other drafts exist', function (): void {
|
||||||
$workspace = Workspace::factory()->create();
|
$workspace = Workspace::factory()->create();
|
||||||
$tenant = Tenant::factory()->create([
|
$tenant = Tenant::factory()->create([
|
||||||
|
|||||||
@ -319,7 +319,7 @@
|
|||||||
'updated_by_user_id' => (int) $user->getKey(),
|
'updated_by_user_id' => (int) $user->getKey(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->followingRedirects()
|
->followingRedirects()
|
||||||
->get('/admin/onboarding')
|
->get('/admin/onboarding')
|
||||||
->assertSuccessful()
|
->assertSuccessful()
|
||||||
@ -331,6 +331,13 @@
|
|||||||
->assertSee('Missing required Graph permissions.')
|
->assertSee('Missing required Graph permissions.')
|
||||||
->assertSee('Graph permissions')
|
->assertSee('Graph permissions')
|
||||||
->assertSee($entraTenantId);
|
->assertSee($entraTenantId);
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="onboarding_wizard"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('keeps one onboarding verification path per state while leaving workflow actions on the wizard step', function (): void {
|
it('keeps one onboarding verification path per state while leaving workflow actions on the wizard step', function (): void {
|
||||||
|
|||||||
@ -246,7 +246,7 @@
|
|||||||
'updated_by_user_id' => (int) $user->getKey(),
|
'updated_by_user_id' => (int) $user->getKey(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->followingRedirects()
|
->followingRedirects()
|
||||||
->get('/admin/onboarding')
|
->get('/admin/onboarding')
|
||||||
->assertSuccessful()
|
->assertSuccessful()
|
||||||
@ -262,4 +262,11 @@
|
|||||||
->assertSee('First step')
|
->assertSee('First step')
|
||||||
->assertSee('Second step')
|
->assertSee('Second step')
|
||||||
->assertDontSee('Third step');
|
->assertDontSee('Third step');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="onboarding_wizard"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -26,5 +26,6 @@
|
|||||||
|
|
||||||
expect($html)->toContain('Enabled')
|
expect($html)->toContain('Enabled')
|
||||||
->and($html)->toContain('Disabled')
|
->and($html)->toContain('Disabled')
|
||||||
->and($html)->toContain('fi-badge');
|
->and($html)->toContain('fi-badge')
|
||||||
|
->and($html)->toContain('data-shared-detail-family="normalized-settings"');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
use App\Models\Workspace;
|
use App\Models\Workspace;
|
||||||
use App\Support\OperationRunOutcome;
|
use App\Support\OperationRunOutcome;
|
||||||
use App\Support\OperationRunStatus;
|
use App\Support\OperationRunStatus;
|
||||||
|
use App\Support\Verification\VerificationReportWriter;
|
||||||
use App\Support\Workspaces\WorkspaceContext;
|
use App\Support\Workspaces\WorkspaceContext;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
@ -39,6 +40,21 @@
|
|||||||
'type' => 'provider.connection.check',
|
'type' => 'provider.connection.check',
|
||||||
'status' => OperationRunStatus::Queued->value,
|
'status' => OperationRunStatus::Queued->value,
|
||||||
'outcome' => OperationRunOutcome::Pending->value,
|
'outcome' => OperationRunOutcome::Pending->value,
|
||||||
|
'context' => [
|
||||||
|
'verification_report' => VerificationReportWriter::build('provider.connection.check', [
|
||||||
|
[
|
||||||
|
'key' => 'provider_connection',
|
||||||
|
'title' => 'Provider connection preflight',
|
||||||
|
'status' => 'fail',
|
||||||
|
'severity' => 'critical',
|
||||||
|
'blocking' => true,
|
||||||
|
'reason_code' => 'provider_connection_missing',
|
||||||
|
'message' => 'No provider connection configured.',
|
||||||
|
'evidence' => [],
|
||||||
|
'next_steps' => [],
|
||||||
|
],
|
||||||
|
]),
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->actingAs($user)
|
$this->actingAs($user)
|
||||||
|
|||||||
@ -50,6 +50,13 @@
|
|||||||
->assertSee('Blocked')
|
->assertSee('Blocked')
|
||||||
->assertSee('Token acquisition works');
|
->assertSee('Token acquisition works');
|
||||||
|
|
||||||
|
expect($component->html())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="operation_run_detail"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
|
|
||||||
$component
|
$component
|
||||||
->call('$refresh')
|
->call('$refresh')
|
||||||
->assertSee('Token acquisition works');
|
->assertSee('Token acquisition works');
|
||||||
@ -184,11 +191,18 @@
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
assertNoOutboundHttp(function () use ($user): void {
|
assertNoOutboundHttp(function () use ($user): void {
|
||||||
$this->actingAs($user)
|
$response = $this->actingAs($user)
|
||||||
->followingRedirects()
|
->followingRedirects()
|
||||||
->get('/admin/onboarding')
|
->get('/admin/onboarding')
|
||||||
->assertSuccessful()
|
->assertSuccessful()
|
||||||
->assertSee('Onboarding check');
|
->assertSee('Onboarding check');
|
||||||
|
|
||||||
|
expect($response->getContent())
|
||||||
|
->toContain('data-shared-detail-family="verification-report"')
|
||||||
|
->toContain('data-host-kind="onboarding_wizard"')
|
||||||
|
->toContain('data-shared-zone="summary"')
|
||||||
|
->toContain('data-shared-zone="issues"')
|
||||||
|
->toContain('data-shared-zone="diagnostics"');
|
||||||
});
|
});
|
||||||
|
|
||||||
Bus::assertNothingDispatched();
|
Bus::assertNothingDispatched();
|
||||||
|
|||||||
36
specs/197-shared-detail-contract/checklists/requirements.md
Normal file
36
specs/197-shared-detail-contract/checklists/requirements.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Specification Quality Checklist: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
||||||
|
**Created**: 2026-04-15
|
||||||
|
**Feature**: [spec.md](../spec.md)
|
||||||
|
|
||||||
|
## Content Quality
|
||||||
|
|
||||||
|
- [x] No implementation details (languages, frameworks, APIs)
|
||||||
|
- [x] Focused on user value and business needs
|
||||||
|
- [x] Written for non-technical stakeholders
|
||||||
|
- [x] All mandatory sections completed
|
||||||
|
|
||||||
|
## Requirement Completeness
|
||||||
|
|
||||||
|
- [x] No [NEEDS CLARIFICATION] markers remain
|
||||||
|
- [x] Requirements are testable and unambiguous
|
||||||
|
- [x] Success criteria are measurable
|
||||||
|
- [x] Success criteria are technology-agnostic (no implementation details)
|
||||||
|
- [x] All acceptance scenarios are defined
|
||||||
|
- [x] Edge cases are identified
|
||||||
|
- [x] Scope is clearly bounded
|
||||||
|
- [x] Dependencies and assumptions identified
|
||||||
|
|
||||||
|
## Feature Readiness
|
||||||
|
|
||||||
|
- [x] All functional requirements have clear acceptance criteria
|
||||||
|
- [x] User scenarios cover primary flows
|
||||||
|
- [x] Feature meets measurable outcomes defined in Success Criteria
|
||||||
|
- [x] No implementation details leak into specification
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Validation completed in one pass.
|
||||||
|
- The spec stays bounded to two already proven shared detail families and explicitly excludes shell, monitoring-state, and broad custom-view consolidation themes.
|
||||||
|
- Repository truth from current host usage informed the in-scope family definitions without embedding file-level implementation detail into the spec body.
|
||||||
@ -0,0 +1,299 @@
|
|||||||
|
openapi: 3.1.0
|
||||||
|
info:
|
||||||
|
title: Normalized Detail Family Internal Surface Contract
|
||||||
|
version: 0.1.0
|
||||||
|
summary: Internal logical contract for shared normalized settings and normalized diff families
|
||||||
|
description: |
|
||||||
|
This contract is an internal planning artifact for Spec 197. It documents the
|
||||||
|
family-owned normalized settings and normalized diff surfaces used across
|
||||||
|
policy, policy version, and finding detail hosts. Rendered routes still
|
||||||
|
return HTML. The structured schemas below describe the internal surface
|
||||||
|
contract and approved host-variation boundaries. This does not add a public
|
||||||
|
HTTP API.
|
||||||
|
servers:
|
||||||
|
- url: /internal
|
||||||
|
x-family-consumers:
|
||||||
|
- surface: policy_settings
|
||||||
|
source: normalized_settings_surface
|
||||||
|
accessPattern: infolist_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Resources/PolicyResource.php
|
||||||
|
- apps/platform/resources/views/filament/infolists/entries/normalized-settings.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- NormalizedSettingsSurface::build
|
||||||
|
- data-shared-detail-family="normalized-settings"
|
||||||
|
- data-shared-normalized-settings-host="policy"
|
||||||
|
- surface: policy_version_settings
|
||||||
|
source: normalized_settings_surface
|
||||||
|
accessPattern: infolist_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Resources/PolicyVersionResource.php
|
||||||
|
- apps/platform/resources/views/filament/infolists/entries/normalized-settings.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- NormalizedSettingsSurface::build
|
||||||
|
- data-shared-detail-family="normalized-settings"
|
||||||
|
- data-shared-normalized-settings-host="policy_version"
|
||||||
|
x-forbiddenMarkers:
|
||||||
|
- needle: "->view('filament.infolists.entries.policy-settings-standard')"
|
||||||
|
max: 0
|
||||||
|
- surface: policy_version_diff
|
||||||
|
source: normalized_diff_surface
|
||||||
|
accessPattern: infolist_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Resources/PolicyVersionResource.php
|
||||||
|
- apps/platform/resources/views/filament/infolists/entries/normalized-diff.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- NormalizedDiffSurface::build
|
||||||
|
- data-shared-detail-family="normalized-diff"
|
||||||
|
- data-shared-normalized-diff-host="policy_version"
|
||||||
|
- data-shared-zone="summary"
|
||||||
|
- data-shared-zone="groups"
|
||||||
|
- surface: finding_diff
|
||||||
|
source: normalized_diff_surface
|
||||||
|
accessPattern: infolist_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Resources/FindingResource.php
|
||||||
|
- apps/platform/resources/views/filament/infolists/entries/normalized-diff.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- NormalizedDiffSurface::build
|
||||||
|
- data-shared-detail-family="normalized-diff"
|
||||||
|
- data-shared-normalized-diff-host="finding"
|
||||||
|
- data-shared-normalized-diff-state
|
||||||
|
- data-shared-zone="summary"
|
||||||
|
paths:
|
||||||
|
/ui-contracts/normalized-settings/resolve:
|
||||||
|
get:
|
||||||
|
summary: Resolve the shared normalized settings family contract for one host
|
||||||
|
operationId: resolveNormalizedSettingsSurface
|
||||||
|
parameters:
|
||||||
|
- name: host
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/NormalizedSettingsHostKind'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Shared normalized settings family contract resolved for the current host context
|
||||||
|
content:
|
||||||
|
application/vnd.tenantpilot.normalized-settings-surface+json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/NormalizedSettingsSurfaceContract'
|
||||||
|
'403':
|
||||||
|
description: Actor is in scope but lacks the capability required to view the host
|
||||||
|
'404':
|
||||||
|
description: Host or tenant scope is not visible in the current workspace or tenant context
|
||||||
|
/ui-contracts/normalized-diff/resolve:
|
||||||
|
get:
|
||||||
|
summary: Resolve the shared normalized diff family contract for one host
|
||||||
|
operationId: resolveNormalizedDiffSurface
|
||||||
|
parameters:
|
||||||
|
- name: host
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/NormalizedDiffHostKind'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Shared normalized diff family contract resolved for the current host context
|
||||||
|
content:
|
||||||
|
application/vnd.tenantpilot.normalized-diff-surface+json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/NormalizedDiffSurfaceContract'
|
||||||
|
'403':
|
||||||
|
description: Actor is in scope but lacks the capability required to view the host
|
||||||
|
'404':
|
||||||
|
description: Host or tenant scope is not visible in the current workspace or tenant context
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
NormalizedSettingsHostKind:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- policy
|
||||||
|
- policy_version
|
||||||
|
NormalizedDiffHostKind:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- policy_version
|
||||||
|
- finding
|
||||||
|
NormalizedSettingsVariant:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- settings_catalog_table
|
||||||
|
- standard_blocks
|
||||||
|
AvailabilityState:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- unavailable
|
||||||
|
- partial
|
||||||
|
NormalizedSettingsSectionBehavior:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- preservesSectionOrder
|
||||||
|
- supportsExpansion
|
||||||
|
- ownsEmptyState
|
||||||
|
properties:
|
||||||
|
preservesSectionOrder:
|
||||||
|
type: boolean
|
||||||
|
supportsExpansion:
|
||||||
|
type: boolean
|
||||||
|
ownsEmptyState:
|
||||||
|
type: boolean
|
||||||
|
NormalizedSettingsRenderExpectations:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- ownsWarningsInWrapper
|
||||||
|
- ownsSubtypeDelegation
|
||||||
|
- keepsHostFramingOutsideCore
|
||||||
|
properties:
|
||||||
|
ownsWarningsInWrapper:
|
||||||
|
type: boolean
|
||||||
|
ownsSubtypeDelegation:
|
||||||
|
type: boolean
|
||||||
|
keepsHostFramingOutsideCore:
|
||||||
|
type: boolean
|
||||||
|
NormalizedDiffViewMode:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- key
|
||||||
|
- label
|
||||||
|
- default
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
default:
|
||||||
|
type: boolean
|
||||||
|
NormalizedDiffSectionBehavior:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- preservesGroupOrder
|
||||||
|
- supportsExpansion
|
||||||
|
- supportsFullscreen
|
||||||
|
properties:
|
||||||
|
preservesGroupOrder:
|
||||||
|
type: boolean
|
||||||
|
supportsExpansion:
|
||||||
|
type: boolean
|
||||||
|
supportsFullscreen:
|
||||||
|
type: boolean
|
||||||
|
NormalizedDiffRenderExpectations:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- ownsAvailabilityState
|
||||||
|
- ownsZeroDiffMessaging
|
||||||
|
- keepsHostFramingOutsideCore
|
||||||
|
properties:
|
||||||
|
ownsAvailabilityState:
|
||||||
|
type: boolean
|
||||||
|
ownsZeroDiffMessaging:
|
||||||
|
type: boolean
|
||||||
|
keepsHostFramingOutsideCore:
|
||||||
|
type: boolean
|
||||||
|
NormalizedSettingsSurfaceContract:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- hostKind
|
||||||
|
- context
|
||||||
|
- variant
|
||||||
|
- sectionBehavior
|
||||||
|
- renderExpectations
|
||||||
|
- titlePolicy
|
||||||
|
properties:
|
||||||
|
hostKind:
|
||||||
|
$ref: '#/components/schemas/NormalizedSettingsHostKind'
|
||||||
|
context:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- policy
|
||||||
|
- version
|
||||||
|
variant:
|
||||||
|
$ref: '#/components/schemas/NormalizedSettingsVariant'
|
||||||
|
warnings:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
settingsTable:
|
||||||
|
type:
|
||||||
|
- object
|
||||||
|
- 'null'
|
||||||
|
blocks:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
sectionBehavior:
|
||||||
|
$ref: '#/components/schemas/NormalizedSettingsSectionBehavior'
|
||||||
|
renderExpectations:
|
||||||
|
$ref: '#/components/schemas/NormalizedSettingsRenderExpectations'
|
||||||
|
emptyState:
|
||||||
|
type:
|
||||||
|
- object
|
||||||
|
- 'null'
|
||||||
|
titlePolicy:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- showWrapperTitle
|
||||||
|
properties:
|
||||||
|
showWrapperTitle:
|
||||||
|
type: boolean
|
||||||
|
NormalizedDiffSurfaceContract:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- hostKind
|
||||||
|
- availabilityState
|
||||||
|
- summary
|
||||||
|
- viewModes
|
||||||
|
- sectionBehavior
|
||||||
|
- renderExpectations
|
||||||
|
properties:
|
||||||
|
hostKind:
|
||||||
|
$ref: '#/components/schemas/NormalizedDiffHostKind'
|
||||||
|
availabilityState:
|
||||||
|
$ref: '#/components/schemas/AvailabilityState'
|
||||||
|
summary:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- added
|
||||||
|
- removed
|
||||||
|
- changed
|
||||||
|
properties:
|
||||||
|
added:
|
||||||
|
type: integer
|
||||||
|
removed:
|
||||||
|
type: integer
|
||||||
|
changed:
|
||||||
|
type: integer
|
||||||
|
message:
|
||||||
|
type:
|
||||||
|
- string
|
||||||
|
- 'null'
|
||||||
|
viewModes:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/NormalizedDiffViewMode'
|
||||||
|
sectionBehavior:
|
||||||
|
$ref: '#/components/schemas/NormalizedDiffSectionBehavior'
|
||||||
|
renderExpectations:
|
||||||
|
$ref: '#/components/schemas/NormalizedDiffRenderExpectations'
|
||||||
|
groups:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
scriptRendering:
|
||||||
|
type:
|
||||||
|
- object
|
||||||
|
- 'null'
|
||||||
|
emptyState:
|
||||||
|
type:
|
||||||
|
- object
|
||||||
|
- 'null'
|
||||||
@ -0,0 +1,304 @@
|
|||||||
|
openapi: 3.1.0
|
||||||
|
info:
|
||||||
|
title: Verification Report Family Internal Surface Contract
|
||||||
|
version: 0.1.0
|
||||||
|
summary: Internal logical contract for the shared Verification Report family
|
||||||
|
description: |
|
||||||
|
This contract is an internal planning artifact for Spec 197. It documents the
|
||||||
|
family-owned verification surface used across operation detail, onboarding,
|
||||||
|
and tenant verification widget hosts. Rendered routes still return HTML.
|
||||||
|
The structured schemas below describe the internal surface contract and the
|
||||||
|
allowed host-variation boundaries. This does not add a public HTTP API.
|
||||||
|
servers:
|
||||||
|
- url: /internal
|
||||||
|
x-family-consumers:
|
||||||
|
- surface: operation_run_detail
|
||||||
|
source: verification_report_surface
|
||||||
|
accessPattern: detail_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Resources/OperationRunResource.php
|
||||||
|
- apps/platform/resources/views/filament/components/verification-report-viewer.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- VerificationReportViewer::surface
|
||||||
|
- data-shared-detail-family="verification-report"
|
||||||
|
- data-host-kind="operation_run_detail"
|
||||||
|
- data-shared-zone="summary"
|
||||||
|
- data-shared-zone="diagnostics"
|
||||||
|
- surface: onboarding_verification_step
|
||||||
|
source: verification_report_surface
|
||||||
|
accessPattern: form_embedded_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Pages/Workspaces/ManagedTenantOnboardingWizard.php
|
||||||
|
- apps/platform/resources/views/filament/forms/components/managed-tenant-onboarding-verification-report.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- VerificationReportViewer::surface
|
||||||
|
- data-shared-detail-family="verification-report"
|
||||||
|
- data-host-kind="onboarding_wizard"
|
||||||
|
- assistActionName
|
||||||
|
- technicalDetailsActionName
|
||||||
|
x-forbiddenMarkers:
|
||||||
|
- needle: "x-data=\"{ tab: 'issues' }\""
|
||||||
|
max: 0
|
||||||
|
- surface: tenant_verification_widget
|
||||||
|
source: verification_report_surface
|
||||||
|
accessPattern: widget_safe
|
||||||
|
guardScope:
|
||||||
|
- apps/platform/app/Filament/Widgets/Tenant/TenantVerificationReport.php
|
||||||
|
- apps/platform/resources/views/filament/widgets/tenant/tenant-verification-report.blade.php
|
||||||
|
requiredMarkers:
|
||||||
|
- VerificationReportViewer::surface
|
||||||
|
- data-shared-detail-family="verification-report"
|
||||||
|
- data-host-kind="tenant_widget"
|
||||||
|
- data-shared-zone="summary"
|
||||||
|
- data-shared-zone="diagnostics"
|
||||||
|
paths:
|
||||||
|
/ui-contracts/verification-report/resolve:
|
||||||
|
get:
|
||||||
|
summary: Resolve the shared Verification Report family contract for one host
|
||||||
|
operationId: resolveVerificationReportSurface
|
||||||
|
parameters:
|
||||||
|
- name: host
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/VerificationHostKind'
|
||||||
|
- name: runId
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Shared Verification Report surface contract resolved for the current host context
|
||||||
|
content:
|
||||||
|
application/vnd.tenantpilot.verification-report-surface+json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/VerificationReportSurfaceContract'
|
||||||
|
'403':
|
||||||
|
description: Actor is in scope but lacks the capability required for host-owned actions
|
||||||
|
'404':
|
||||||
|
description: Run or tenant scope is not visible in the current workspace or tenant context
|
||||||
|
/admin/onboarding:
|
||||||
|
get:
|
||||||
|
summary: Onboarding verification host using the shared Verification Report family
|
||||||
|
operationId: viewOnboardingVerificationHost
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Rendered onboarding verification step with shared verification family core
|
||||||
|
content:
|
||||||
|
text/html:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
/admin/t/{tenant}:
|
||||||
|
get:
|
||||||
|
summary: Tenant verification widget host using the shared Verification Report family
|
||||||
|
operationId: viewTenantVerificationWidgetHost
|
||||||
|
parameters:
|
||||||
|
- name: tenant
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Rendered tenant detail page containing the shared verification family widget
|
||||||
|
content:
|
||||||
|
text/html:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
VerificationHostKind:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- operation_run_detail
|
||||||
|
- onboarding_wizard
|
||||||
|
- tenant_widget
|
||||||
|
VerificationCoreState:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- unavailable
|
||||||
|
- completed
|
||||||
|
VerificationActionKind:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- navigation
|
||||||
|
- assist
|
||||||
|
- acknowledge
|
||||||
|
- refresh
|
||||||
|
- technical_details
|
||||||
|
VerificationHostVariation:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- ownsNoRunState
|
||||||
|
- ownsActiveState
|
||||||
|
- supportsAssist
|
||||||
|
- supportsAcknowledge
|
||||||
|
- supportsTechnicalDetailsTrigger
|
||||||
|
properties:
|
||||||
|
ownsNoRunState:
|
||||||
|
type: boolean
|
||||||
|
ownsActiveState:
|
||||||
|
type: boolean
|
||||||
|
supportsAssist:
|
||||||
|
type: boolean
|
||||||
|
supportsAcknowledge:
|
||||||
|
type: boolean
|
||||||
|
supportsTechnicalDetailsTrigger:
|
||||||
|
type: boolean
|
||||||
|
VerificationAction:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- kind
|
||||||
|
- label
|
||||||
|
- ownedByHost
|
||||||
|
properties:
|
||||||
|
kind:
|
||||||
|
$ref: '#/components/schemas/VerificationActionKind'
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
ownedByHost:
|
||||||
|
type: boolean
|
||||||
|
VerificationViewZone:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- key
|
||||||
|
- label
|
||||||
|
- defaultVisible
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
defaultVisible:
|
||||||
|
type: boolean
|
||||||
|
optional:
|
||||||
|
type: boolean
|
||||||
|
VerificationNextStepPlacement:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- shared_zone
|
||||||
|
- host_action_zone
|
||||||
|
VerificationNextStep:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- label
|
||||||
|
- placement
|
||||||
|
- ownedByHost
|
||||||
|
properties:
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
placement:
|
||||||
|
$ref: '#/components/schemas/VerificationNextStepPlacement'
|
||||||
|
ownedByHost:
|
||||||
|
type: boolean
|
||||||
|
actionKind:
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/VerificationActionKind'
|
||||||
|
- type: 'null'
|
||||||
|
VerificationOptionalZone:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- technical_details
|
||||||
|
- change_indicator
|
||||||
|
- previous_run_context
|
||||||
|
VerificationIssueGroup:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- label
|
||||||
|
- checks
|
||||||
|
properties:
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
checks:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
VerificationDiagnostics:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- hasTechnicalZone
|
||||||
|
properties:
|
||||||
|
hasTechnicalZone:
|
||||||
|
type: boolean
|
||||||
|
fingerprint:
|
||||||
|
type:
|
||||||
|
- string
|
||||||
|
- 'null'
|
||||||
|
previousRunUrl:
|
||||||
|
type:
|
||||||
|
- string
|
||||||
|
- 'null'
|
||||||
|
operationRunId:
|
||||||
|
type:
|
||||||
|
- integer
|
||||||
|
- 'null'
|
||||||
|
VerificationReportSurfaceContract:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- hostKind
|
||||||
|
- coreState
|
||||||
|
- summary
|
||||||
|
- issueGroups
|
||||||
|
- passedChecks
|
||||||
|
- diagnostics
|
||||||
|
- viewZones
|
||||||
|
- nextSteps
|
||||||
|
- hostVariation
|
||||||
|
properties:
|
||||||
|
hostKind:
|
||||||
|
$ref: '#/components/schemas/VerificationHostKind'
|
||||||
|
coreState:
|
||||||
|
$ref: '#/components/schemas/VerificationCoreState'
|
||||||
|
summary:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- overallLabel
|
||||||
|
- counts
|
||||||
|
properties:
|
||||||
|
overallLabel:
|
||||||
|
type: string
|
||||||
|
counts:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: integer
|
||||||
|
issueGroups:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VerificationIssueGroup'
|
||||||
|
passedChecks:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
diagnostics:
|
||||||
|
$ref: '#/components/schemas/VerificationDiagnostics'
|
||||||
|
viewZones:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VerificationViewZone'
|
||||||
|
nextSteps:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VerificationNextStep'
|
||||||
|
hostActions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VerificationAction'
|
||||||
|
hostVariation:
|
||||||
|
$ref: '#/components/schemas/VerificationHostVariation'
|
||||||
|
optionalZones:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VerificationOptionalZone'
|
||||||
|
emptyState:
|
||||||
|
type:
|
||||||
|
- object
|
||||||
|
- 'null'
|
||||||
232
specs/197-shared-detail-contract/data-model.md
Normal file
232
specs/197-shared-detail-contract/data-model.md
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
# Phase 1 Data Model: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This feature adds no database table, no persisted UI artifact, and no new state family. It formalizes two existing shared detail families as runtime contracts with explicit host-variation boundaries.
|
||||||
|
|
||||||
|
## Persistent Source Truths
|
||||||
|
|
||||||
|
### OperationRun
|
||||||
|
|
||||||
|
**Purpose**: Supplies stored verification status, timing, target scope, failure summary, and the raw verification report payload already used by the current verification hosts.
|
||||||
|
|
||||||
|
**Key fields**:
|
||||||
|
|
||||||
|
- `id`
|
||||||
|
- `workspace_id`
|
||||||
|
- `tenant_id`
|
||||||
|
- `type`
|
||||||
|
- `status`
|
||||||
|
- `outcome`
|
||||||
|
- `started_at`
|
||||||
|
- `completed_at`
|
||||||
|
- `context.verification_report`
|
||||||
|
- `context.target_scope`
|
||||||
|
- `failure_summary`
|
||||||
|
|
||||||
|
**Validation rules**:
|
||||||
|
|
||||||
|
- Verification family rendering remains DB-only and derives only from stored run data.
|
||||||
|
- No host may introduce a second source of verification truth outside the run payload and existing support helpers.
|
||||||
|
|
||||||
|
### Policy and PolicyVersion snapshot truth
|
||||||
|
|
||||||
|
**Purpose**: Supplies the source payloads for normalized settings and version-to-version diffs.
|
||||||
|
|
||||||
|
**Key fields**:
|
||||||
|
|
||||||
|
- `policies.id`
|
||||||
|
- `policies.tenant_id`
|
||||||
|
- `policies.policy_type`
|
||||||
|
- `policies.platform`
|
||||||
|
- `policy_versions.id`
|
||||||
|
- `policy_versions.policy_id`
|
||||||
|
- `policy_versions.snapshot`
|
||||||
|
- `policy_versions.policy_type`
|
||||||
|
- `policy_versions.platform`
|
||||||
|
|
||||||
|
**Validation rules**:
|
||||||
|
|
||||||
|
- The settings and diff families remain derived from current normalized snapshot truth.
|
||||||
|
- No new persisted “surface state” may be added to remember tabs, expanded sections, or unavailable-state decisions.
|
||||||
|
|
||||||
|
### Finding drift evidence
|
||||||
|
|
||||||
|
**Purpose**: Supplies the source references and availability reasons for diff rendering on drift findings.
|
||||||
|
|
||||||
|
**Key fields**:
|
||||||
|
|
||||||
|
- `findings.id`
|
||||||
|
- `findings.tenant_id`
|
||||||
|
- `findings.finding_type`
|
||||||
|
- `findings.evidence_jsonb.summary.kind`
|
||||||
|
- `findings.evidence_jsonb.baseline.policy_version_id`
|
||||||
|
- `findings.evidence_jsonb.current.policy_version_id`
|
||||||
|
|
||||||
|
**Validation rules**:
|
||||||
|
|
||||||
|
- Diff availability remains derived from referenced versions and current tenant context.
|
||||||
|
- The shared diff family must express unavailable or partial state from these sources instead of letting each host improvise new rules.
|
||||||
|
|
||||||
|
## Existing Runtime Source Objects
|
||||||
|
|
||||||
|
### VerificationReportViewer
|
||||||
|
|
||||||
|
**Purpose**: Existing support seam that extracts and validates the verification report, computes fingerprints, and resolves previous runs.
|
||||||
|
|
||||||
|
**Current responsibilities already present**:
|
||||||
|
|
||||||
|
- `report()`
|
||||||
|
- `fingerprint()`
|
||||||
|
- `previousRun()`
|
||||||
|
- `shouldRenderForRun()`
|
||||||
|
- `redactionNotes()`
|
||||||
|
|
||||||
|
**Relationship to this feature**:
|
||||||
|
|
||||||
|
- It becomes the narrow verification-family contract seam rather than being replaced.
|
||||||
|
- It should grow family-owned shaping helpers instead of remaining only a payload extractor.
|
||||||
|
|
||||||
|
### PolicyNormalizer, VersionDiff, and DriftFindingDiffBuilder
|
||||||
|
|
||||||
|
**Purpose**: Existing domain truth builders that already normalize settings and derive diffs.
|
||||||
|
|
||||||
|
**Relationship to this feature**:
|
||||||
|
|
||||||
|
- They remain the domain truth source.
|
||||||
|
- The new family contracts sit after these builders and before host rendering.
|
||||||
|
- The feature must not create a second normalization pipeline.
|
||||||
|
|
||||||
|
### SettingsCatalogSettingsTable
|
||||||
|
|
||||||
|
**Purpose**: Existing Livewire renderer for the settings-catalog table subtype.
|
||||||
|
|
||||||
|
**Relationship to this feature**:
|
||||||
|
|
||||||
|
- It remains the renderer for one settings subtype.
|
||||||
|
- The settings family wrapper decides when it appears and with what shared wrapper semantics.
|
||||||
|
|
||||||
|
## New Derived Runtime Contracts
|
||||||
|
|
||||||
|
### VerificationReportSurfaceContract
|
||||||
|
|
||||||
|
**Purpose**: One runtime contract that defines the verification family’s shared zones and allowed host variations.
|
||||||
|
|
||||||
|
#### Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
|-------|------|----------|-------------|
|
||||||
|
| `host_kind` | enum(`operation_run_detail`,`onboarding_wizard`,`tenant_widget`) | yes | Current host family consumer |
|
||||||
|
| `core_state` | enum(`unavailable`,`completed`) | yes | Shared family core state after host-owned no-run or in-progress framing |
|
||||||
|
| `summary` | object | yes | Overall badge, counts, and change-indicator data |
|
||||||
|
| `issue_groups` | array | yes | Grouped blockers, failures, warnings, and acknowledged issues |
|
||||||
|
| `passed_checks` | array | yes | Checks rendered under the passed zone |
|
||||||
|
| `diagnostics` | object | yes | Fingerprint, run identity, previous-run link, and related technical details |
|
||||||
|
| `view_zones` | array | yes | Ordered family view or tab definitions |
|
||||||
|
| `next_steps` | array | yes | Shared next-step items derived from report checks |
|
||||||
|
| `host_actions` | array | no | Host-owned actions such as assist, acknowledge, refresh, or open operation |
|
||||||
|
| `optional_zones` | array | no | Family-recognized zones that may be absent, such as technical details |
|
||||||
|
| `empty_state` | object nullable | no | Family-owned unavailable-state explanation when no valid report payload exists |
|
||||||
|
|
||||||
|
#### Validation rules
|
||||||
|
|
||||||
|
- The contract must own one tab or view model across all completed or unavailable verification surfaces.
|
||||||
|
- Hosts may append actions and framing, but may not redefine issue grouping, passed-check grouping, or diagnostics ownership.
|
||||||
|
- Host actions must declare whether they are shared navigation, host assist, or host mutation.
|
||||||
|
|
||||||
|
### VerificationReportHostVariation
|
||||||
|
|
||||||
|
**Purpose**: Declares the bounded host-owned differences for a verification-family consumer.
|
||||||
|
|
||||||
|
#### Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
|-------|------|----------|-------------|
|
||||||
|
| `owns_no_run_state` | bool | yes | Whether the host frames its own pre-run state |
|
||||||
|
| `owns_active_state` | bool | yes | Whether the host frames its own in-progress state |
|
||||||
|
| `supports_acknowledge` | bool | yes | Whether the host may surface acknowledgement mutations |
|
||||||
|
| `supports_assist` | bool | yes | Whether the host may route next steps through assist actions |
|
||||||
|
| `supports_technical_details_trigger` | bool | yes | Whether the host exposes a dedicated technical-details trigger outside the family core |
|
||||||
|
|
||||||
|
#### Validation rules
|
||||||
|
|
||||||
|
- Host variation may extend actions and framing only.
|
||||||
|
- Host variation must never add a second structural tab system or redefine the diagnostics contract.
|
||||||
|
|
||||||
|
### NormalizedSettingsSurfaceContract
|
||||||
|
|
||||||
|
**Purpose**: One runtime contract that defines the normalized settings family’s wrapper ownership, subtype selection, warnings, and empty-state behavior.
|
||||||
|
|
||||||
|
#### Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
|-------|------|----------|-------------|
|
||||||
|
| `host_kind` | enum(`policy`,`policy_version`) | yes | Host context for the settings family |
|
||||||
|
| `context` | enum(`policy`,`version`) | yes | Existing context string used for table query-string isolation and titles |
|
||||||
|
| `variant` | enum(`settings_catalog_table`,`standard_blocks`) | yes | Explicit subtype used by the shared family |
|
||||||
|
| `warnings` | array | no | Warning list displayed by the family wrapper |
|
||||||
|
| `settings_table` | object nullable | no | Table subtype payload when the settings-catalog subtype is active |
|
||||||
|
| `blocks` | array | no | Standard block payload for general, table, or key-value sections |
|
||||||
|
| `section_behavior` | object | yes | Shared section-order, expansion, and empty-state ownership rules for the settings family |
|
||||||
|
| `render_expectations` | object | yes | Explicit wrapper expectations for warnings, subtype delegation, and host-framing boundaries |
|
||||||
|
| `empty_state` | object nullable | no | Family-owned empty or unavailable message when no settings payload exists |
|
||||||
|
| `title_policy` | object | yes | Rules for whether wrapper or subtype titles are shown |
|
||||||
|
|
||||||
|
#### Validation rules
|
||||||
|
|
||||||
|
- Hosts may not choose sibling top-level settings blades once the family contract exists.
|
||||||
|
- Subtypes must be explicit family variations, not host-selected main variants.
|
||||||
|
- Warning and empty-state behavior must come from the family wrapper, not from host-specific text entries.
|
||||||
|
- Section order, expansion behavior, and wrapper expectations must be explicit so hosts do not silently redefine how the family reads.
|
||||||
|
|
||||||
|
### NormalizedDiffSurfaceContract
|
||||||
|
|
||||||
|
**Purpose**: One runtime contract that defines normalized diff summary, grouped rendering, unavailable behavior, and zero-diff messaging.
|
||||||
|
|
||||||
|
#### Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
|-------|------|----------|-------------|
|
||||||
|
| `host_kind` | enum(`policy_version`,`finding`) | yes | Host context for the diff family |
|
||||||
|
| `availability_state` | enum(`available`,`unavailable`,`partial`) | yes | Family-owned availability state |
|
||||||
|
| `summary` | object | yes | Added, removed, changed counts and summary message |
|
||||||
|
| `view_modes` | array | yes | Explicit diff-family modes or views that the host may expose without redefining the family |
|
||||||
|
| `section_behavior` | object | yes | Shared grouped-section order, expansion, and fullscreen rules |
|
||||||
|
| `render_expectations` | object | yes | Explicit ownership of availability, zero-diff messaging, and host-framing boundaries |
|
||||||
|
| `groups` | array | no | Changed, added, and removed groups with ordered row payloads |
|
||||||
|
| `script_rendering` | object | no | Script-highlighting flags and grammar hints |
|
||||||
|
| `empty_state` | object nullable | no | Family-owned zero-diff or unavailable-state explanation |
|
||||||
|
|
||||||
|
#### Validation rules
|
||||||
|
|
||||||
|
- Hosts may not prepend separate unavailable-state entries for the same normalized diff concept.
|
||||||
|
- The family must own both true unavailable and zero-diff informational states.
|
||||||
|
- Rich script rendering remains allowed, but it must live inside the family contract.
|
||||||
|
- View modes, grouped-section behavior, and render expectations must be explicit so a policy-version diff and a finding diff cannot drift into separate interaction models.
|
||||||
|
|
||||||
|
## Consumer Mapping
|
||||||
|
|
||||||
|
| Consumer | Family | Shared-family responsibility | Local host responsibility |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `OperationRunResource` verification section | Verification report | Completed and unavailable verification core, tab contract, diagnostics, grouped issues | Section placement inside enterprise detail, record authorization, no new mutation behavior |
|
||||||
|
| `ManagedTenantOnboardingWizard` verify step | Verification report | Completed and unavailable verification core, grouped issues, diagnostics, shared view zones | No-run and active-state framing, assist routing, acknowledge action, verify-step workflow actions |
|
||||||
|
| `TenantVerificationReport` widget | Verification report | Completed and unavailable verification core | Widget no-run and active-state framing, start-verification CTA, tenant operability copy |
|
||||||
|
| `PolicyResource` settings tab or fallback section | Normalized settings | Warnings, empty state, subtype ownership, wrapper structure | Tab framing, route context, surrounding policy detail layout |
|
||||||
|
| `PolicyVersionResource` normalized settings tab | Normalized settings | Same settings family contract as policy detail | Tab framing and version-specific surrounding detail layout |
|
||||||
|
| `PolicyVersionResource` diff tab | Normalized diff | Summary, grouped diff rendering, zero-diff and unavailable semantics | Tab framing and raw diff sidecar JSON |
|
||||||
|
| `FindingResource` diff section | Normalized diff | Same diff family contract as policy-version diff | Surrounding drift-specific sections, version resolution, and domain-specific sibling diff viewers kept out of scope |
|
||||||
|
|
||||||
|
## Derived Lifecycle
|
||||||
|
|
||||||
|
1. A host resolves current domain truth using existing run, normalization, or diff builders.
|
||||||
|
2. The host passes that truth through the appropriate shared family contract seam.
|
||||||
|
3. The family contract shapes shared zones, states, and subtype markers.
|
||||||
|
4. The host renders the shared family core and attaches only its allowed host-owned variations.
|
||||||
|
5. Tests assert that a new host cannot redefine family structure outside those variations.
|
||||||
|
|
||||||
|
## Migration Notes
|
||||||
|
|
||||||
|
- No database migration is required.
|
||||||
|
- `policy-settings-standard.blade.php` must stop acting as a sibling top-level host choice and become an internal subtype or be absorbed.
|
||||||
|
- Existing verification DB-only and tenant widget tests remain the primary regression base for the verification family.
|
||||||
|
- Existing policy-version and drift-diff tests remain the primary regression base for normalized detail families.
|
||||||
46
specs/197-shared-detail-contract/migration-note.md
Normal file
46
specs/197-shared-detail-contract/migration-note.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Closing Migration Note: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
This file is the release-acceptance artifact for Spec 197. Update it as implementation closes so FR-197-015 and D-197-004 are satisfied without overloading `quickstart.md`.
|
||||||
|
|
||||||
|
## Migrated Hosts
|
||||||
|
|
||||||
|
### Verification Report family
|
||||||
|
|
||||||
|
- `OperationRunResource` verification detail surface via `VerificationReportViewer::surface(...)` and shared summary, issues, passed, diagnostics, and unavailable zones
|
||||||
|
- `ManagedTenantOnboardingWizard` verification step surface via the same shared verification-family core with onboarding-only assist, acknowledge, and technical-detail variations layered around it
|
||||||
|
- `TenantVerificationReport` widget surface via the same completed-state verification-family core while preserving widget-owned no-run and in-progress framing
|
||||||
|
|
||||||
|
### Normalized Settings family
|
||||||
|
|
||||||
|
- `PolicyResource` normalized settings surface via `NormalizedSettingsSurface::build(...)`
|
||||||
|
- `PolicyVersionResource` normalized settings surface via `NormalizedSettingsSurface::build(...)`
|
||||||
|
- `policy-settings-standard.blade.php` retained only as an include-only compatibility shim into the normalized-settings family wrapper
|
||||||
|
- `SettingsCatalogSettingsTable` retained as the settings-catalog subtype renderer inside the normalized-settings family
|
||||||
|
|
||||||
|
### Normalized Diff family
|
||||||
|
|
||||||
|
- `PolicyVersionResource` normalized diff surface via `NormalizedDiffSurface::build(...)` and the shared summary, grouped-rendering, and empty-state wrapper
|
||||||
|
- `FindingResource` normalized diff surface via `NormalizedDiffSurface::build(...)` for available, unavailable, and zero-diff states
|
||||||
|
|
||||||
|
## Intentionally Allowed Remaining Variations
|
||||||
|
|
||||||
|
- Onboarding-specific assist, acknowledge, and technical-details actions remain host-scoped variations.
|
||||||
|
- No-run and in-progress framing remain host-owned where the host genuinely owns that lifecycle state.
|
||||||
|
- `SettingsCatalogSettingsTable` remains the settings-catalog subtype renderer inside the normalized-settings family.
|
||||||
|
- Drift-specific surrounding context remains host-owned in `FindingResource` as long as the normalized diff family core stays shared.
|
||||||
|
- The compatibility view `policy-settings-standard.blade.php` remains as a thin include-only shim so existing callers/tests do not become a new fork point.
|
||||||
|
|
||||||
|
## Manual Smoke Evidence
|
||||||
|
|
||||||
|
- Reviewer: GitHub Copilot via the local integrated browser using the local smoke-login flow
|
||||||
|
- Review date: 2026-04-15
|
||||||
|
- SC-197-003 result: Pass. Operation detail `Operation #6655`, the onboarding verify-step host, and the tenant verification widget all exposed the same verification-family core with recognizable summary, issues, passed, diagnostics, and read-only zones. Onboarding kept its bounded host-owned assist and technical-detail behavior, while the tenant widget kept its widget-specific framing on the tenant management detail page.
|
||||||
|
- SC-197-004 result: Pass. Policy detail `Policy #233`, policy-version detail `Policy Version #270`, drift finding `#79`, and a temporary local-only unavailable drift finding clone all rendered family-consistent normalized settings or diff behavior. The available diff surface matched the policy-version grouped diff contract, and the unavailable diff surface rendered the same family-owned unavailable-state treatment instead of a host-local message.
|
||||||
|
- Notes: Local browser smoke used `/admin/local/smoke-login` against Phoenicon in workspace `wp`. The tenant verification widget evidence came from the tenant management detail page rather than the tenant dashboard, which is the current widget host. The local dev dataset did not include a resumable verify-step onboarding draft or a natural missing-version drift finding for this tenant family, so temporary local-only fixture records were created, exercised, and deleted after verification. `./vendor/bin/sail bin pint --dirty --format agent` and the focused Sail regression pack had already passed in this feature session.
|
||||||
|
|
||||||
|
## Out-of-Scope Follow-Ups
|
||||||
|
|
||||||
|
- Local dev seed data still lacks a reusable resumable verify-step onboarding draft and a natural missing-version drift finding for this tenant family; future smoke work will need either richer seed data or the same kind of ephemeral local fixtures.
|
||||||
|
- Shell-level refactors discovered during implementation remain intentionally out of scope.
|
||||||
|
- Monitoring page-state topics discovered during implementation remain intentionally out of scope.
|
||||||
|
- Any future shared-detail framework discussion beyond the two proven families remains intentionally out of scope.
|
||||||
269
specs/197-shared-detail-contract/plan.md
Normal file
269
specs/197-shared-detail-contract/plan.md
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
# Implementation Plan: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
**Branch**: `197-shared-detail-contract` | **Date**: 2026-04-15 | **Spec**: `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/197-shared-detail-contract/spec.md`
|
||||||
|
**Input**: Feature specification from `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/197-shared-detail-contract/spec.md`
|
||||||
|
|
||||||
|
**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/scripts/` for helper scripts.
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Standardize two already real shared detail families without introducing a generic UI framework. The first slice extends the existing verification support seam so `OperationRunResource`, `ManagedTenantOnboardingWizard`, and `TenantVerificationReport` render the same family-owned verification surface with one tab contract, one diagnostics contract, and explicit host-owned variation slots for assist, acknowledge, and host framing. The second slice standardizes normalized settings and normalized diff around family-owned wrappers that make subtype handling, unavailable states, section structure, and view behavior explicit across `PolicyResource`, `PolicyVersionResource`, and `FindingResource`, while preserving the existing Livewire settings table and rich diff rendering where the domain still needs it. The implementation stays derived-only, keeps Filament v5 + Livewire v4 semantics, adds no new assets or persistence, and protects the result with cross-host parity tests plus a small guard against reintroducing ad hoc host forks.
|
||||||
|
|
||||||
|
## Technical Context
|
||||||
|
|
||||||
|
**Language/Version**: PHP 8.4.15
|
||||||
|
**Primary Dependencies**: Laravel 12, Filament v5, Livewire v4, Pest v4, Tailwind CSS v4, existing `VerificationReportViewer`, `VerificationReportChangeIndicator`, `PolicyNormalizer`, `VersionDiff`, `DriftFindingDiffBuilder`, and `SettingsCatalogSettingsTable`
|
||||||
|
**Storage**: PostgreSQL unchanged; no new persistence, cache store, or durable UI artifact
|
||||||
|
**Testing**: Pest 4 unit and feature tests, including Livewire component coverage for widgets/pages and focused guard tests, run through Laravel Sail
|
||||||
|
**Target Platform**: Laravel monolith web application in Sail locally and containerized Linux deployment for staging and production
|
||||||
|
**Project Type**: web application
|
||||||
|
**Performance Goals**: Keep verification viewers DB-only at render time, avoid any new outbound HTTP or queued work, preserve current diff and settings render responsiveness, and prevent repeated host-local surface logic from re-normalizing or re-shaping the same data differently
|
||||||
|
**Constraints**: No new persisted truth, no new Graph call path, no new panel/provider registration change, no hidden shell or monitoring-state refactor, no generic component framework, and no new destructive actions in the shared family core
|
||||||
|
**Scale/Scope**: Two shared families across seven concrete host surfaces: verification in operation detail, onboarding wizard, and tenant widget; normalized settings or diff in policy detail, policy-version detail, and finding detail, plus the existing standard-settings sibling view that must be absorbed or demoted into an explicit subtype
|
||||||
|
|
||||||
|
## Constitution Check
|
||||||
|
|
||||||
|
*GATE: Passed before Phase 0 research. Re-checked after Phase 1 design and still passing.*
|
||||||
|
|
||||||
|
| Principle | Pre-Research | Post-Design | Notes |
|
||||||
|
|-----------|--------------|-------------|-------|
|
||||||
|
| Inventory-first / snapshots-second | PASS | PASS | Both families remain pure renderers of already stored `OperationRun`, policy snapshot, and finding evidence truth. No new snapshot or inventory semantics are added. |
|
||||||
|
| Read/write separation | PASS | PASS | The shared-family contracts are read-only. Existing host actions such as start verification, refresh, assist, or acknowledge remain host-owned and keep their current mutation semantics. |
|
||||||
|
| Graph contract path | N/A | N/A | No Graph calls or `config/graph_contracts.php` changes are introduced. |
|
||||||
|
| Deterministic capabilities | PASS | PASS | No new capability family is introduced. Existing host authorization and capability registries remain authoritative. |
|
||||||
|
| Workspace + tenant isolation | PASS | PASS | Every host continues to resolve data inside existing workspace and tenant scope. Tenantless operation detail remains subject to existing entitlement checks before rendering tenant-owned verification data. |
|
||||||
|
| RBAC-UX authorization semantics | PASS | PASS | No 404/403 rules change. Non-members remain not found, in-scope capability denial stays forbidden where host actions already enforce it. |
|
||||||
|
| Run observability / Ops-UX | PASS | PASS | No new `OperationRun` type, lifecycle, or notification path is added. Existing operation links remain navigation-only. |
|
||||||
|
| Data minimization | PASS | PASS | Contracts stay runtime-only and derive from existing stored payloads without new mirrors or caches. |
|
||||||
|
| Proportionality / no premature abstraction | PASS WITH JUSTIFIED ABSTRACTION | PASS WITH JUSTIFIED ABSTRACTION | One narrow contract seam per family is justified because both families already exist across multiple concrete hosts. The design explicitly rejects a cross-domain shared-detail framework. |
|
||||||
|
| Persisted truth / behavioral state | PASS | PASS | No new tables, persisted UI artifacts, or new state families are introduced. |
|
||||||
|
| UI semantics / few layers | PASS | PASS | The plan replaces duplicated host ownership with family-owned contracts. It does not add a new presenter stack or badge taxonomy. |
|
||||||
|
| Badge semantics (BADGE-001) | PASS | PASS | Existing badge domains remain authoritative. Shared-family work reuses them rather than introducing host-local mappings. |
|
||||||
|
| Filament-native UI / Action Surface Contract | PASS | PASS | Family surfaces remain embedded detail/evidence surfaces inside existing Filament pages and widgets. No new row or bulk action hierarchy is introduced. |
|
||||||
|
| Filament UX-001 | PASS | PASS | The plan changes detail-family ownership only. Existing view-style layouts remain in place and must stay operator-first. |
|
||||||
|
| Filament v5 / Livewire v4 compliance | PASS | PASS | The implementation remains within Filament v5 and Livewire v4 only. No legacy Filament or Livewire v3 APIs are introduced. |
|
||||||
|
| Provider registration location | PASS | PASS | No panel or provider registration change is required. Laravel 11+ provider registration remains in `bootstrap/providers.php`. |
|
||||||
|
| Global search hard rule | PASS | PASS | No global-search behavior changes are planned. The touched resources already render viewable detail pages, so the Filament global-search requirement remains satisfied. |
|
||||||
|
| Destructive action safety | PASS | PASS | No new destructive actions are added inside either shared family. Any host mutation remains outside the family core and keeps existing confirmation and authorization rules. |
|
||||||
|
| Asset strategy | PASS | PASS | No new JS or CSS assets are planned. No `filament:assets` deployment change is required. |
|
||||||
|
| Testing truth (TEST-TRUTH-001) | PASS | PASS | The test plan focuses on cross-host parity, DB-only rendering, unavailable-state consistency, and guard coverage against re-forking, instead of thin indirection-only tests. |
|
||||||
|
|
||||||
|
## Phase 0 Research
|
||||||
|
|
||||||
|
Research outcomes are captured in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/197-shared-detail-contract/research.md`.
|
||||||
|
|
||||||
|
Key decisions:
|
||||||
|
|
||||||
|
- Standardize the Verification Report family by extending the existing `VerificationReportViewer` seam and one family-owned Blade root instead of creating a new Livewire component or a custom entry type that only solves one host class.
|
||||||
|
- Treat onboarding-specific assist and acknowledge behavior as explicit host-owned variation slots of the verification family rather than a parallel report UI.
|
||||||
|
- Converge `normalized-settings.blade.php` and `policy-settings-standard.blade.php` under one family-owned settings wrapper with explicit subtypes, instead of continuing host-level view switching.
|
||||||
|
- Move normalized diff unavailable and partial-state behavior into the family contract so `FindingResource` and `PolicyVersionResource` stop expressing different availability semantics for the same concept.
|
||||||
|
- Keep `SettingsCatalogSettingsTable` as the existing Livewire subtype used by the settings family, since it already provides search, sort, pagination, and context-safe query-string isolation.
|
||||||
|
- Protect the family contracts with parity tests and a small fork guard, not with a generic UI meta-framework or a screenshot-heavy suite.
|
||||||
|
|
||||||
|
## Phase 1 Design
|
||||||
|
|
||||||
|
Design artifacts are created under `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/197-shared-detail-contract/`:
|
||||||
|
|
||||||
|
- `data-model.md`: runtime contracts, host variation model, and source-truth boundaries for both shared families
|
||||||
|
- `contracts/verification-report-family.openapi.yaml`: internal logical contract for the verification family and its approved hosts
|
||||||
|
- `contracts/normalized-detail-family.openapi.yaml`: internal logical contract for normalized settings and normalized diff families and their approved hosts
|
||||||
|
- `quickstart.md`: focused implementation, verification, and smoke workflow
|
||||||
|
|
||||||
|
Release-acceptance artifact maintained during implementation:
|
||||||
|
|
||||||
|
- `migration-note.md`: closing migrated-host inventory, bounded allowed variations, manual smoke evidence, and out-of-scope follow-ups required for release acceptance
|
||||||
|
|
||||||
|
Design decisions:
|
||||||
|
|
||||||
|
- Extend the existing `VerificationReportViewer` support seam instead of replacing it.
|
||||||
|
- Add narrow normalized-detail support builders under existing Filament support paths rather than creating a new base framework.
|
||||||
|
- Keep subtype richness for settings catalog tables, standard key-value settings, script content rendering, and diff block rendering, but move wrapper ownership and unavailable-state ownership into one family contract.
|
||||||
|
- Keep host no-run and in-progress framing local where the host genuinely owns that state, while making the completed or unavailable family core the same surface everywhere.
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
### Documentation (this feature)
|
||||||
|
|
||||||
|
```text
|
||||||
|
specs/197-shared-detail-contract/
|
||||||
|
├── spec.md
|
||||||
|
├── plan.md
|
||||||
|
├── research.md
|
||||||
|
├── data-model.md
|
||||||
|
├── migration-note.md
|
||||||
|
├── quickstart.md
|
||||||
|
├── contracts/
|
||||||
|
│ ├── normalized-detail-family.openapi.yaml
|
||||||
|
│ └── verification-report-family.openapi.yaml
|
||||||
|
├── checklists/
|
||||||
|
│ └── requirements.md
|
||||||
|
└── tasks.md
|
||||||
|
```
|
||||||
|
|
||||||
|
### Source Code (repository root)
|
||||||
|
|
||||||
|
```text
|
||||||
|
apps/platform/
|
||||||
|
├── app/
|
||||||
|
│ ├── Filament/
|
||||||
|
│ │ ├── Pages/
|
||||||
|
│ │ │ └── Workspaces/
|
||||||
|
│ │ │ └── ManagedTenantOnboardingWizard.php
|
||||||
|
│ │ ├── Resources/
|
||||||
|
│ │ │ ├── FindingResource.php
|
||||||
|
│ │ │ ├── OperationRunResource.php
|
||||||
|
│ │ │ ├── PolicyResource.php
|
||||||
|
│ │ │ └── PolicyVersionResource.php
|
||||||
|
│ │ ├── Support/
|
||||||
|
│ │ │ ├── VerificationReportChangeIndicator.php
|
||||||
|
│ │ │ ├── VerificationReportViewer.php
|
||||||
|
│ │ │ ├── NormalizedSettingsSurface.php
|
||||||
|
│ │ │ └── NormalizedDiffSurface.php
|
||||||
|
│ │ └── Widgets/
|
||||||
|
│ │ └── Tenant/
|
||||||
|
│ │ └── TenantVerificationReport.php
|
||||||
|
│ └── Livewire/
|
||||||
|
│ └── SettingsCatalogSettingsTable.php
|
||||||
|
├── resources/
|
||||||
|
│ └── views/
|
||||||
|
│ └── filament/
|
||||||
|
│ ├── components/
|
||||||
|
│ │ ├── verification-report-viewer.blade.php
|
||||||
|
│ │ └── verification-report/
|
||||||
|
│ ├── forms/
|
||||||
|
│ │ └── components/
|
||||||
|
│ │ └── managed-tenant-onboarding-verification-report.blade.php
|
||||||
|
│ ├── infolists/
|
||||||
|
│ │ └── entries/
|
||||||
|
│ │ ├── normalized-diff.blade.php
|
||||||
|
│ │ ├── normalized-settings.blade.php
|
||||||
|
│ │ └── policy-settings-standard.blade.php
|
||||||
|
│ └── widgets/
|
||||||
|
│ └── tenant/
|
||||||
|
│ └── tenant-verification-report.blade.php
|
||||||
|
└── tests/
|
||||||
|
├── Feature/
|
||||||
|
│ ├── Drift/
|
||||||
|
│ ├── Filament/
|
||||||
|
│ ├── Onboarding/
|
||||||
|
│ ├── Verification/
|
||||||
|
│ └── Guards/
|
||||||
|
└── Unit/
|
||||||
|
```
|
||||||
|
|
||||||
|
**Structure Decision**: Keep the existing Laravel monolith layout and current Filament resource/widget/view directories. Add only narrow support builders under `app/Filament/Support` and family-owned partials under existing `resources/views/filament/...` paths. Do not add a new shared UI framework directory or new base package.
|
||||||
|
|
||||||
|
## Implementation Strategy
|
||||||
|
|
||||||
|
### Phase A — Cut the Verification Report Family Contract
|
||||||
|
|
||||||
|
**Goal**: Make one family-owned verification surface the semantic owner of completed and unavailable report rendering across the covered hosts.
|
||||||
|
|
||||||
|
| Step | File | Change |
|
||||||
|
|------|------|--------|
|
||||||
|
| A.1 | `apps/platform/app/Filament/Support/VerificationReportViewer.php` | Extend the existing seam so it can build the shared verification surface contract, not only extract sanitized report payloads. |
|
||||||
|
| A.2 | `apps/platform/resources/views/filament/components/verification-report-viewer.blade.php` and new family-owned partials under `apps/platform/resources/views/filament/components/verification-report/` | Move summary, issues, passed, diagnostics, and optional action-zone ownership into one shared Blade root with one tab or view contract. |
|
||||||
|
| A.3 | `apps/platform/resources/views/filament/forms/components/managed-tenant-onboarding-verification-report.blade.php` | Remove local verification-family tab ownership and local structural duplication; render the same family core with explicit onboarding-only variation slots for assist, acknowledge, and technical details. |
|
||||||
|
| A.4 | `apps/platform/app/Filament/Pages/Workspaces/ManagedTenantOnboardingWizard.php`, `apps/platform/app/Filament/Resources/OperationRunResource.php`, `apps/platform/app/Filament/Widgets/Tenant/TenantVerificationReport.php`, and `apps/platform/resources/views/filament/widgets/tenant/tenant-verification-report.blade.php` | Pass only explicit host context and host-owned actions into the verification family contract while keeping no-run or in-progress framing local where appropriate. |
|
||||||
|
|
||||||
|
### Phase B — Standardize the Normalized Settings Family
|
||||||
|
|
||||||
|
**Goal**: Make one family-owned settings wrapper the contract owner for warnings, empty state, subtype selection, and section behavior.
|
||||||
|
|
||||||
|
| Step | File | Change |
|
||||||
|
|------|------|--------|
|
||||||
|
| B.1 | `apps/platform/app/Filament/Support/NormalizedSettingsSurface.php` | Add a narrow runtime builder that shapes normalized settings state into one explicit family contract with subtype markers and render expectations. |
|
||||||
|
| B.2 | `apps/platform/resources/views/filament/infolists/entries/normalized-settings.blade.php` and subtype partials under `apps/platform/resources/views/filament/infolists/entries/normalized-settings/` | Own warnings, empty-state behavior, wrapper headings, and subtype delegation inside one family surface instead of splitting ownership between sibling host-selected blades. |
|
||||||
|
| B.3 | `apps/platform/resources/views/filament/infolists/entries/policy-settings-standard.blade.php` | Absorb this blade into the normalized-settings family as an internal subtype partial or retire it as a direct host-facing sibling view. |
|
||||||
|
| B.4 | `apps/platform/app/Filament/Resources/PolicyResource.php` and `apps/platform/app/Filament/Resources/PolicyVersionResource.php` | Stop choosing between sibling settings views at the host level and always pass family contract state to the normalized settings surface. |
|
||||||
|
| B.5 | `apps/platform/app/Livewire/SettingsCatalogSettingsTable.php` | Keep the existing table component as the settings-catalog subtype renderer while ensuring the shared family contract owns when and how it is shown. |
|
||||||
|
|
||||||
|
### Phase C — Standardize the Normalized Diff Family
|
||||||
|
|
||||||
|
**Goal**: Make one family-owned diff wrapper the contract owner for summary, unavailable state, zero-diff messaging, and grouped detail rendering.
|
||||||
|
|
||||||
|
| Step | File | Change |
|
||||||
|
|------|------|--------|
|
||||||
|
| C.1 | `apps/platform/app/Filament/Support/NormalizedDiffSurface.php` | Add a narrow runtime builder that shapes diff state, availability state, and zero-change semantics into one explicit family contract. |
|
||||||
|
| C.2 | `apps/platform/resources/views/filament/infolists/entries/normalized-diff.blade.php` and family-owned partials under `apps/platform/resources/views/filament/infolists/entries/normalized-diff/` | Move unavailable, partial, summary, and grouped-render ownership into the shared diff family. Preserve script highlighting and grouped row rendering as explicit subzones of that family. |
|
||||||
|
| C.3 | `apps/platform/app/Filament/Resources/FindingResource.php` | Replace host-owned diff-unavailable `TextEntry` behavior with family-owned unavailable state input so drift detail uses the same contract as other normalized diff hosts. |
|
||||||
|
| C.4 | `apps/platform/app/Filament/Resources/PolicyVersionResource.php` | Route normalized diff state through the shared diff builder so policy-version diff and finding diff expose the same family semantics for available and unavailable paths. |
|
||||||
|
|
||||||
|
### Phase D — Protect the Family Boundaries
|
||||||
|
|
||||||
|
**Goal**: Make future host changes extend the family contracts instead of silently re-forking them.
|
||||||
|
|
||||||
|
| Step | File | Change |
|
||||||
|
|------|------|--------|
|
||||||
|
| D.1 | `apps/platform/tests/Feature/Guards/SharedDetailFamilyContractGuardTest.php` | Add a focused guard that blocks new ad hoc host forks, such as host-selected `policy-settings-standard` references or duplicated verification-family tab ownership outside the shared core. |
|
||||||
|
| D.2 | `apps/platform/tests/Feature/Filament/SharedVerificationReportFamilyContractTest.php` and `apps/platform/tests/Feature/Filament/NormalizedDetailFamilyContractTest.php` | Add cross-host parity tests that assert the same family zones, unavailable semantics, and allowed host-variation boundaries. |
|
||||||
|
| D.3 | `apps/platform/tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php`, `apps/platform/tests/Feature/Filament/TenantVerificationReportWidgetTest.php`, `apps/platform/tests/Feature/Onboarding/OnboardingVerificationTest.php`, `apps/platform/tests/Feature/Onboarding/OnboardingVerificationV1_5UxTest.php`, `apps/platform/tests/Feature/MonitoringOperationsTest.php`, `apps/platform/tests/Feature/Spec085/DenyAsNotFoundSemanticsTest.php`, `apps/platform/tests/Feature/Onboarding/OnboardingDraftAccessTest.php`, `apps/platform/tests/Feature/Filament/PolicyVersionSettingsTest.php`, `apps/platform/tests/Feature/Filament/SettingsCatalogPolicyNormalizedDiffTest.php`, `apps/platform/tests/Feature/Filament/GroupPolicyConfigurationNormalizedDiffTest.php`, `apps/platform/tests/Feature/Drift/DriftFindingDiffUnavailableTest.php`, `apps/platform/tests/Feature/Filament/PolicyResourceAdminTenantParityTest.php`, `apps/platform/tests/Feature/Filament/PolicyVersionAdminTenantParityTest.php`, and `apps/platform/tests/Feature/Findings/FindingRbacTest.php` | Extend existing feature coverage so it asserts the new family contracts without losing current DB-only, RBAC-safe, deny-as-not-found, capability-safe, and domain-rich behavior. |
|
||||||
|
|
||||||
|
### Phase E — Close the Migration and Verify Operator Sameness
|
||||||
|
|
||||||
|
**Goal**: Finish the feature with an explicit migrated-host inventory and a manual smoke path that matches the spec’s acceptance model.
|
||||||
|
|
||||||
|
| Step | File | Change |
|
||||||
|
|------|------|--------|
|
||||||
|
| E.1 | `specs/197-shared-detail-contract/tasks.md` | Break implementation into dependency-ordered tasks across verification family, normalized settings family, normalized diff family, tests, and migration notes. |
|
||||||
|
| E.2 | `specs/197-shared-detail-contract/migration-note.md` | Record migrated hosts, consciously allowed remaining variations, smoke-review evidence, and out-of-scope follow-ups required by release acceptance. |
|
||||||
|
| E.3 | `specs/197-shared-detail-contract/quickstart.md` | Use the verification order and smoke path below to prove operator sameness across hosts and feed the result into the migration note. |
|
||||||
|
|
||||||
|
## Key Design Decisions
|
||||||
|
|
||||||
|
### D-001 — Verification Report remains one Blade-rooted family because its hosts are heterogeneous
|
||||||
|
|
||||||
|
The verification family already spans an infolist-style detail section, a form `ViewField`, and a widget include. A new custom infolist entry or a new Livewire component would only solve one host class and would risk over-abstracting the rest. The narrowest path is to extend the existing `VerificationReportViewer` seam and let one family-owned Blade root own structure.
|
||||||
|
|
||||||
|
### D-002 — Onboarding keeps host-owned actions but loses structural ownership
|
||||||
|
|
||||||
|
The onboarding wizard legitimately owns verify-step actions, assist routing, and acknowledge mutations. It does not need to own the report’s tab system or its core diagnostics structure. The plan therefore keeps these actions as explicit host slots, not as a second verification UI.
|
||||||
|
|
||||||
|
### D-003 — `policy-settings-standard` becomes a subtype, not a peer family
|
||||||
|
|
||||||
|
The repo already exposes two sibling settings surfaces for the same conceptual family. The plan explicitly keeps settings-catalog and standard-settings richness, but moves them under one family wrapper so hosts stop selecting unrelated siblings at the top level.
|
||||||
|
|
||||||
|
### D-004 — Unavailable-state ownership belongs inside normalized diff
|
||||||
|
|
||||||
|
`FindingResource` currently owns unavailable messaging outside the diff family, while other diff hosts do not. The family contract should own availability, partial-state, and zero-diff semantics so the same content concept cannot drift at the host boundary.
|
||||||
|
|
||||||
|
### D-005 — The test strategy protects family sameness, not only helper output
|
||||||
|
|
||||||
|
The plan prefers cross-host parity tests, DB-only safety tests, and one small fork guard. It explicitly avoids a new UI meta-test framework or broad screenshot infrastructure because the product need is bounded and already well represented by existing feature tests.
|
||||||
|
|
||||||
|
## Risk Assessment
|
||||||
|
|
||||||
|
| Risk | Impact | Likelihood | Mitigation |
|
||||||
|
|------|--------|------------|------------|
|
||||||
|
| Verification onboarding loses assist or acknowledge power while removing its fork | High | Medium | Keep assist and acknowledge as host-owned variation slots and extend onboarding tests before removing duplicated structural markup. |
|
||||||
|
| Standardizing settings removes useful subtype richness | High | Medium | Keep explicit subtypes for settings-catalog tables, standard blocks, and script-heavy content; standardize the wrapper, not the domain richness away. |
|
||||||
|
| Diff unavailable semantics collapse distinct host cases | Medium | Medium | Make unavailable and partial states explicit contract inputs and cover missing-version and empty-side finding scenarios in feature tests. |
|
||||||
|
| The feature grows into a generic shared-detail framework | High | Low | Limit support additions to one existing verification seam plus one settings builder and one diff builder under current Filament support paths. No cross-domain base class or registry is introduced. |
|
||||||
|
| New hosts later reintroduce ad hoc forks | Medium | Medium | Add one focused fork guard and internal contract YAMLs that document approved consumers and forbidden host-level patterns. |
|
||||||
|
|
||||||
|
## Test Strategy
|
||||||
|
|
||||||
|
- Extend verification-family feature coverage so `OperationRunResource`, onboarding verification, and the tenant verification widget all assert the same family-owned summary, issues, passed, diagnostics, and unavailable semantics for equivalent report data.
|
||||||
|
- Keep `VerificationReportViewerDbOnlyTest` and `TenantVerificationReportWidgetTest` as truth guards that the standardized family remains DB-only and does not introduce outbound work.
|
||||||
|
- Extend onboarding verification tests to prove host-specific assist and acknowledge actions survive as bounded variations of the same family.
|
||||||
|
- Extend normalized settings and diff coverage in `PolicyVersionSettingsTest`, `SettingsCatalogPolicyNormalizedDiffTest`, `GroupPolicyConfigurationNormalizedDiffTest`, and `DriftFindingDiffUnavailableTest` so they assert family-level structure and unavailable behavior instead of only content presence.
|
||||||
|
- Add one new parity test per family and one focused guard test that blocks direct host fork patterns.
|
||||||
|
- Use Livewire component tests for widgets and pages, and do not try to mount non-Livewire resource classes directly. This follows Filament v5 testing guidance.
|
||||||
|
- Run the smallest Sail verification pack plus `pint --dirty --format agent` before implementation completion.
|
||||||
|
|
||||||
|
## Complexity Tracking
|
||||||
|
|
||||||
|
| Violation | Why Needed | Simpler Alternative Rejected Because |
|
||||||
|
|-----------|------------|-------------------------------------|
|
||||||
|
| One new normalized-settings builder and one new normalized-diff builder | The repo already has multiple concrete hosts for each family, but no existing support seam analogous to `VerificationReportViewer` for normalized detail families | Leaving host files to shape state ad hoc would preserve the exact drift this spec is meant to remove |
|
||||||
|
| One focused fork guard | The feature’s long-term value depends on preventing new host forks after the first cleanup | Relying only on reviewer memory or prose documentation would not reliably stop drift from returning |
|
||||||
|
|
||||||
|
## Proportionality Review
|
||||||
|
|
||||||
|
- **Current operator problem**: Operators encounter the same verification or normalized detail concept in multiple hosts, but the structure, next-step zone, diagnostics placement, and unavailable behavior vary enough to slow recognition and trust.
|
||||||
|
- **Existing structure is insufficient because**: Shared Blade reuse exists, but shared contract ownership does not. Hosts still decide core structure and availability semantics themselves, which is why drift already exists.
|
||||||
|
- **Narrowest correct implementation**: Extend the existing verification support seam, add two narrow normalized-detail support builders, and move family wrapper ownership into current Blade paths. Do not add persistence, a new framework, or a cross-domain taxonomy.
|
||||||
|
- **Ownership cost created**: Three narrow support seams in current Filament support paths, a handful of family-owned partials, two internal contract YAMLs, and focused parity or guard tests.
|
||||||
|
- **Alternative intentionally rejected**: Continue local host cleanups or invent a full shared-detail framework. Local cleanup would not stop drift, and a framework would import much more permanent complexity than this feature needs.
|
||||||
|
- **Release truth**: Current-release truth. The affected families and host drift already exist in shipped operator surfaces.
|
||||||
110
specs/197-shared-detail-contract/quickstart.md
Normal file
110
specs/197-shared-detail-contract/quickstart.md
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
# Quickstart: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
## Goal
|
||||||
|
|
||||||
|
Validate that the same verification and normalized detail concepts now render through family-owned contracts across their covered hosts, without adding persistence, Graph calls, or a generic UI framework.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
1. Start Sail.
|
||||||
|
2. Ensure you have a tenant with at least one completed verification run and one onboarding session that can resume on the verify step.
|
||||||
|
3. Ensure you have policy and policy-version data that exercises both settings-catalog and standard-settings rendering.
|
||||||
|
4. Ensure you have at least one drift finding with an available normalized diff and one drift finding with missing version references.
|
||||||
|
5. Ensure the current user can open the covered hosts in tenant and workspace-safe contexts.
|
||||||
|
|
||||||
|
## Implementation Validation Order
|
||||||
|
|
||||||
|
### 1. Run verification-family regression coverage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="/bin:/usr/bin:/usr/local/bin:$PATH"
|
||||||
|
cd /Users/ahmeddarrazi/Documents/projects/TenantAtlas/apps/platform
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantVerificationReportWidgetTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Onboarding/OnboardingVerificationTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Onboarding/OnboardingVerificationV1_5UxTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/MonitoringOperationsTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Spec085/DenyAsNotFoundSemanticsTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Onboarding/OnboardingDraftAccessTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact --filter=SharedVerificationReportFamilyContract
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected outcome:
|
||||||
|
|
||||||
|
- Operation detail, onboarding, and tenant widget all expose the same verification-family core.
|
||||||
|
- Verification rendering stays DB-only and does not dispatch outbound work.
|
||||||
|
- Onboarding-only assist and acknowledge actions remain available as bounded host variations.
|
||||||
|
- Workspace-context and tenant-context verification hosts keep deny-as-not-found and capability-safe behavior after the shared viewer refactor.
|
||||||
|
|
||||||
|
### 2. Run normalized detail-family regression coverage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="/bin:/usr/bin:/usr/local/bin:$PATH"
|
||||||
|
cd /Users/ahmeddarrazi/Documents/projects/TenantAtlas/apps/platform
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Filament/PolicyVersionSettingsTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Filament/SettingsCatalogPolicyNormalizedDiffTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Filament/GroupPolicyConfigurationNormalizedDiffTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Drift/DriftFindingDiffUnavailableTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Filament/PolicyResourceAdminTenantParityTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Filament/PolicyVersionAdminTenantParityTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Findings/FindingRbacTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact --filter=NormalizedDetailFamilyContract
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected outcome:
|
||||||
|
|
||||||
|
- Policy and policy-version settings use the same family-owned wrapper with explicit subtype behavior.
|
||||||
|
- Policy-version diff and finding diff use the same normalized diff family semantics for available, unavailable, and zero-diff cases.
|
||||||
|
- No host still relies on a sibling top-level settings view or a host-only diff unavailable message for the same concept.
|
||||||
|
- Tenant-scoped policy, policy-version, and finding detail hosts preserve existing deny-as-not-found and capability semantics.
|
||||||
|
|
||||||
|
### 3. Run the fork guard and targeted parity checks
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="/bin:/usr/bin:/usr/local/bin:$PATH"
|
||||||
|
cd /Users/ahmeddarrazi/Documents/projects/TenantAtlas/apps/platform
|
||||||
|
./vendor/bin/sail artisan test --compact tests/Feature/Guards/SharedDetailFamilyContractGuardTest.php
|
||||||
|
./vendor/bin/sail artisan test --compact --filter=FamilyContract
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected outcome:
|
||||||
|
|
||||||
|
- Guard coverage blocks reintroduction of direct host forks.
|
||||||
|
- Parity tests prove the same family zones and the same unavailable-state semantics across hosts.
|
||||||
|
|
||||||
|
### 4. Format touched files
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="/bin:/usr/bin:/usr/local/bin:$PATH"
|
||||||
|
cd /Users/ahmeddarrazi/Documents/projects/TenantAtlas/apps/platform
|
||||||
|
./vendor/bin/sail bin pint --dirty --format agent
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected outcome:
|
||||||
|
|
||||||
|
- All touched PHP files conform to the repo’s Pint rules.
|
||||||
|
|
||||||
|
## Manual Smoke Check
|
||||||
|
|
||||||
|
1. Open the operation run detail that shows a verification report and confirm you can immediately identify summary, issues, passed, and technical details zones.
|
||||||
|
2. Open the onboarding wizard verify step for the same or equivalent verification payload and confirm the same core verification surface appears, with onboarding-only assist or acknowledge behavior layered on top instead of a different tab model.
|
||||||
|
3. Open the tenant verification widget and confirm the completed-state core matches the other verification hosts while no-run and in-progress framing stays widget-specific.
|
||||||
|
4. Open a policy-version detail view and a policy detail view that both show normalized settings and confirm warnings, empty-state behavior, and subtype structure feel like one family.
|
||||||
|
5. Open a policy-version detail view that shows normalized diff and confirm summary, grouped sections, and availability messaging match the same shared diff-family contract used elsewhere.
|
||||||
|
6. Open a drift finding with missing referenced versions and confirm the diff area uses a family-consistent unavailable state.
|
||||||
|
7. Open a drift finding with an available normalized diff and confirm the grouped diff surface feels like the same family as policy-version diff, not a new host-specific micro-app.
|
||||||
|
|
||||||
|
## Release Acceptance Recording
|
||||||
|
|
||||||
|
1. Update `specs/197-shared-detail-contract/migration-note.md` with the migrated hosts actually touched by the implementation.
|
||||||
|
2. Record the consciously allowed remaining variations that still differ by host.
|
||||||
|
3. Capture reviewer, review date, and pass or fail notes for SC-197-003 and SC-197-004 in the migration note.
|
||||||
|
4. Record any shell, monitoring-state, or other intentionally out-of-scope follow-ups in the migration note instead of expanding this feature silently.
|
||||||
|
|
||||||
|
## Non-Goals For This Slice
|
||||||
|
|
||||||
|
- No database migration.
|
||||||
|
- No new public API.
|
||||||
|
- No new Graph call path or `OperationRun` lifecycle change.
|
||||||
|
- No new Filament asset registration or `filament:assets` deployment change.
|
||||||
|
- No shell, workspace context bar, or monitoring page-state refactor.
|
||||||
74
specs/197-shared-detail-contract/research.md
Normal file
74
specs/197-shared-detail-contract/research.md
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# Phase 0 Research: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
## Research Inputs
|
||||||
|
|
||||||
|
- Repository truth from current hosts and tests for `verification-report-viewer`, onboarding verification, tenant verification widget, `normalized-settings`, `policy-settings-standard`, and `normalized-diff`
|
||||||
|
- Filament v5 notes in `docs/research/filament-v5-notes.md`
|
||||||
|
- Version-specific Filament documentation for custom fields, custom infolist entries, render hooks, and testing
|
||||||
|
|
||||||
|
## Decision 1 — Verification Report should stay Blade-rooted and support-backed
|
||||||
|
|
||||||
|
**Decision**: Standardize the Verification Report family by extending the existing `VerificationReportViewer` support seam and one shared Blade root, instead of introducing a new Livewire component or a custom Filament entry class.
|
||||||
|
|
||||||
|
**Rationale**: The family already spans three host classes: an infolist-style run detail, a form `ViewField` inside onboarding, and a widget include. Filament custom entries are reusable, but they are still infolist-specific. Filament custom fields are form-specific. A new Livewire component would impose a heavier lifecycle and more new surface area than this feature needs. The existing support seam already owns report extraction, fingerprinting, and previous-run lookup, which is the right narrow base.
|
||||||
|
|
||||||
|
**Alternatives considered**:
|
||||||
|
|
||||||
|
- Create a custom infolist entry for verification: rejected because onboarding and widget hosts would still need separate structural ownership.
|
||||||
|
- Create a dedicated Livewire verification viewer: rejected because it imports new lifecycle complexity for a mostly read-only, DB-only surface.
|
||||||
|
- Keep the onboarding fork and only restyle it: rejected because the drift is structural, not cosmetic.
|
||||||
|
|
||||||
|
## Decision 2 — Onboarding-specific assist and acknowledge behavior must remain host-owned slots
|
||||||
|
|
||||||
|
**Decision**: Treat assist, acknowledge, refresh, and technical-details triggers in onboarding as explicit host-owned variations of the verification family, not as a second verification UI contract.
|
||||||
|
|
||||||
|
**Rationale**: The onboarding wizard legitimately owns interactive workflow actions and different no-run or in-progress framing. The shared family should own summary, tabs or view zones, issues, passed checks, diagnostics, and unavailable behavior. This respects the spec’s rule that hosts may extend actions and placement without redefining the family core.
|
||||||
|
|
||||||
|
**Alternatives considered**:
|
||||||
|
|
||||||
|
- Move assist and acknowledge logic into the shared core: rejected because those actions are wizard-specific and would leak workflow behavior into unrelated hosts.
|
||||||
|
- Leave onboarding fully separate: rejected because it preserves the existing duplicate tab contract and duplicated grouping logic.
|
||||||
|
|
||||||
|
## Decision 3 — Normalized settings must converge under one family wrapper with explicit subtypes
|
||||||
|
|
||||||
|
**Decision**: Standardize normalized settings through one family-owned wrapper that explicitly supports at least two subtypes: settings-catalog table rendering and standard block or key-value rendering.
|
||||||
|
|
||||||
|
**Rationale**: `PolicyResource` and `PolicyVersionResource` currently choose between `normalized-settings` and `policy-settings-standard` at the host level. That means the host, not the family, owns warnings, wrapper titles, empty state, and subtype selection. The repo already proves the two subtypes are real. The narrowest fix is not to flatten them, but to put both behind one family wrapper.
|
||||||
|
|
||||||
|
**Alternatives considered**:
|
||||||
|
|
||||||
|
- Keep both views and only document when to use each: rejected because the host-level fork remains the same.
|
||||||
|
- Force every settings subtype into one totally uniform table: rejected because the domain richness and script-oriented rendering would be weakened.
|
||||||
|
|
||||||
|
## Decision 4 — Normalized diff must own unavailable and partial-state semantics
|
||||||
|
|
||||||
|
**Decision**: Move unavailable, partial, and zero-diff behavior into the normalized diff family contract instead of leaving those semantics to individual hosts.
|
||||||
|
|
||||||
|
**Rationale**: `FindingResource` currently shows a host-owned unavailable text entry before the shared diff view, while `PolicyVersionResource` simply renders the diff view. This is the clearest current evidence that the same content concept does not yet own its own availability rules. The family should own these states so equivalent cases feel consistent across hosts.
|
||||||
|
|
||||||
|
**Alternatives considered**:
|
||||||
|
|
||||||
|
- Keep host-owned unavailable messages and only align wording: rejected because ownership would still be split.
|
||||||
|
- Force all hosts to pre-normalize everything into “available only” and hide gaps: rejected because it would reduce diagnostic honesty.
|
||||||
|
|
||||||
|
## Decision 5 — The existing Livewire settings table remains the settings-catalog subtype renderer
|
||||||
|
|
||||||
|
**Decision**: Keep `SettingsCatalogSettingsTable` as the renderer for the settings-catalog subtype inside the normalized settings family.
|
||||||
|
|
||||||
|
**Rationale**: The table already provides search, sort, pagination, query-string isolation by context, and a details action. Replacing it would add risk and produce little user benefit. The problem is not that the table exists; the problem is that the host, rather than the family, currently decides when the table belongs to the surface.
|
||||||
|
|
||||||
|
**Alternatives considered**:
|
||||||
|
|
||||||
|
- Replace the table with static Blade markup: rejected because it would lose established usability and re-implement behavior already present.
|
||||||
|
- Split settings-catalog into its own separate family: rejected because the operator still experiences it as a settings detail subtype, not a separate product surface.
|
||||||
|
|
||||||
|
## Decision 6 — Testing should prove cross-host sameness and DB-only behavior, then add a small fork guard
|
||||||
|
|
||||||
|
**Decision**: Reuse and extend the current feature tests for widgets, onboarding, verification DB-only behavior, policy-version settings, and finding diffs, then add one parity test per family and one focused guard against re-forking.
|
||||||
|
|
||||||
|
**Rationale**: The repo already has strong tests around verification and normalized detail content. The missing coverage is family-level sameness across hosts and explicit protection against new host forks. A small guard gives lasting value without forcing a generic UI compliance framework.
|
||||||
|
|
||||||
|
**Alternatives considered**:
|
||||||
|
|
||||||
|
- Rely only on manual smoke checks: rejected because the spec explicitly wants drift prevention.
|
||||||
|
- Add a large screenshot or browser-regression suite: rejected because it would be expensive relative to the bounded scope and existing feature-level coverage.
|
||||||
245
specs/197-shared-detail-contract/spec.md
Normal file
245
specs/197-shared-detail-contract/spec.md
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
# Feature Specification: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
**Feature Branch**: `197-shared-detail-contract`
|
||||||
|
**Created**: 2026-04-15
|
||||||
|
**Status**: Proposed
|
||||||
|
**Input**: User description: "Spec 197 — Shared Detail Micro-UI Contract"
|
||||||
|
|
||||||
|
## Spec Candidate Check *(mandatory — SPEC-GATE-001)*
|
||||||
|
|
||||||
|
- **Problem**: Wiederverwendete Detail-Micro-UIs für dieselben fachlichen Objekte leben heute als leicht unterschiedliche Host-Varianten, sodass Operatoren dieselbe Surface je nach Host neu lesen und neu erlernen müssen.
|
||||||
|
- **Today's failure**: Dieselbe fachliche Surface zeigt je nach Host andere Tabs, anders platzierte Next Steps, anders platzierte technische Details oder lokale Zusatzlogik. Dadurch entstehen inkonsistente Operator-Erwartungen, Drift bei Weiterentwicklungen und unnötiger Test- sowie Pflegeaufwand.
|
||||||
|
- **User-visible improvement**: Operatoren erleben dieselbe Verification-Report- oder Diff-/Settings-Surface hostübergreifend als dieselbe fachliche Surface mit denselben Kernzonen, denselben erwartbaren Interaktionsmustern und klar begrenzten Host-Unterschieden.
|
||||||
|
- **Smallest enterprise-capable version**: Nur zwei bereits real belegte Shared-Familien werden standardisiert: die Verification-Report-Familie sowie die Normalized Diff / Normalized Settings-Familie. Der Spec führt keinen generischen UI-Baukasten ein und modelliert keine weiteren Custom-Surfaces ohne nachgewiesene Familienwiederholung.
|
||||||
|
- **Explicit non-goals**: Kein Shell- oder Monitoring-Page-State-Refactor, keine Vereinheitlichung aller Custom-Detailansichten, kein generisches internes Komponenten-Framework, keine Table-/CRUD-/Badge-Konsistenzkampagne außerhalb der belegten Shared-Familien.
|
||||||
|
- **Permanent complexity imported**: Zwei explizite Shared-Family-Verträge, dokumentierte Pflicht-/Optional-/Host-Zonen, begrenzte Host-Variationsregeln, family-orientierte Regressionsabdeckung, eine kleine Abschlussdokumentation zu migrierten Hosts und erlaubten Restvarianten.
|
||||||
|
- **Why now**: Beide Familien sind bereits in mehreren Hosts sichtbar und zeigen belegte Drift. Jeder weitere Host erhöht die Wahrscheinlichkeit, dass dieselbe Surface erneut als lokale Mini-App eingebaut wird.
|
||||||
|
- **Why not local**: Lokale Bereinigungen pro Host beseitigen die Wiederholung nicht. Das Problem liegt in fehlendem gemeinsamen Vertrag für dieselbe Surface-Familie, nicht in einem einzelnen Host.
|
||||||
|
- **Approval class**: Cleanup
|
||||||
|
- **Red flags triggered**: Eine rote Flagge: Shared-Cross-Surface-Contract kann in ein zu breites UI-Framework kippen, wenn der Scope über die zwei belegten Familien hinaus wächst.
|
||||||
|
- **Score**: Nutzen: 2 | Dringlichkeit: 2 | Scope: 2 | Komplexität: 1 | Produktnähe: 2 | Wiederverwendung: 2 | **Gesamt: 11/12**
|
||||||
|
- **Decision**: approve
|
||||||
|
|
||||||
|
## Spec Scope Fields *(mandatory)*
|
||||||
|
|
||||||
|
- **Scope**: canonical-view
|
||||||
|
- **Primary Routes**:
|
||||||
|
- Monitoring- beziehungsweise Operations-Detailflächen, die Verification Reports als eingebettete Detail-Surface zeigen
|
||||||
|
- Tenant-onboarding- und tenantbezogene Verifikationsflächen, die denselben Verification Report in Wizard-, Widget- oder Inline-Kontext rendern
|
||||||
|
- Tenantbezogene Policy-, Policy-Version- und Finding-Detailflächen, die Normalized Settings oder Normalized Diff als Detail-Surface zeigen
|
||||||
|
- **Data Ownership**:
|
||||||
|
- Tenant-owned: verifikationsbezogene Detaildaten, Policy-, Policy-Version- und Finding-Daten, die innerhalb der Shared-Familien dargestellt werden
|
||||||
|
- Workspace-context / canonical-view owned: die hostseitige Einbettung in kanonische Monitoring- oder Operations-Detailflächen
|
||||||
|
- Dieser Spec führt keine neue persistierte UI- oder Vertrags-Entität ein; die Shared-Family-Verträge bleiben rein darstellungs- und verhaltensbezogen
|
||||||
|
- **RBAC**:
|
||||||
|
- Bestehende Workspace-Mitgliedschaft und Tenant-Entitlement bleiben die Zugangsvoraussetzung für alle Hosts, die diese Shared-Familien rendern
|
||||||
|
- Bestehende View-/Inspect-Berechtigungen der Hosts bleiben maßgeblich; der Spec führt keine neue Capability und keinen neuen Autorisierungsweg ein
|
||||||
|
- Host-spezifische Aktionen innerhalb oder neben der Shared-Family bleiben weiter an die bereits vorhandenen Capability-Regeln des Hosts gebunden
|
||||||
|
|
||||||
|
For canonical-view specs, the spec MUST define:
|
||||||
|
|
||||||
|
- **Default filter behavior when tenant-context is active**: Wenn Tenant-Kontext aktiv ist, rendern Shared-Familien ausschließlich Daten aus dem aktuell aktiven Tenant-Kontext des Hosts. Ein Host darf keine Shared-Family tenantübergreifend oder tenantlos auf tenant-owned Daten erweitern.
|
||||||
|
- **Explicit entitlement checks preventing cross-tenant leakage**: Jeder Host bleibt dafür verantwortlich, nur bereits autorisierte Records oder Reports an die Shared-Family zu übergeben. Tenantlose kanonische Hosts dürfen tenant-owned Inhalte nur nach bestehender Entitlement-Prüfung sichtbar machen; Nicht-Mitglieder bleiben deny-as-not-found.
|
||||||
|
|
||||||
|
## Decision-First Surface Role *(mandatory when operator-facing surfaces are changed)*
|
||||||
|
|
||||||
|
| Surface | Decision Role | Human-in-the-loop Moment | Immediately Visible for First Decision | On-Demand Detail / Evidence | Why This Is Primary or Why Not | Workflow Alignment | Attention-load Reduction |
|
||||||
|
|---|---|---|---|---|---|---|---|
|
||||||
|
| Verification Report family | Secondary Context Surface | Operator prüft, warum ein Verify- oder Onboarding-Schritt bereit, blockiert oder nacharbeitspflichtig ist | Ergebnisstatus, Blocker oder Warnungen, zentrale Next Steps, klarer Host-Kontext | Technische Details, Run-Identität, tiefere Diagnose, Host-spezifische Assist-Einstiege | Nicht primär, weil die eigentliche Entscheidung im Host-Workflow liegt; diese Surface liefert die entscheidungsrelevante Begründung | Unterstützt Verify-, Onboarding- und Tenant-Follow-up-Workflows, ohne selbst eine separate Prozessfläche zu werden | Gleiche Grundstruktur in mehreren Hosts reduziert erneutes Uminterpretieren derselben Report-Aussage |
|
||||||
|
| Normalized Diff / Settings family | Tertiary Evidence / Diagnostics Surface | Operator prüft, was sich fachlich geändert hat oder welche Settings inhaltlich gelten | Klar gegliederte Abschnitte, aktiver View-Modus, wichtigste Diff- oder Settings-Inhalte | Zusätzliche Abschnitte, tiefere technische Darstellung, volle Detailtiefe, optionale Expand-/Fullscreen-Zonen | Nicht primär, weil die Entscheidung meist von einer übergeordneten Policy-, Version- oder Finding-Detailfläche ausgelöst wird | Unterstützt Review-, Diagnose- und Vergleichsarbeit innerhalb bestehender Detail-Workflows | Konsistente View-Zonen und Zustände reduzieren Vergleichsaufwand zwischen Policy-, Version- und Finding-Hosts |
|
||||||
|
|
||||||
|
## UI/UX Surface Classification *(mandatory when operator-facing surfaces are changed)*
|
||||||
|
|
||||||
|
| Surface | Action Surface Class | Surface Type | Likely Next Operator Action | Primary Inspect/Open Model | Row Click | Secondary Actions Placement | Destructive Actions Placement | Canonical Collection Route | Canonical Detail Route | Scope Signals | Canonical Noun | Critical Truth Visible by Default | Exception Type / Justification |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| Verification Report family | Detail / Embedded Review | Shared detail micro-UI | Read blockers, follow next step, open related operation or assist path | Host-owned embedded detail surface | forbidden | Innerhalb der gemeinsamen Action-/Assist-Zone oder hostseitig unmittelbar angrenzend, klar getrennt von Kernstatus und Diagnose | Keine destruktiven Aktionen im Shared Core; hostseitige Mutationen bleiben außerhalb des Core-Vertrags und confirmation-gated | Host-owned verification entry surfaces | Host-owned verification detail contexts in operations, onboarding, or tenant review flows | Aktiver Tenant- oder Workspace-Kontext des Hosts, Report-Status, Ergebnis-/Readiness-Signale | Verification report | Readiness, blockers or warnings, and next action intent | Embedded shared family; kein eigenständiges list-first oder standalone resource detail |
|
||||||
|
| Normalized Diff / Settings family | Detail / Evidence | Shared detail micro-UI | Inspect sections, switch view mode, expand detail, compare meaningfully | Host-owned embedded detail surface | forbidden | Innerhalb der gemeinsamen View-/Action-Zone der Surface; hostseitige Navigation bleibt außerhalb der Kern-Interaktion | Keine destruktiven Aktionen innerhalb der Shared-Family | Host-owned policy, policy version, or finding detail entries | Host-owned policy, version, and finding detail contexts | Aktiver Tenant-Kontext des Hosts, Inhaltstyp, verfügbarer Detailmodus, Empty/Unavailable-Signale | Normalized settings / Normalized diff | Die aktuell relevante fachliche Detailaussage des Settings- oder Diff-Inhalts | Embedded evidence family; kein eigenständiges CRUD- oder queue-first surface |
|
||||||
|
|
||||||
|
## Operator Surface Contract *(mandatory when operator-facing surfaces are changed)*
|
||||||
|
|
||||||
|
| Surface | Primary Persona | Decision / Operator Action Supported | Surface Type | Primary Operator Question | Default-visible Information | Diagnostics-only Information | Status Dimensions Used | Mutation Scope | Primary Actions | Dangerous Actions |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| Verification Report family | Tenant operator, workspace operator, onboarding operator | Verstehen, ob ein Verify- oder Onboarding-Schritt bereit ist, was blockiert, und was als Nächstes zu tun ist | Embedded report detail | Why is this verification ready, blocked, or cautionary, and what should I do next? | Summary oder header zone, outcome or readiness status, issues or passes overview, next-step or assist entry points | Technical details, operation identity, deeper diagnostics, host-specific helper content | readiness, outcome, severity of issues, data completeness | Shared core is read-only; host-owned acknowledge or assist mutations remain explicitly bounded | Review issues, switch view zone, follow next step, open technical detail or related run | None in shared core |
|
||||||
|
| Normalized Diff / Settings family | Tenant operator, reviewer, diagnostician | Verstehen, welche Inhalte gelten oder was sich fachlich geändert hat | Embedded evidence detail | What changed or what settings are in force, and where should I inspect next? | Shared section structure, active view or tab, visible content blocks, empty or unavailable explanation | Secondary sections, deeper technical content, larger expansions, raw or diagnostic follow-up hosted elsewhere | content availability, comparison completeness, section context | Read-only | Switch view or tab, expand relevant detail, inspect targeted sections | None |
|
||||||
|
|
||||||
|
## Proportionality Review *(mandatory when structural complexity is introduced)*
|
||||||
|
|
||||||
|
- **New source of truth?**: No
|
||||||
|
- **New persisted entity/table/artifact?**: No
|
||||||
|
- **New abstraction?**: Yes
|
||||||
|
- **New enum/state/reason family?**: No
|
||||||
|
- **New cross-domain UI framework/taxonomy?**: No
|
||||||
|
- **Current operator problem**: Dieselbe fachliche Detail-Surface wirkt in verschiedenen Hosts wie verschiedene kleine Anwendungen. Das erschwert sichere Wiedererkennung, verlangsamt Folgeschritte und erhöht die Wahrscheinlichkeit, dass Weiterentwicklungen inkonsistent erfolgen.
|
||||||
|
- **Existing structure is insufficient because**: Reines Fragment-Sharing auf View-Ebene verhindert keine Drift bei Tabs, Assist-Zonen, Diagnostics-Zonen, lokalen Zuständen oder Action-Platzierung. Ohne expliziten Familienvertrag bleibt jeder Host faktisch Mitbesitzer der Surface-Logik.
|
||||||
|
- **Narrowest correct implementation**: Definiere nur für die zwei bereits belegten Shared-Familien einen gemeinsamen Detailvertrag mit expliziten Pflicht-, Optional- und Host-Variationszonen; keine generische Plattform, kein globales UI-System, keine neue Persistenz.
|
||||||
|
- **Ownership cost**: Dauerhaft entstehen begrenzte zusätzliche Vertragsdokumentation, cross-host Regressionstests und ein klarer Review-Maßstab für künftige Host-Einbindungen. Im Gegenzug sinken parallele View-Logik, Drift-Risiko und Teststreuung.
|
||||||
|
- **Alternative intentionally rejected**: Einzelne Hosts lokal aufzuräumen oder weitere Blade-Sharing-Fixes einzubauen wurde verworfen, weil das die gemeinsame Kernlogik nicht schützt. Ein generisches internes UI-Framework wurde ebenfalls verworfen, weil nur zwei reale Familien standardisiert werden müssen.
|
||||||
|
- **Release truth**: Current-release truth
|
||||||
|
|
||||||
|
## User Scenarios & Testing *(mandatory)*
|
||||||
|
|
||||||
|
### User Story 1 - Recognize the same verification surface everywhere (Priority: P1)
|
||||||
|
|
||||||
|
As an operator, I want verification results to use the same recognizable structure in operation detail, onboarding, and tenant verification hosts, so that I can immediately see the same core meaning, next steps, and diagnostics without relearning the surface.
|
||||||
|
|
||||||
|
**Why this priority**: The most visible current drift is inside the Verification Report family, where the same report meaning is rendered with host-specific structure and local state.
|
||||||
|
|
||||||
|
**Independent Test**: Can be fully tested by rendering each covered verification host with equivalent verification data and confirming that the same core zones, same status meaning, and same next-step intent are visible in each host while allowed host variations remain bounded.
|
||||||
|
|
||||||
|
**Acceptance Scenarios**:
|
||||||
|
|
||||||
|
1. **Given** the same verification outcome is rendered in an operations detail host and an onboarding host, **When** the operator opens each host, **Then** the same core summary, issue/pass structure, and diagnostics contract are recognizable.
|
||||||
|
2. **Given** a verification host offers host-specific assist or acknowledge behavior, **When** the operator uses that host, **Then** the host-specific behavior appears as an explicit variation of the same shared verification contract rather than as a different report UI.
|
||||||
|
3. **Given** a verification report has no technical detail payload available, **When** it is rendered in any covered host, **Then** the absence is communicated through the same contractually defined unavailable or optional zone behavior rather than host-specific omission rules.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### User Story 2 - Inspect normalized settings and diffs consistently (Priority: P1)
|
||||||
|
|
||||||
|
As an operator reviewing policy, version, or finding detail, I want normalized settings and normalized diff surfaces to behave like one family, so that tabs, view modes, sections, and unavailable states do not feel reinvented per host.
|
||||||
|
|
||||||
|
**Why this priority**: The diff/settings family already appears across multiple detail hosts and contains subtle host-specific drift around visibility, context handling, and section behavior.
|
||||||
|
|
||||||
|
**Independent Test**: Can be fully tested by rendering representative policy, policy-version, and finding hosts and verifying that the same family-level structure, same core view behavior, and same empty or unavailable semantics apply wherever the same content concept is shown.
|
||||||
|
|
||||||
|
**Acceptance Scenarios**:
|
||||||
|
|
||||||
|
1. **Given** a normalized diff is available in more than one covered host, **When** the operator opens each host, **Then** the same family-level view structure and section logic are recognizable.
|
||||||
|
2. **Given** a normalized settings surface renders different content subtypes, **When** those subtypes are shown in covered hosts, **Then** subtype differences remain explicit and do not appear as ad hoc host forks.
|
||||||
|
3. **Given** a host cannot show a diff or settings payload, **When** the operator reaches that area, **Then** the surface shows a family-consistent unavailable or partial state rather than a host-specific gap.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### User Story 3 - Add or update a host without re-forking the family (Priority: P2)
|
||||||
|
|
||||||
|
As a developer or reviewer, I want a clear shared-family contract for repeated detail surfaces, so that a new host or host change can extend the family through known variation points instead of quietly re-forking the whole micro-UI.
|
||||||
|
|
||||||
|
**Why this priority**: The product gain only lasts if later host work cannot easily recreate drift.
|
||||||
|
|
||||||
|
**Independent Test**: Can be fully tested by reviewing a changed or newly added host against the family contract and verifying that only allowed host-driven inputs, zones, and actions differ.
|
||||||
|
|
||||||
|
**Acceptance Scenarios**:
|
||||||
|
|
||||||
|
1. **Given** a developer introduces a new host for an existing shared family, **When** the host is reviewed and tested, **Then** the host declares or uses only the family's allowed variation points.
|
||||||
|
2. **Given** an existing host needs a unique action or assist entry, **When** that difference is added, **Then** the difference remains visibly host-scoped and does not redefine the family core structure.
|
||||||
|
3. **Given** a future host tries to introduce a different tab or view contract for the same family without domain justification, **When** the change is reviewed, **Then** it is rejected as out of contract.
|
||||||
|
|
||||||
|
### Edge Cases
|
||||||
|
|
||||||
|
- A covered host lacks one optional zone, such as technical details, but still must preserve the same family-level structure and optional-state behavior.
|
||||||
|
- A host needs an assist or acknowledge action that no other host needs; the action must remain an explicit host variation and not become a hidden structural fork.
|
||||||
|
- The same family appears in both tenant-context and workspace-context hosts; tenant scope must stay explicit and inaccessible data must remain not found.
|
||||||
|
- A diff or settings payload is partially available, unavailable, or subtype-specific; the surface must communicate this consistently without silently dropping the zone.
|
||||||
|
- A family contains local state, such as view selection or expansion state; that state must be owned once at the family level rather than recreated differently in each host.
|
||||||
|
|
||||||
|
## Requirements *(mandatory)*
|
||||||
|
|
||||||
|
**Constitution alignment (required):** This feature introduces no new Microsoft Graph calls, no new long-running or queued work, and no new write workflow. It standardizes repeated operator-facing detail surfaces that already exist and must remain derived from the host's current domain truth.
|
||||||
|
|
||||||
|
**Constitution alignment (PROP-001 / ABSTR-001 / PERSIST-001 / STATE-001 / BLOAT-001):** This feature introduces one narrow kind of abstraction: an explicit shared detail-family contract for two already proven families. It does not introduce new persistence, new state families, or a cross-domain UI framework. The purpose is to replace duplicate cross-host ownership, not to layer a new semantic system on top of existing truth.
|
||||||
|
|
||||||
|
**Constitution alignment (OPS-UX):** No new `OperationRun` type or execution path is introduced. Existing links to operations remain navigation only and continue to rely on the current operations contract.
|
||||||
|
|
||||||
|
**Constitution alignment (RBAC-UX):** The feature does not change authorization behavior. Existing workspace and tenant entitlement rules continue to govern every host. Non-members remain deny-as-not-found, members without capability remain forbidden where host-owned actions already enforce capability, and no shared family may bypass host authorization.
|
||||||
|
|
||||||
|
**Constitution alignment (OPS-EX-AUTH-001):** Not applicable.
|
||||||
|
|
||||||
|
**Constitution alignment (BADGE-001):** Existing centralized status, severity, readiness, and availability semantics remain the source of truth. This feature must not create host-local badge or tone vocabularies for the same shared family.
|
||||||
|
|
||||||
|
**Constitution alignment (UI-FIL-001):** Existing native detail containers, shared status primitives, and current custom viewer bodies remain the basis. The work must consolidate contract ownership and avoid new host-local replacement markup for status, assist, or action zones. Exception: the core bodies of the two shared families remain domain-specific rich viewers rather than being flattened into generic primitives.
|
||||||
|
|
||||||
|
**Constitution alignment (UI-NAMING-001):** Shared family vocabulary must stay stable across hosts. Operators should continue to see the same canonical nouns, such as verification report, technical details, next steps, normalized settings, and diff, instead of host-specific synonyms for the same concept.
|
||||||
|
|
||||||
|
**Constitution alignment (DECIDE-001):** Verification Report surfaces remain secondary context surfaces, and Normalized Diff / Settings surfaces remain tertiary evidence surfaces. Each host must still make the first decision possible without forcing the operator to decode different family structures for the same concept.
|
||||||
|
|
||||||
|
**Constitution alignment (UI-CONST-001 / UI-SURF-001 / ACTSURF-001 / UI-HARD-001 / UI-EX-001 / UI-REVIEW-001 / HDR-001):** The feature standardizes embedded detail and evidence surfaces. Each family keeps exactly one primary inspect model per host: the host opens the record, and the family provides the repeated inner surface. Pure navigation remains host-owned or within the family's secondary action zone. Destructive behavior is outside the shared core and remains governed by host rules.
|
||||||
|
|
||||||
|
**Constitution alignment (ACTSURF-001 - action hierarchy):** Shared-family actions are limited to navigation, inspection, view switching, assist entry, and other low-risk context actions. Any mutating or destructive host action remains clearly separated from the shared-family core and may not compete with the family's primary evidence or review function.
|
||||||
|
|
||||||
|
**Constitution alignment (OPSURF-001):** Default-visible content stays operator-first. Shared-family surfaces must show the core meaning, next step, or relevant content first, while deeper diagnostics remain secondary and intentionally revealed. Host context remains visible so operators understand scope.
|
||||||
|
|
||||||
|
**Constitution alignment (UI-SEM-001 / LAYER-001 / TEST-TRUTH-001):** Direct host-by-host mapping is currently insufficient because it has already produced duplicate ownership and drift. This feature must replace that duplicate ownership with one shared contract per family rather than adding extra presenter layers. Regression tests must assert the business-visible consequences of sameness across hosts.
|
||||||
|
|
||||||
|
**Constitution alignment (Filament Action Surfaces):** The Action Surface Contract remains satisfied. These are embedded read-heavy detail families, not new standalone CRUD resources. Each host continues to own its one primary inspect/open model, no redundant View action is introduced by the family work, and destructive actions stay outside the shared core. UI-FIL-001 is satisfied with the documented exception that family-specific detail viewers remain custom where the domain requires it.
|
||||||
|
|
||||||
|
**Constitution alignment (UX-001 — Layout & Information Architecture):** The feature does not add create or edit screens. Existing detail hosts must continue to use appropriate detail layouts, clear sectioning, explicit empty or unavailable states, and operator-first information ordering. Where a host already uses a view-style detail surface, the shared family must strengthen rather than weaken that clarity.
|
||||||
|
|
||||||
|
### Functional Requirements
|
||||||
|
|
||||||
|
- **FR-197-001**: The system MUST define a shared detail contract for the Verification Report family that covers every currently in-scope host where the same verification surface appears.
|
||||||
|
- **FR-197-002**: The Verification Report contract MUST identify which zones are mandatory, optional, host-extendable, and host-governed, including summary or header, outcome or readiness, view or tab zone, next-step or assist zone, technical-details or diagnostics zone, and empty or unavailable state handling.
|
||||||
|
- **FR-197-003**: Covered Verification Report hosts MUST use the same family-level core structure and MUST NOT redefine the family through incompatible local tab, view, or zone contracts.
|
||||||
|
- **FR-197-004**: Host-specific Verification Report differences MAY vary action availability, host placement, or assist entry behavior, but MUST NOT change the family's core structure, diagnostics contract, or next-step contract without explicit domain justification.
|
||||||
|
- **FR-197-005**: The Verification Report family MUST remain at least functionally equivalent to the pre-standardized state, preserving current information value, current operator usefulness, and current diagnosis depth.
|
||||||
|
- **FR-197-006**: The system MUST define a shared detail contract for the Normalized Diff / Normalized Settings family across every currently in-scope host that presents the same content concept.
|
||||||
|
- **FR-197-007**: The Normalized Diff / Settings contract MUST standardize family-level view zones, section behavior, empty or unavailable states, partial states, and any supported expand or fullscreen semantics where those behaviors are part of the family.
|
||||||
|
- **FR-197-008**: If the Normalized Diff / Settings family contains meaningful subtypes, those subtypes MUST be explicit variations of the same family contract and MUST NOT exist only as accidental host forks.
|
||||||
|
- **FR-197-009**: Covered hosts for the Normalized Diff / Settings family MAY vary host framing or surrounding context, but MUST preserve recognizable family-level interaction patterns for view switching, section reading, and detail inspection.
|
||||||
|
- **FR-197-010**: For each in-scope shared family, the required inputs, supported states, and render expectations MUST be explicit enough that a host does not need hidden local assumptions to render the family correctly.
|
||||||
|
- **FR-197-011**: If a shared family requires local UI state, that state MUST be owned once at the family level and MUST NOT be recreated differently in each host.
|
||||||
|
- **FR-197-012**: New or updated hosts using an in-scope shared family MUST extend the family only through the contract's documented variation points and MUST NOT introduce new ad hoc Blade-level main variants for the same surface.
|
||||||
|
- **FR-197-013**: Domain-specific viewers that are similar in shape but intentionally separate from the two in-scope families MAY remain outside this spec, but they MUST stay explicitly out of scope rather than becoming accidental exceptions inside the standardized families.
|
||||||
|
- **FR-197-014**: Regression coverage MUST prove that multiple hosts for each in-scope shared family use the same family-level contract and that any remaining differences are explicit, bounded host variations.
|
||||||
|
- **FR-197-015**: Release acceptance for this spec MUST include a closing inventory of migrated hosts, intentionally allowed remaining variations, and follow-up topics that were found to be shell, monitoring-state, or other out-of-scope concerns.
|
||||||
|
|
||||||
|
## UI Action Matrix *(mandatory when Filament is changed)*
|
||||||
|
|
||||||
|
| Surface | Location | Header Actions | Inspect Affordance (List/Table) | Row Actions (max 2 visible) | Bulk Actions (grouped) | Empty-State CTA(s) | View Header Actions | Create/Edit Save+Cancel | Audit log? | Notes / Exemptions |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| Verification Report family | Embedded inside operations detail, onboarding verification, and tenant verification hosts | Host-owned header actions; shared family may expose low-risk report actions such as open related operation, open technical details, or follow next step | Host-owned detail inspection; not a list/table surface | None at family level; any host-specific per-item action stays explicitly host-scoped | None | Family-consistent empty, unavailable, or assist CTA where relevant | N/A | N/A | No new audit path introduced | Action Surface Contract satisfied. Shared core is read-heavy; host-owned acknowledge or assist mutations remain outside the core contract and retain existing authorization and confirmation rules. |
|
||||||
|
| Normalized Diff / Settings family | Embedded inside policy, policy version, and finding detail hosts | Host-owned detail header actions only | Host-owned detail inspection; not a list/table surface | None | None | Family-consistent unavailable or partial-state explanation; CTA only if the host already owns a follow-up path | N/A | N/A | No | Action Surface Contract satisfied. Read-only evidence family; no new mutation or destructive affordance is introduced. |
|
||||||
|
|
||||||
|
### Key Entities *(include if feature involves data)*
|
||||||
|
|
||||||
|
- **Shared detail family**: A repeated domain detail surface that appears in more than one host and should read as the same surface wherever it appears.
|
||||||
|
- **Family contract**: The explicit definition of a shared family's inputs, supported states, mandatory zones, optional zones, and allowed host variations.
|
||||||
|
- **Host variation**: A deliberately bounded host-specific difference, such as action availability, placement, or assist entry, that does not redefine the family core.
|
||||||
|
- **Verification report detail**: The domain report surface that communicates verification readiness, blockers, passes, next steps, and deeper diagnostics.
|
||||||
|
- **Normalized detail surface**: The domain evidence surface that communicates structured settings content or structured diff content through one recognizable family.
|
||||||
|
|
||||||
|
## Deliverables
|
||||||
|
|
||||||
|
- **D-197-001**: A standardized Verification Report shared-family contract covering the currently in-scope hosts.
|
||||||
|
- **D-197-002**: A standardized Normalized Diff / Normalized Settings shared-family contract covering the currently in-scope hosts.
|
||||||
|
- **D-197-003**: Documented variation rules per family that state what is shared core, what hosts may extend, and what hosts must not re-invent.
|
||||||
|
- **D-197-004**: A closing migration note listing migrated hosts, consciously allowed remaining differences, and related topics that were intentionally left out of scope.
|
||||||
|
|
||||||
|
## Success Criteria *(mandatory)*
|
||||||
|
|
||||||
|
### Measurable Outcomes
|
||||||
|
|
||||||
|
- **SC-197-001**: In regression coverage, every currently in-scope host for the Verification Report family passes the shared-family contract assertions with zero unexplained core-structure differences.
|
||||||
|
- **SC-197-002**: In regression coverage, every currently in-scope host for the Normalized Diff / Settings family passes the shared-family contract assertions with zero unexplained view-structure differences.
|
||||||
|
- **SC-197-003**: In operator smoke review, a reviewer can identify summary, next-step or assist placement, and diagnostics placement within 10 seconds on each covered Verification Report host.
|
||||||
|
- **SC-197-004**: In operator smoke review, covered diff/settings hosts are recognized as the same family for view modes, section behavior, and unavailable-state behavior in 100% of reviewed scenarios.
|
||||||
|
- **SC-197-005**: The release contains no remaining unbounded host-only main variant for either in-scope shared family.
|
||||||
|
|
||||||
|
## Assumptions
|
||||||
|
|
||||||
|
- The current repository already contains the two in-scope shared families in enough hosts to justify a family-level contract now.
|
||||||
|
- Existing host authorization, route structure, and domain truth remain correct; this spec changes shared UI contract ownership, not host entitlement logic.
|
||||||
|
- Rich domain-specific detail rendering remains necessary; only the family contract is being standardized, not the domain detail richness itself.
|
||||||
|
|
||||||
|
## Non-Goals
|
||||||
|
|
||||||
|
- Standardizing every custom detail surface in the repository
|
||||||
|
- Refactoring the global shell, workspace context bar, or monitoring page-state behavior
|
||||||
|
- Reworking Evidence Overview, baseline compare matrix, or generic table surfaces
|
||||||
|
- Eliminating every custom view body in favor of a generic component system
|
||||||
|
- Pulling unrelated domain-specific diff viewers into scope without proving that they are the same shared family
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- Existing operations detail hosts, tenant verification hosts, and onboarding verification hosts that already render Verification Report content
|
||||||
|
- Existing policy, policy version, and finding detail hosts that already render Normalized Settings or Normalized Diff content
|
||||||
|
- Existing host-level authorization, detail routing, and status semantics that the shared-family contracts must preserve rather than replace
|
||||||
|
|
||||||
|
## Definition of Done
|
||||||
|
|
||||||
|
Spec 197 is complete when:
|
||||||
|
|
||||||
|
- both confirmed in-scope shared families use explicit family contracts,
|
||||||
|
- the main hosts for each family no longer behave like loosely drifted mini-app variants of the same surface,
|
||||||
|
- remaining host differences are explicitly documented as bounded variations,
|
||||||
|
- regression and smoke verification prove operator sameness and preserved usefulness,
|
||||||
|
- and no shell-, monitoring-state-, or other out-of-scope topic has been silently absorbed into this work.
|
||||||
229
specs/197-shared-detail-contract/tasks.md
Normal file
229
specs/197-shared-detail-contract/tasks.md
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
# Tasks: Shared Detail Micro-UI Contract
|
||||||
|
|
||||||
|
**Input**: Design documents from `/specs/197-shared-detail-contract/`
|
||||||
|
**Prerequisites**: plan.md, spec.md, research.md, data-model.md, contracts/, quickstart.md
|
||||||
|
|
||||||
|
**Tests**: Tests are REQUIRED for this feature. Use Pest feature coverage and Livewire-safe Filament tests via Laravel Sail.
|
||||||
|
**Operations**: No new `OperationRun`, queue, scheduler, or notification lifecycle is introduced by this feature.
|
||||||
|
**RBAC**: No new capability or authorization plane is introduced; all hosts must preserve existing deny-as-not-found and capability enforcement behavior.
|
||||||
|
**Release Artifact**: `specs/197-shared-detail-contract/migration-note.md` records migrated hosts, bounded variations, manual smoke evidence, and out-of-scope follow-ups.
|
||||||
|
|
||||||
|
**Organization**: Tasks are grouped by user story so each family can be implemented and verified independently.
|
||||||
|
|
||||||
|
## Phase 1: Setup (Shared Scaffolding)
|
||||||
|
|
||||||
|
**Purpose**: Create the new support, view, and test entry points that later phases will fill.
|
||||||
|
|
||||||
|
- [X] T001 [P] Create shared-detail support class skeletons in apps/platform/app/Filament/Support/NormalizedSettingsSurface.php and apps/platform/app/Filament/Support/NormalizedDiffSurface.php
|
||||||
|
- [X] T002 [P] Create family partial entry points in apps/platform/resources/views/filament/components/verification-report/summary.blade.php, apps/platform/resources/views/filament/components/verification-report/issues.blade.php, apps/platform/resources/views/filament/infolists/entries/normalized-settings/wrapper.blade.php, and apps/platform/resources/views/filament/infolists/entries/normalized-diff/wrapper.blade.php
|
||||||
|
- [X] T003 [P] Create focused contract-test shells in apps/platform/tests/Feature/Filament/SharedVerificationReportFamilyContractTest.php, apps/platform/tests/Feature/Filament/NormalizedDetailFamilyContractTest.php, and apps/platform/tests/Feature/Guards/SharedDetailFamilyContractGuardTest.php
|
||||||
|
|
||||||
|
**Checkpoint**: The new files and entry points exist so the implementation can proceed without inventing paths mid-stream.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2: Foundational (Blocking Contract Seams)
|
||||||
|
|
||||||
|
**Purpose**: Establish the shared support builders that every story relies on.
|
||||||
|
|
||||||
|
**⚠️ CRITICAL**: No user story work should start before these support seams exist.
|
||||||
|
|
||||||
|
- [X] T004 [P] Extend apps/platform/app/Filament/Support/VerificationReportViewer.php to build an explicit verification surface contract with shared zones and host-variation metadata
|
||||||
|
- [X] T005 [P] Implement normalized settings contract shaping in apps/platform/app/Filament/Support/NormalizedSettingsSurface.php for subtype, warning, and empty-state ownership
|
||||||
|
- [X] T006 [P] Implement normalized diff contract shaping in apps/platform/app/Filament/Support/NormalizedDiffSurface.php for availability, zero-diff, partial-state, and grouped-render ownership
|
||||||
|
|
||||||
|
**Checkpoint**: Verification, normalized settings, and normalized diff each have a single contract seam that hosts can consume.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3: User Story 1 - Recognize The Same Verification Surface Everywhere (Priority: P1) 🎯 MVP
|
||||||
|
|
||||||
|
**Goal**: Make operation detail, onboarding, and tenant verification render the same verification-family core while keeping only bounded host-specific actions and framing.
|
||||||
|
|
||||||
|
**Independent Test**: Render equivalent verification data through the operation detail, onboarding, and tenant widget hosts and confirm the same summary, issue/pass grouping, diagnostics contract, unavailable semantics, and authorization boundaries are recognizable everywhere.
|
||||||
|
|
||||||
|
### Tests for User Story 1
|
||||||
|
|
||||||
|
- [X] T007 [P] [US1] Add cross-host parity assertions in apps/platform/tests/Feature/Filament/SharedVerificationReportFamilyContractTest.php for operation detail, onboarding, and tenant widget verification hosts
|
||||||
|
- [X] T008 [P] [US1] Extend DB-only and widget regressions in apps/platform/tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php and apps/platform/tests/Feature/Filament/TenantVerificationReportWidgetTest.php
|
||||||
|
- [X] T009 [P] [US1] Extend onboarding verification regressions in apps/platform/tests/Feature/Onboarding/OnboardingVerificationTest.php and apps/platform/tests/Feature/Onboarding/OnboardingVerificationV1_5UxTest.php
|
||||||
|
- [X] T010 [P] [US1] Extend workspace-context and onboarding entitlement regressions in apps/platform/tests/Feature/MonitoringOperationsTest.php, apps/platform/tests/Feature/Spec085/DenyAsNotFoundSemanticsTest.php, and apps/platform/tests/Feature/Onboarding/OnboardingDraftAccessTest.php so the verification-family refactor preserves 404-for-non-members and 403-for-in-scope-capability-denial behavior
|
||||||
|
|
||||||
|
### Implementation for User Story 1
|
||||||
|
|
||||||
|
- [X] T011 [US1] Refactor apps/platform/resources/views/filament/components/verification-report-viewer.blade.php and the partials under apps/platform/resources/views/filament/components/verification-report/ to own the shared summary, issues, passed, diagnostics, next-step, and unavailable zones
|
||||||
|
- [X] T012 [US1] Rebuild apps/platform/resources/views/filament/forms/components/managed-tenant-onboarding-verification-report.blade.php around the shared verification-family core while keeping assist, acknowledge, and technical-details controls host-scoped
|
||||||
|
- [X] T013 [US1] Route operation-detail and onboarding host context through the verification contract in apps/platform/app/Filament/Resources/OperationRunResource.php and apps/platform/app/Filament/Pages/Workspaces/ManagedTenantOnboardingWizard.php
|
||||||
|
- [X] T014 [US1] Route tenant-widget host context through the verification contract in apps/platform/app/Filament/Widgets/Tenant/TenantVerificationReport.php and apps/platform/resources/views/filament/widgets/tenant/tenant-verification-report.blade.php
|
||||||
|
|
||||||
|
**Checkpoint**: Verification-family hosts share one recognizable micro-UI contract and remain DB-only, host-authorized, and operator-first.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4: User Story 2 - Inspect Normalized Settings And Diffs Consistently (Priority: P1)
|
||||||
|
|
||||||
|
**Goal**: Make policy, policy-version, and finding detail surfaces use one normalized settings family and one normalized diff family with explicit subtype and availability semantics.
|
||||||
|
|
||||||
|
**Independent Test**: Render representative policy, policy-version, and finding hosts and confirm that normalized settings and normalized diff use consistent family-owned wrappers, view behavior, subtype handling, unavailable-state semantics, and existing tenant-scope authorization behavior.
|
||||||
|
|
||||||
|
### Tests for User Story 2
|
||||||
|
|
||||||
|
- [X] T015 [P] [US2] Add family parity assertions in apps/platform/tests/Feature/Filament/NormalizedDetailFamilyContractTest.php for policy settings, policy-version settings, policy-version diff, and finding diff hosts
|
||||||
|
- [X] T016 [P] [US2] Extend normalized settings regressions in apps/platform/tests/Feature/Filament/PolicyVersionSettingsTest.php and apps/platform/tests/Feature/Filament/SettingsCatalogPolicyNormalizedDiffTest.php
|
||||||
|
- [X] T017 [P] [US2] Extend normalized diff availability regressions in apps/platform/tests/Feature/Filament/GroupPolicyConfigurationNormalizedDiffTest.php and apps/platform/tests/Feature/Drift/DriftFindingDiffUnavailableTest.php
|
||||||
|
- [X] T018 [P] [US2] Extend tenant-scope authorization regressions in apps/platform/tests/Feature/Filament/PolicyResourceAdminTenantParityTest.php, apps/platform/tests/Feature/Filament/PolicyVersionAdminTenantParityTest.php, and apps/platform/tests/Feature/Findings/FindingRbacTest.php so normalized-detail hosts preserve deny-as-not-found and capability-safe behavior after family wiring
|
||||||
|
|
||||||
|
### Implementation for User Story 2
|
||||||
|
|
||||||
|
- [X] T019 [US2] Refactor apps/platform/resources/views/filament/infolists/entries/normalized-settings.blade.php and subtype partials under apps/platform/resources/views/filament/infolists/entries/normalized-settings/ to own warnings, wrapper structure, subtype selection, and empty-state behavior
|
||||||
|
- [X] T020 [US2] Absorb or retire apps/platform/resources/views/filament/infolists/entries/policy-settings-standard.blade.php as a direct host-facing sibling so standard settings render only as a normalized-settings subtype
|
||||||
|
- [X] T021 [US2] Route policy and policy-version settings hosts through NormalizedSettingsSurface in apps/platform/app/Filament/Resources/PolicyResource.php and apps/platform/app/Filament/Resources/PolicyVersionResource.php
|
||||||
|
- [X] T022 [P] [US2] Adapt apps/platform/app/Livewire/SettingsCatalogSettingsTable.php so the settings-catalog table stays a subtype renderer under the normalized-settings family wrapper
|
||||||
|
- [X] T023 [US2] Refactor apps/platform/resources/views/filament/infolists/entries/normalized-diff.blade.php and the partials under apps/platform/resources/views/filament/infolists/entries/normalized-diff/ to own summary, grouped rendering, and unavailable or zero-diff states
|
||||||
|
- [X] T024 [US2] Route policy-version and finding diff hosts through NormalizedDiffSurface in apps/platform/app/Filament/Resources/PolicyVersionResource.php and apps/platform/app/Filament/Resources/FindingResource.php
|
||||||
|
|
||||||
|
**Checkpoint**: Normalized settings and diff surfaces read as one family across policy, policy-version, and finding detail hosts.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 5: User Story 3 - Add Or Update A Host Without Re-Forking The Family (Priority: P2)
|
||||||
|
|
||||||
|
**Goal**: Make future host work extend the documented family variation points instead of silently reintroducing host-local forks.
|
||||||
|
|
||||||
|
**Independent Test**: Run the guard suite and verify it fails on forbidden verification tab ownership or direct top-level `policy-settings-standard` host usage while the contract docs enumerate the approved consumers and allowed variations.
|
||||||
|
|
||||||
|
### Tests for User Story 3
|
||||||
|
|
||||||
|
- [X] T025 [P] [US3] Implement fork-guard coverage in apps/platform/tests/Feature/Guards/SharedDetailFamilyContractGuardTest.php for forbidden verification tab ownership and direct host-level policy-settings-standard usage
|
||||||
|
|
||||||
|
### Implementation for User Story 3
|
||||||
|
|
||||||
|
- [X] T026 [US3] Sync approved consumers, required markers, and forbidden host patterns in specs/197-shared-detail-contract/contracts/verification-report-family.openapi.yaml and specs/197-shared-detail-contract/contracts/normalized-detail-family.openapi.yaml
|
||||||
|
- [X] T027 [US3] Record the migrated host inventory, bounded variations, smoke-review evidence, and out-of-scope follow-ups in specs/197-shared-detail-contract/migration-note.md
|
||||||
|
|
||||||
|
**Checkpoint**: Reviewers and future implementers have an executable guard and a written inventory that block ad hoc family forks.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 6: Polish & Cross-Cutting Concerns
|
||||||
|
|
||||||
|
**Purpose**: Validate the full feature slice and record release acceptance evidence.
|
||||||
|
|
||||||
|
- [X] T028 [P] Run formatting for touched PHP files including apps/platform/app/Filament/Support/VerificationReportViewer.php, apps/platform/app/Filament/Support/NormalizedSettingsSurface.php, and apps/platform/app/Filament/Support/NormalizedDiffSurface.php with `./vendor/bin/sail bin pint --dirty --format agent`
|
||||||
|
- [X] T029 Run the focused Sail validation pack from specs/197-shared-detail-contract/quickstart.md against apps/platform/tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php, apps/platform/tests/Feature/Filament/TenantVerificationReportWidgetTest.php, apps/platform/tests/Feature/Onboarding/OnboardingVerificationTest.php, apps/platform/tests/Feature/Onboarding/OnboardingVerificationV1_5UxTest.php, apps/platform/tests/Feature/MonitoringOperationsTest.php, apps/platform/tests/Feature/Spec085/DenyAsNotFoundSemanticsTest.php, apps/platform/tests/Feature/Onboarding/OnboardingDraftAccessTest.php, apps/platform/tests/Feature/Filament/PolicyVersionSettingsTest.php, apps/platform/tests/Feature/Filament/SettingsCatalogPolicyNormalizedDiffTest.php, apps/platform/tests/Feature/Filament/GroupPolicyConfigurationNormalizedDiffTest.php, apps/platform/tests/Feature/Drift/DriftFindingDiffUnavailableTest.php, apps/platform/tests/Feature/Filament/PolicyResourceAdminTenantParityTest.php, apps/platform/tests/Feature/Filament/PolicyVersionAdminTenantParityTest.php, apps/platform/tests/Feature/Findings/FindingRbacTest.php, apps/platform/tests/Feature/Filament/SharedVerificationReportFamilyContractTest.php, apps/platform/tests/Feature/Filament/NormalizedDetailFamilyContractTest.php, and apps/platform/tests/Feature/Guards/SharedDetailFamilyContractGuardTest.php
|
||||||
|
- [X] T030 Execute the Manual Smoke Check in specs/197-shared-detail-contract/quickstart.md and capture SC-197-003 and SC-197-004 evidence in specs/197-shared-detail-contract/migration-note.md
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dependencies & Execution Order
|
||||||
|
|
||||||
|
### Phase Dependencies
|
||||||
|
|
||||||
|
- **Setup (Phase 1)**: No dependencies; can start immediately.
|
||||||
|
- **Foundational (Phase 2)**: Depends on Setup completion; blocks all user story implementation.
|
||||||
|
- **User Story 1 (Phase 3)**: Depends on Foundational completion.
|
||||||
|
- **User Story 2 (Phase 4)**: Depends on Foundational completion.
|
||||||
|
- **User Story 3 (Phase 5)**: Depends on User Story 1 and User Story 2 completion because the guard and inventory must reflect the final family boundaries.
|
||||||
|
- **Polish (Phase 6)**: Depends on all targeted user stories being complete.
|
||||||
|
|
||||||
|
### User Story Dependencies
|
||||||
|
|
||||||
|
- **US1**: Independent after Phase 2; no dependency on US2.
|
||||||
|
- **US2**: Independent after Phase 2; no dependency on US1.
|
||||||
|
- **US3**: Depends on US1 and US2 because it locks the final approved host patterns for both families.
|
||||||
|
|
||||||
|
### Within Each User Story
|
||||||
|
|
||||||
|
- Write or extend the listed tests before finishing implementation.
|
||||||
|
- Complete support or wrapper ownership before wiring host files to the new family contracts.
|
||||||
|
- Keep host framing and host-owned actions bounded to the variation points defined in the contracts.
|
||||||
|
- Validate each story independently before moving to the next story or polish phase.
|
||||||
|
|
||||||
|
### Parallel Opportunities
|
||||||
|
|
||||||
|
- T001, T002, and T003 can run in parallel.
|
||||||
|
- T004, T005, and T006 can run in parallel.
|
||||||
|
- After Phase 2, US1 and US2 can proceed in parallel if separate implementers avoid the shared `PolicyVersionResource.php` touchpoint.
|
||||||
|
- Within US1, T007, T008, T009, and T010 can run in parallel.
|
||||||
|
- Within US2, T015, T016, T017, and T018 can run in parallel.
|
||||||
|
- Within US3, T026 and T027 can run in parallel after T025 is in place.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Parallel Example: User Story 1
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start the verification-family test extensions together:
|
||||||
|
Task: "T007 Add cross-host parity assertions in apps/platform/tests/Feature/Filament/SharedVerificationReportFamilyContractTest.php"
|
||||||
|
Task: "T008 Extend DB-only and widget regressions in apps/platform/tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php and apps/platform/tests/Feature/Filament/TenantVerificationReportWidgetTest.php"
|
||||||
|
Task: "T009 Extend onboarding verification regressions in apps/platform/tests/Feature/Onboarding/OnboardingVerificationTest.php and apps/platform/tests/Feature/Onboarding/OnboardingVerificationV1_5UxTest.php"
|
||||||
|
Task: "T010 Extend workspace-context and onboarding entitlement regressions in apps/platform/tests/Feature/MonitoringOperationsTest.php, apps/platform/tests/Feature/Spec085/DenyAsNotFoundSemanticsTest.php, and apps/platform/tests/Feature/Onboarding/OnboardingDraftAccessTest.php"
|
||||||
|
|
||||||
|
# After the shared verification wrapper is in place, these can proceed side by side:
|
||||||
|
Task: "T012 Rebuild apps/platform/resources/views/filament/forms/components/managed-tenant-onboarding-verification-report.blade.php"
|
||||||
|
Task: "T014 Route tenant-widget host context through the verification contract in apps/platform/app/Filament/Widgets/Tenant/TenantVerificationReport.php and apps/platform/resources/views/filament/widgets/tenant/tenant-verification-report.blade.php"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Parallel Example: User Story 2
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start the normalized-detail test extensions together:
|
||||||
|
Task: "T015 Add family parity assertions in apps/platform/tests/Feature/Filament/NormalizedDetailFamilyContractTest.php"
|
||||||
|
Task: "T016 Extend normalized settings regressions in apps/platform/tests/Feature/Filament/PolicyVersionSettingsTest.php and apps/platform/tests/Feature/Filament/SettingsCatalogPolicyNormalizedDiffTest.php"
|
||||||
|
Task: "T017 Extend normalized diff availability regressions in apps/platform/tests/Feature/Filament/GroupPolicyConfigurationNormalizedDiffTest.php and apps/platform/tests/Feature/Drift/DriftFindingDiffUnavailableTest.php"
|
||||||
|
Task: "T018 Extend tenant-scope authorization regressions in apps/platform/tests/Feature/Filament/PolicyResourceAdminTenantParityTest.php, apps/platform/tests/Feature/Filament/PolicyVersionAdminTenantParityTest.php, and apps/platform/tests/Feature/Findings/FindingRbacTest.php"
|
||||||
|
|
||||||
|
# Once the family builders exist, these can proceed in parallel without touching the same files:
|
||||||
|
Task: "T022 Adapt apps/platform/app/Livewire/SettingsCatalogSettingsTable.php"
|
||||||
|
Task: "T023 Refactor apps/platform/resources/views/filament/infolists/entries/normalized-diff.blade.php and partials under apps/platform/resources/views/filament/infolists/entries/normalized-diff/"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Parallel Example: User Story 3
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# After the guard exists, finish the enforcement artifacts together:
|
||||||
|
Task: "T026 Sync approved consumers and forbidden host patterns in specs/197-shared-detail-contract/contracts/verification-report-family.openapi.yaml and specs/197-shared-detail-contract/contracts/normalized-detail-family.openapi.yaml"
|
||||||
|
Task: "T027 Record the migrated host inventory and bounded variations in specs/197-shared-detail-contract/migration-note.md"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Implementation Strategy
|
||||||
|
|
||||||
|
### MVP First (User Story 1 Only)
|
||||||
|
|
||||||
|
1. Complete Phase 1: Setup.
|
||||||
|
2. Complete Phase 2: Foundational.
|
||||||
|
3. Complete Phase 3: User Story 1.
|
||||||
|
4. Validate the verification family independently across operation detail, onboarding, and tenant widget hosts.
|
||||||
|
5. Demo or merge the MVP slice if the repo strategy allows partial delivery.
|
||||||
|
|
||||||
|
### Incremental Delivery
|
||||||
|
|
||||||
|
1. Finish Setup + Foundational once.
|
||||||
|
2. Deliver US1 and validate verification-family sameness.
|
||||||
|
3. Deliver US2 and validate normalized-detail sameness.
|
||||||
|
4. Deliver US3 to lock the boundaries with a guard and final inventory.
|
||||||
|
5. Finish with polish, the focused Sail pack from quickstart.md, and the manual smoke evidence recorded in migration-note.md.
|
||||||
|
|
||||||
|
### Parallel Team Strategy
|
||||||
|
|
||||||
|
1. One implementer completes Phase 1 and Phase 2.
|
||||||
|
2. After that, one implementer can take US1 while another takes US2.
|
||||||
|
3. US3 starts once both family implementations settle.
|
||||||
|
4. Finish with one shared cleanup and validation pass.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- `[P]` means the task can run in parallel because it touches different files and has no dependency on incomplete work.
|
||||||
|
- `[US1]`, `[US2]`, and `[US3]` map each task back to the spec’s user stories.
|
||||||
|
- This feature must stay inside Filament v5 + Livewire v4; no provider registration change is required because `bootstrap/providers.php` remains unchanged.
|
||||||
|
- No globally searchable resource is added or removed by this feature; existing host resources continue to own their Edit or View surfaces.
|
||||||
|
- No destructive action is introduced inside either shared family; any existing host mutation remains host-owned and must keep existing confirmation and authorization behavior.
|
||||||
|
- No new assets are introduced, so no `filament:assets` deployment step changes are needed.
|
||||||
Loading…
Reference in New Issue
Block a user