From 6ffb7fd7f653cea8f74178b9157a945c93cfa828 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Mon, 7 Nov 2022 22:12:24 -0500 Subject: [PATCH] Show warning for a server's allocations if it's currently running --- .../Controllers/Admin/Servers/ServerViewController.php | 7 +++++++ resources/views/admin/servers/view/build.blade.php | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/app/Http/Controllers/Admin/Servers/ServerViewController.php b/app/Http/Controllers/Admin/Servers/ServerViewController.php index 7cf64a2f5..d53a815c3 100644 --- a/app/Http/Controllers/Admin/Servers/ServerViewController.php +++ b/app/Http/Controllers/Admin/Servers/ServerViewController.php @@ -61,8 +61,15 @@ class ServerViewController extends Controller { $allocations = $server->node->allocations->toBase(); + try { + $stats = $server->getStats(); + } catch (\Exception) { + // Can't connect to daemon + } + return $this->view->make('admin.servers.view.build', [ 'server' => $server, + 'currentState' => $stats['current_state'] ?? null, 'assigned' => $allocations->where('server_id', $server->id)->sortBy('port')->sortBy('ip'), 'unassigned' => $allocations->where('server_id', null)->sortBy('port')->sortBy('ip'), ]); diff --git a/resources/views/admin/servers/view/build.blade.php b/resources/views/admin/servers/view/build.blade.php index f7ba9a2d2..d1f4e1879 100644 --- a/resources/views/admin/servers/view/build.blade.php +++ b/resources/views/admin/servers/view/build.blade.php @@ -129,6 +129,14 @@

Allocation Management

+ @if ($currentState === 'running') +
+ Warning, your server is currently running. + If you remove allocations without restarting, + then you can run into issues using them elsewhere. +
+ @endif +