## Summary - implement the Action Surface Contract v1.1 runtime changes for Spec 169 - add the new explicit ActionSurfaceType contract, validator/discovery updates, and enrolled surface declarations - update Filament action-surface documentation, focused guard tests, and spec artifacts for the completed feature ## Included - clickable-row vs explicit-inspect enforcement across monitoring, reporting, CRUD, and system reference surfaces - helper-first, workflow-next, destructive-last overflow ordering checks - system panel list discovery in the primary action-surface validator - Spec 169 artifacts: spec, plan, tasks, research, data model, quickstart, and logical contract ## Verification - focused Pest verification pack completed for: - tests/Feature/Guards/ActionSurfaceValidatorTest.php - tests/Feature/Guards/ActionSurfaceContractTest.php - tests/Feature/Rbac/TenantActionSurfaceConsistencyTest.php - integrated browser smoke test completed for admin-side reference surfaces: - /admin/operations - /admin/audit-log - /admin/finding-exceptions/queue - /admin/reviews - /admin/tenants ## Notes - system panel browser smoke coverage could not be exercised in the same session because /system routes require platform authentication in the integrated browser - Livewire target remains v4-compliant and no provider registration or asset strategy changes are introduced by this PR Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #200
92 lines
3.3 KiB
PHP
92 lines
3.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Ui\ActionSurface;
|
|
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceProfile;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceSlot;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceType;
|
|
|
|
final class ActionSurfaceProfileDefinition
|
|
{
|
|
/**
|
|
* @return array<int, ActionSurfaceSlot>
|
|
*/
|
|
public function requiredSlots(ActionSurfaceProfile $profile): array
|
|
{
|
|
return match ($profile) {
|
|
ActionSurfaceProfile::CrudListAndEdit,
|
|
ActionSurfaceProfile::CrudListAndView => [
|
|
ActionSurfaceSlot::ListHeader,
|
|
ActionSurfaceSlot::InspectAffordance,
|
|
ActionSurfaceSlot::ListRowMoreMenu,
|
|
ActionSurfaceSlot::ListBulkMoreGroup,
|
|
ActionSurfaceSlot::ListEmptyState,
|
|
ActionSurfaceSlot::DetailHeader,
|
|
],
|
|
ActionSurfaceProfile::ListOnlyReadOnly => [
|
|
ActionSurfaceSlot::ListHeader,
|
|
ActionSurfaceSlot::InspectAffordance,
|
|
ActionSurfaceSlot::ListRowMoreMenu,
|
|
ActionSurfaceSlot::ListBulkMoreGroup,
|
|
ActionSurfaceSlot::ListEmptyState,
|
|
],
|
|
ActionSurfaceProfile::RunLog => [
|
|
ActionSurfaceSlot::ListHeader,
|
|
ActionSurfaceSlot::InspectAffordance,
|
|
ActionSurfaceSlot::ListBulkMoreGroup,
|
|
ActionSurfaceSlot::ListEmptyState,
|
|
ActionSurfaceSlot::DetailHeader,
|
|
],
|
|
ActionSurfaceProfile::RelationManager => [
|
|
ActionSurfaceSlot::ListHeader,
|
|
ActionSurfaceSlot::InspectAffordance,
|
|
ActionSurfaceSlot::ListRowMoreMenu,
|
|
ActionSurfaceSlot::ListBulkMoreGroup,
|
|
ActionSurfaceSlot::ListEmptyState,
|
|
],
|
|
};
|
|
}
|
|
|
|
public function requiresExportDefaultBulk(ActionSurfaceProfile $profile): bool
|
|
{
|
|
return in_array($profile, [
|
|
ActionSurfaceProfile::ListOnlyReadOnly,
|
|
ActionSurfaceProfile::RunLog,
|
|
], true);
|
|
}
|
|
|
|
/**
|
|
* @return array<int, ActionSurfaceType>
|
|
*/
|
|
public function allowedSurfaceTypes(ActionSurfaceProfile $profile): array
|
|
{
|
|
return match ($profile) {
|
|
ActionSurfaceProfile::CrudListAndEdit,
|
|
ActionSurfaceProfile::CrudListAndView => [
|
|
ActionSurfaceType::CrudListFirstResource,
|
|
ActionSurfaceType::ReadOnlyRegistryReport,
|
|
ActionSurfaceType::ConfigLite,
|
|
],
|
|
ActionSurfaceProfile::ListOnlyReadOnly => [
|
|
ActionSurfaceType::ReadOnlyRegistryReport,
|
|
],
|
|
ActionSurfaceProfile::RunLog => [
|
|
ActionSurfaceType::ReadOnlyRegistryReport,
|
|
ActionSurfaceType::QueueReview,
|
|
ActionSurfaceType::HistoryAudit,
|
|
],
|
|
ActionSurfaceProfile::RelationManager => [
|
|
ActionSurfaceType::CrudListFirstResource,
|
|
ActionSurfaceType::ReadOnlyRegistryReport,
|
|
],
|
|
};
|
|
}
|
|
|
|
public function allowsSurfaceType(ActionSurfaceProfile $profile, ActionSurfaceType $surfaceType): bool
|
|
{
|
|
return in_array($surfaceType, $this->allowedSurfaceTypes($profile), true);
|
|
}
|
|
}
|