mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-28 04:34:45 +02:00
Add force delete for servers
This commit is contained in:
parent
07244c38eb
commit
7bbbba37f5
@ -590,11 +590,17 @@ class EditServer extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\Action::make('Force Delete')
|
||||
->successRedirectUrl($this->getResource()::getUrl('index'))
|
||||
->color('danger')
|
||||
->action(fn (Server $server) => resolve(ServerDeletionService::class)->withForce()->handle($server))
|
||||
->requiresConfirmation(),
|
||||
Actions\Action::make('Delete')
|
||||
->successRedirectUrl($this->getResource()::getUrl('index'))
|
||||
->color('danger')
|
||||
->action(fn (Server $server) => resolve(ServerDeletionService::class)->handle($server))
|
||||
->requiresConfirmation(),
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Servers;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
@ -43,7 +44,7 @@ class ServerDeletionService
|
||||
{
|
||||
try {
|
||||
$this->daemonServerRepository->setServer($server)->delete();
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
} catch (Exception $exception) {
|
||||
// If there is an error not caused a 404 error and this isn't a forced delete,
|
||||
// go ahead and bail out. We specifically ignore a 404 since that can be assumed
|
||||
// to be a safe error, meaning the server doesn't exist at all on daemon so there
|
||||
|
Loading…
x
Reference in New Issue
Block a user