## Summary - align operator-visible OperationRun terminology to canonical `Operations` / `Operation` labels across shared links, notifications, verification/onboarding surfaces, summary widgets, and monitoring/detail pages - add the Spec 171 planning artifacts under `specs/171-operations-naming-consolidation/` - close the remaining tenant dashboard and admin copy drift found during browser smoke validation ## Validation - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && vendor/bin/sail artisan test --compact tests/Unit/Support/RelatedNavigationResolverTest.php tests/Unit/Support/References/RelatedContextReferenceAdapterTest.php tests/Feature/OpsUx/NotificationViewRunLinkTest.php tests/Feature/Guards/ActionSurfaceContractTest.php tests/Feature/Operations/TenantlessOperationRunViewerTest.php tests/Feature/Filament/BackupSetResolvedReferencePresentationTest.php tests/Feature/Filament/TenantVerificationReportWidgetTest.php tests/Feature/Onboarding/OnboardingVerificationTest.php tests/Feature/Onboarding/OnboardingVerificationClustersTest.php tests/Feature/Onboarding/OnboardingVerificationV1_5UxTest.php tests/Feature/Filament/BaselineCompareSummaryConsistencyTest.php tests/Feature/Filament/WorkspaceOverviewContentTest.php tests/Feature/Filament/RecentOperationsSummaryWidgetTest.php tests/Feature/Monitoring/OperationLifecycleAggregateVisibilityTest.php tests/Feature/System/Spec114/OpsTriageActionsTest.php tests/Feature/System/Spec114/OpsFailuresViewTest.php tests/Feature/System/Spec114/OpsStuckViewTest.php` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && vendor/bin/sail artisan test --compact tests/Browser/OnboardingDraftRefreshTest.php` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && vendor/bin/sail bin pint --dirty --format agent` ## Notes - no schema or route renames - Filament / Livewire surface behavior stays within the existing admin and tenant panels - OperationRunResource remains excluded from global search Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #202
79 lines
2.4 KiB
PHP
79 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Navigation;
|
|
|
|
use App\Support\OperationRunLinks;
|
|
use Illuminate\Support\Str;
|
|
|
|
final class RelatedActionLabelCatalog
|
|
{
|
|
/**
|
|
* @var array<string, string>
|
|
*/
|
|
private const ENTRY_LABELS = [
|
|
'baseline_profile' => 'Baseline profile',
|
|
'baseline_snapshot' => 'Snapshot',
|
|
'backup_set' => 'Backup set',
|
|
'current_policy_version' => 'Current policy version',
|
|
'operations' => 'Operations',
|
|
'parent_policy' => 'Policy',
|
|
'policy_version' => 'Policy version',
|
|
'restore_run' => 'Restore run',
|
|
'source_run' => 'Operation',
|
|
];
|
|
|
|
/**
|
|
* @var array<string, string>
|
|
*/
|
|
private const ACTION_LABELS = [
|
|
'baseline_profile' => 'View baseline profile',
|
|
'baseline_snapshot' => 'View snapshot',
|
|
'backup_set' => 'View backup set',
|
|
'current_policy_version' => 'View policy version',
|
|
'operations' => 'Open operations',
|
|
'parent_policy' => 'View policy',
|
|
'policy_version' => 'View policy version',
|
|
'restore_run' => 'View restore run',
|
|
'source_run' => 'Open operation',
|
|
];
|
|
|
|
public function entryLabel(string $relationKey): string
|
|
{
|
|
if ($relationKey === 'operations') {
|
|
return OperationRunLinks::collectionLabel();
|
|
}
|
|
|
|
if ($relationKey === 'source_run') {
|
|
return OperationRunLinks::singularLabel();
|
|
}
|
|
|
|
return self::ENTRY_LABELS[$relationKey] ?? Str::headline(str_replace('_', ' ', $relationKey));
|
|
}
|
|
|
|
public function actionLabel(string $relationKey): string
|
|
{
|
|
if ($relationKey === 'operations') {
|
|
return OperationRunLinks::openCollectionLabel();
|
|
}
|
|
|
|
if ($relationKey === 'source_run') {
|
|
return OperationRunLinks::openLabel();
|
|
}
|
|
|
|
return self::ACTION_LABELS[$relationKey] ?? 'Open '.Str::headline(str_replace('_', ' ', $relationKey));
|
|
}
|
|
|
|
public function unavailableMessage(string $relationKey, string $reason): string
|
|
{
|
|
$subject = mb_strtolower($this->entryLabel($relationKey));
|
|
|
|
return match ($reason) {
|
|
'missing', 'deleted' => "The related {$subject} is no longer available.",
|
|
'unauthorized' => "The related {$subject} is not available in the current scope.",
|
|
default => "The related {$subject} could not be resolved.",
|
|
};
|
|
}
|
|
}
|