*/ protected function getHeaderActions(): array { $actions = [ Action::make('refresh') ->label('Refresh') ->icon('heroicon-o-arrow-path') ->color('gray') ->url(fn (): string => isset($this->run) ? route('admin.operations.view', ['run' => (int) $this->run->getKey()]) : route('admin.operations.index')), ]; if (! isset($this->run)) { return $actions; } $user = auth()->user(); $tenant = $this->run->tenant; if ($tenant instanceof Tenant && (! $user instanceof User || ! app(CapabilityResolver::class)->isMember($user, $tenant))) { $tenant = null; } $related = OperationRunLinks::related($this->run, $tenant); $relatedActions = []; foreach ($related as $label => $url) { $relatedActions[] = Action::make(Str::slug((string) $label, '_')) ->label((string) $label) ->url((string) $url) ->openUrlInNewTab(); } if ($relatedActions !== []) { $actions[] = ActionGroup::make($relatedActions) ->label('Open') ->icon('heroicon-o-arrow-top-right-on-square') ->color('gray'); } return $actions; } public function mount(OperationRun $run): void { $user = auth()->user(); if (! $user instanceof User) { abort(403); } $workspaceId = (int) ($run->workspace_id ?? 0); if ($workspaceId <= 0) { abort(404); } $isMember = WorkspaceMembership::query() ->where('workspace_id', $workspaceId) ->where('user_id', (int) $user->getKey()) ->exists(); if (! $isMember) { abort(404); } $this->run = $run->loadMissing(['workspace', 'tenant', 'user']); } public function infolist(Schema $schema): Schema { return OperationRunResource::infolist($schema); } public function defaultInfolist(Schema $schema): Schema { return $schema ->record($this->run) ->columns(2); } public function content(Schema $schema): Schema { return $schema->schema([ EmbeddedSchema::make('infolist'), ]); } }