diff --git a/app/Filament/App/Resources/ServerResource/Pages/ListServers.php b/app/Filament/App/Resources/ServerResource/Pages/ListServers.php index 02d3a03c5..d4361b5b4 100644 --- a/app/Filament/App/Resources/ServerResource/Pages/ListServers.php +++ b/app/Filament/App/Resources/ServerResource/Pages/ListServers.php @@ -238,34 +238,34 @@ class ListServers extends ListRecords } /** @return Action[] */ - public static function getPowerActions(): array + public static function getPowerActions(Server $server): array { return [ Action::make('start') ->color('primary') ->icon('tabler-player-play-filled') - ->authorize(fn (Server $server) => auth()->user()->can(Permission::ACTION_CONTROL_START, $server)) - ->visible(fn (Server $server) => !$server->isInConflictState() & $server->retrieveStatus()->isStartable()) - ->dispatch('powerAction', fn (Server $server) => ['server' => $server, 'action' => 'start']), + ->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_START, $server)) + ->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isStartable()) + ->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'start']), Action::make('restart') ->color('gray') ->icon('tabler-reload') - ->authorize(fn (Server $server) => auth()->user()->can(Permission::ACTION_CONTROL_RESTART, $server)) - ->visible(fn (Server $server) => !$server->isInConflictState() & $server->retrieveStatus()->isRestartable()) - ->dispatch('powerAction', fn (Server $server) => ['server' => $server, 'action' => 'restart']), + ->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_RESTART, $server)) + ->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isRestartable()) + ->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'restart']), Action::make('stop') ->color('danger') ->icon('tabler-player-stop-filled') - ->authorize(fn (Server $server) => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $server)) - ->visible(fn (Server $server) => !$server->isInConflictState() & $server->retrieveStatus()->isStoppable()) - ->dispatch('powerAction', fn (Server $server) => ['server' => $server, 'action' => 'stop']), + ->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $server)) + ->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isStoppable()) + ->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'stop']), Action::make('kill') ->color('danger') ->icon('tabler-alert-square') ->tooltip('This can result in data corruption and/or data loss!') - ->authorize(fn (Server $server) => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $server)) - ->visible(fn (Server $server) => !$server->isInConflictState() & $server->retrieveStatus()->isKillable()) - ->dispatch('powerAction', fn (Server $server) => ['server' => $server, 'action' => 'kill']), + ->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $server)) + ->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isKillable()) + ->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'kill']), ]; } } diff --git a/resources/views/livewire/server-entry.blade.php b/resources/views/livewire/server-entry.blade.php index 6f4b25775..730829845 100644 --- a/resources/views/livewire/server-entry.blade.php +++ b/resources/views/livewire/server-entry.blade.php @@ -1,55 +1,62 @@ -