From 0f07d6bcf5d01f11df1e90a2bd0a6ed32b12c79f Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 21 Sep 2017 19:05:55 -0400 Subject: [PATCH] The nodes create page will redirect you to the locations page if you don't have a location, the concept is the same here (#640) --- app/Http/Controllers/Admin/ServersController.php | 7 +++++++ resources/lang/en/admin/server.php | 1 + 2 files changed, 8 insertions(+) diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index db84291be..b87539951 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -226,6 +226,13 @@ class ServersController extends Controller */ public function create() { + $nodes = $this->nodeRepository->all(); + if (count($nodes) < 1) { + $this->alert->warning(trans('admin/server.alerts.node_required'))->flash(); + + return redirect()->route('admin.nodes'); + } + $services = $this->serviceRepository->getWithOptions(); Javascript::put([ diff --git a/resources/lang/en/admin/server.php b/resources/lang/en/admin/server.php index 6cf48223a..4f5840b59 100644 --- a/resources/lang/en/admin/server.php +++ b/resources/lang/en/admin/server.php @@ -41,5 +41,6 @@ return [ 'server_reinstalled' => 'This server has been queued for a reinstallation beginning now.', 'details_updated' => 'Server details have been successfully updated.', 'docker_image_updated' => 'Successfully changed the default Docker image to use for this server. A reboot is required to apply this change.', + 'node_required' => 'You must have at least one node configured before you can add a server to this panel.', ], ];