authorize('viewAny', [Service::class, $this->server]); } public function getWidgets(): array { return [ [NodeJSList::class, ['server' => $this->server]], ]; } protected function getHeaderActions(): array { $installedNodeVersions = $this->server->installedNodejsVersions(); return [ Action::make('install') ->authorize(fn () => auth()->user()?->can('create', [Service::class, $this->server])) ->label('Install Node') ->icon('heroicon-o-archive-box-arrow-down') ->modalWidth(MaxWidth::Large) ->form([ Select::make('version') ->options( collect((array) config('core.nodejs_versions')) ->filter(fn ($version): bool => ! in_array($version, array_merge($installedNodeVersions, [NodeJS::NONE]))) ->mapWithKeys(fn ($version) => [$version => $version]) ->toArray() ) ->rules(InstallNewNodeJsVersion::rules($this->server)['version']), ]) ->modalSubmitActionLabel('Install') ->action(function (array $data): void { app(InstallNewNodeJsVersion::class)->install($this->server, $data); Notification::make() ->success() ->title('Installing Node...') ->send(); $this->dispatch('$refresh'); }), ]; } }