label('External links') ->icon('heroicon-o-arrow-top-right-on-square') ->color('gray') ->visible(fn (): bool => $this->getRecord() instanceof Tenant && TenantResource::tenantViewExternalGroupVisible($this->getRecord())), Actions\ActionGroup::make([ TenantResource::makeSyncTenantAction(), TenantResource::makeVerifyConfigurationAction('tenant_view_header'), TenantResource::rbacAction(), UiEnforcement::forAction( Actions\Action::make('refresh_rbac') ->label('Refresh RBAC status') ->icon('heroicon-o-arrow-path') ->color('primary') ->requiresConfirmation() ->visible(fn (Tenant $record): bool => $record->isActive()) ->action(function (Tenant $record): void { $user = auth()->user(); if (! $user instanceof User) { abort(403); } if (! $user->canAccessTenant($record)) { abort(404); } /** @var OperationRunService $runs */ $runs = app(OperationRunService::class); $opRun = $runs->ensureRun( tenant: $record, type: OperationRunType::RbacHealthCheck->value, inputs: [ 'tenant_id' => (int) $record->getKey(), 'surface' => 'tenant_view_header', ], initiator: $user, ); $runUrl = OperationRunLinks::tenantlessView($opRun); if ($opRun->wasRecentlyCreated === false) { OpsUxBrowserEvents::dispatchRunEnqueued($this); OperationUxPresenter::alreadyQueuedToast((string) $opRun->type) ->actions([ Actions\Action::make('view_run') ->label(OperationRunLinks::openLabel()) ->url($runUrl), ]) ->send(); return; } RefreshTenantRbacHealthJob::dispatch( (int) $record->getKey(), (int) $user->getKey(), $opRun, ); OpsUxBrowserEvents::dispatchRunEnqueued($this); OperationUxPresenter::queuedToast((string) $opRun->type) ->actions([ Actions\Action::make('view_run') ->label(OperationRunLinks::openLabel()) ->url($runUrl), ]) ->send(); }), ) ->preserveVisibility() ->requireCapability(Capabilities::PROVIDER_RUN) ->apply(), ]) ->label('Setup') ->icon('heroicon-o-wrench-screwdriver') ->color('gray') ->visible(fn (): bool => $this->getRecord() instanceof Tenant && TenantResource::tenantViewSetupGroupVisible($this->getRecord())), Actions\ActionGroup::make([ TenantResource::makeTenantViewMarkReviewedAction(), TenantResource::makeTenantViewMarkFollowUpNeededAction(), ]) ->label('Triage') ->icon('heroicon-o-check-circle') ->color('gray') ->visible(fn (): bool => $this->getRecord() instanceof Tenant && TenantResource::tenantViewTriageGroupVisible($this->getRecord())), Actions\ActionGroup::make([ TenantResource::makeRestoreTenantAction(TenantActionSurface::TenantViewHeader), TenantResource::makeArchiveTenantAction(TenantActionSurface::TenantViewHeader), ]) ->label('Lifecycle') ->icon('heroicon-o-archive-box') ->color('gray') ->visible(fn (): bool => $this->getRecord() instanceof Tenant && TenantResource::tenantViewLifecycleGroupVisible($this->getRecord())), ])); } }