TenantAtlas/apps/platform/resources/views/filament/modals/tenant-configuration/coverage-v2-resource-inspect.blade.php
ahmido 69d4ecbbd2 feat: complete spec 421 Entra comparable/renderable pack (#488)
Implements the bounded Spec 421 Entra comparable/renderable pack on the existing Coverage v2 operator surface.

- Adds typed Conditional Access normalization, comparison, and render summaries
- Keeps Security Defaults and other optional Entra types deferred until evidence-backed
- Preserves the existing Coverage v2 surface with claim-guard and redaction hardening
- Includes focused unit, feature, and browser coverage already recorded in the implementation report

Validation is documented in `specs/421-entra-core-comparable-renderable-pack/implementation-report.md`.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #488
2026-06-27 22:12:01 +00:00

196 lines
9.8 KiB
PHP

@php
$badge = function (\App\Support\Badges\BadgeDomain $domain, ?string $state): ?\App\Support\Badges\BadgeSpec {
return filled($state) ? \App\Support\Badges\BadgeRenderer::spec($domain, $state) : null;
};
$badges = [
'Coverage' => $badge(\App\Support\Badges\BadgeDomain::CoverageV2CoverageLevel, $details['coverage_level'] ?? null),
'Evidence' => $badge(\App\Support\Badges\BadgeDomain::CoverageV2EvidenceState, $details['evidence_state'] ?? null),
'Identity' => $badge(\App\Support\Badges\BadgeDomain::CoverageV2IdentityState, $details['identity_state'] ?? null),
'Claim' => $badge(\App\Support\Badges\BadgeDomain::CoverageV2ClaimState, $details['claim_state'] ?? null),
'Source' => $badge(\App\Support\Badges\BadgeDomain::CoverageV2SourceClass, $details['source_class'] ?? null),
];
$safeFields = [
'Resource type' => $details['resource_type'] ?? null,
'Canonical type' => $details['canonical_type'] ?? null,
'Canonical key' => $details['canonical_resource_key'] ?? null,
'Provider connection' => $details['provider_connection'] ?? null,
'Evidence hash' => $details['evidence_hash'] ?? null,
'Last captured' => $details['last_captured'] ?? null,
'Source contract' => $details['source_contract_key'] ?? null,
'Source version' => $details['source_version'] ?? null,
'Source schema hash' => $details['source_schema_hash'] ?? null,
'Capture outcome' => $details['capture_outcome'] ?? null,
'Identity reason' => $details['identity_reason_code'] ?? null,
];
$typedSummary = $details['typed_render_summary'] ?? null;
$compareSummary = is_array($typedSummary) && is_array($typedSummary['compare_summary'] ?? null)
? $typedSummary['compare_summary']
: null;
@endphp
<div class="space-y-5">
<div class="flex flex-wrap gap-2">
@foreach ($badges as $label => $spec)
@if ($spec)
<x-filament::badge :color="$spec->color" :icon="$spec->icon">
{{ $label }}: {{ $spec->label }}
</x-filament::badge>
@endif
@endforeach
</div>
@if (($details['blockers'] ?? []) !== [])
<div class="space-y-2">
<div class="text-sm font-medium text-gray-950 dark:text-white">
Activation blockers
</div>
<div class="flex flex-wrap gap-2">
@foreach ($details['blockers'] as $blocker)
<x-filament::badge color="warning" icon="heroicon-m-exclamation-triangle">
{{ $blocker }}
</x-filament::badge>
@endforeach
</div>
</div>
@endif
@if (is_array($typedSummary))
<div class="space-y-3">
<div class="text-sm font-medium text-gray-950 dark:text-white">
{{ $typedSummary['resource_type'] ?? 'Typed summary' }}
</div>
<dl class="grid gap-3 sm:grid-cols-2">
@foreach ([
'Display name' => $typedSummary['display_name'] ?? null,
'State' => $typedSummary['state'] ?? null,
'Grant controls' => $typedSummary['grant_controls'] ?? null,
'Session controls' => $typedSummary['session_controls'] ?? null,
'Claim state' => $typedSummary['claim_state'] ?? null,
'Identity state' => $typedSummary['identity_state'] ?? null,
'Last captured' => $typedSummary['last_captured'] ?? null,
] as $label => $value)
@if (filled($value))
<div class="min-w-0 border-l border-gray-200 pl-3 dark:border-white/10">
<dt class="text-xs font-medium text-gray-500 dark:text-gray-400">
{{ $label }}
</dt>
<dd class="mt-1 break-words text-sm text-gray-950 dark:text-white">
{{ $value }}
</dd>
</div>
@endif
@endforeach
</dl>
@foreach (['targets' => 'Targets', 'conditions' => 'Conditions'] as $summaryKey => $heading)
@if (($typedSummary[$summaryKey] ?? []) !== [])
<div class="space-y-2">
<div class="text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400">
{{ $heading }}
</div>
<dl class="grid gap-2 sm:grid-cols-2">
@foreach ($typedSummary[$summaryKey] as $row)
@if (is_array($row) && filled($row['value'] ?? null))
<div class="min-w-0">
<dt class="text-xs text-gray-500 dark:text-gray-400">
{{ $row['label'] ?? 'Summary' }}
</dt>
<dd class="mt-0.5 break-words text-sm text-gray-950 dark:text-white">
{{ $row['value'] }}
</dd>
</div>
@endif
@endforeach
</dl>
</div>
@endif
@endforeach
@if ($compareSummary !== null)
<div class="space-y-2">
<div class="text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400">
Compare summary
</div>
<div class="space-y-2">
<div class="flex flex-wrap items-center gap-2">
<x-filament::badge :color="($compareSummary['changed'] ?? false) ? 'warning' : 'gray'" icon="heroicon-m-arrows-right-left">
{{ $compareSummary['status'] ?? 'Compare summary unavailable' }}
</x-filament::badge>
@if (filled($compareSummary['previous_captured'] ?? null))
<span class="text-xs text-gray-500 dark:text-gray-400">
Previous comparable evidence: {{ $compareSummary['previous_captured'] }}
</span>
@endif
</div>
@if (($compareSummary['changes'] ?? []) !== [])
<dl class="grid gap-2 sm:grid-cols-2">
@foreach ($compareSummary['changes'] as $change)
@if (is_array($change))
<div class="min-w-0 border-l border-gray-200 pl-3 dark:border-white/10">
<dt class="text-xs font-medium text-gray-500 dark:text-gray-400">
{{ $change['label'] ?? 'Changed field' }}
</dt>
<dd class="mt-1 break-words text-sm text-gray-950 dark:text-white">
{{ str((string) ($change['classification'] ?? 'changed'))->replace('_', ' ')->headline() }}
·
{{ str((string) ($change['importance'] ?? 'informational'))->replace('_', ' ')->headline() }}
</dd>
</div>
@endif
@endforeach
</dl>
@endif
</div>
</div>
@endif
@foreach ([
'unsupported_fields' => ['Unsupported fields', 'warning', 'heroicon-m-exclamation-triangle'],
'redacted_fields' => ['Redacted fields', 'gray', 'heroicon-m-shield-check'],
] as $summaryKey => [$heading, $color, $icon])
@if (($typedSummary[$summaryKey] ?? []) !== [])
<div class="space-y-2">
<div class="text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400">
{{ $heading }}
</div>
<div class="flex flex-wrap gap-2">
@foreach ($typedSummary[$summaryKey] as $field)
<x-filament::badge :color="$color" :icon="$icon">
{{ $field }}
</x-filament::badge>
@endforeach
</div>
</div>
@endif
@endforeach
</div>
@endif
<dl class="grid gap-3 sm:grid-cols-2">
@foreach ($safeFields as $label => $value)
@if (filled($value))
<div class="min-w-0 border-l border-gray-200 pl-3 dark:border-white/10">
<dt class="text-xs font-medium text-gray-500 dark:text-gray-400">
{{ $label }}
</dt>
<dd class="mt-1 break-words text-sm text-gray-950 dark:text-white">
{{ $value }}
</dd>
</div>
@endif
@endforeach
</dl>
@if (filled($details['operation_run_url'] ?? null))
<x-filament::link :href="$details['operation_run_url']" icon="heroicon-o-arrow-top-right-on-square">
{{ $details['operation_run_label'] ?? 'Open operation' }}
</x-filament::link>
@endif
</div>