## Summary - add a request-scoped derived-state store with deterministic keying and freshness controls - adopt the shared contract in ArtifactTruthPresenter, OperationUxPresenter, and RelatedNavigationResolver plus the covered Filament consumers - add spec, plan, contracts, guardrails, and focused memoization and freshness test coverage for spec 167 ## Verification - vendor/bin/sail artisan test --compact tests/Feature/078/RelatedLinksOnDetailTest.php - vendor/bin/sail artisan test --compact tests/Feature/078/ tests/Feature/Operations/TenantlessOperationRunViewerTest.php tests/Feature/Monitoring/OperationsCanonicalUrlsTest.php tests/Feature/Monitoring/OperationsTenantScopeTest.php tests/Feature/Verification/VerificationAuthorizationTest.php tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php tests/Feature/Verification/VerificationReportRedactionTest.php tests/Feature/Verification/VerificationReportMissingOrMalformedTest.php tests/Feature/OpsUx/FailureSanitizationTest.php tests/Feature/OpsUx/CanonicalViewRunLinksTest.php - vendor/bin/sail bin pint --dirty --format agent ## Notes - Livewire v4.0+ compliance preserved - provider registration remains in bootstrap/providers.php - no Filament assets or panel registration changes - no global-search behavior changes - no destructive action behavior changes in this PR Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #198
53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\PolicyVersionResource\Pages;
|
|
|
|
use App\Filament\Resources\PolicyVersionResource;
|
|
use App\Support\Navigation\CrossResourceNavigationMatrix;
|
|
use App\Support\Navigation\RelatedContextEntry;
|
|
use App\Support\Navigation\RelatedNavigationResolver;
|
|
use Filament\Actions\Action;
|
|
use Filament\Resources\Pages\ViewRecord;
|
|
use Filament\Support\Enums\Width;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ViewPolicyVersion extends ViewRecord
|
|
{
|
|
protected static string $resource = PolicyVersionResource::class;
|
|
|
|
protected Width|string|null $maxContentWidth = Width::Full;
|
|
|
|
protected function resolveRecord(int|string $key): Model
|
|
{
|
|
return PolicyVersionResource::resolveScopedRecordOrFail($key);
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('primary_related')
|
|
->label(fn (): string => $this->primaryRelatedEntry()?->actionLabel ?? 'Open related record')
|
|
->url(fn (): ?string => $this->primaryRelatedEntry()?->targetUrl)
|
|
->hidden(fn (): bool => ! ($this->primaryRelatedEntry()?->isAvailable() ?? false))
|
|
->color('gray'),
|
|
];
|
|
}
|
|
|
|
public function getFooter(): ?View
|
|
{
|
|
return view('filament.resources.policy-version-resource.pages.view-policy-version-footer', [
|
|
'record' => $this->getRecord(),
|
|
]);
|
|
}
|
|
|
|
private function primaryRelatedEntry(bool $fresh = false): ?RelatedContextEntry
|
|
{
|
|
$resolver = app(RelatedNavigationResolver::class);
|
|
|
|
return $fresh
|
|
? $resolver->primaryListActionFresh(CrossResourceNavigationMatrix::SOURCE_POLICY_VERSION, $this->getRecord())
|
|
: $resolver->primaryListAction(CrossResourceNavigationMatrix::SOURCE_POLICY_VERSION, $this->getRecord());
|
|
}
|
|
}
|