From 16222d1bd7e732042b5b0248c9662d059be17943 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 30 Sep 2016 16:05:39 -0400 Subject: [PATCH] redirect if no locations --- CHANGELOG.md | 1 + app/Http/Controllers/Admin/NodesController.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1426d64a..ce9568ebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Changed * Prevent clicking server start button until server is completely off, not just stopping. * Upon successful creation of a node it will redirect to the allocation tab and display a clearer message to add allocations. +* Trying to add a new node if no location exists redirects user to location management page and alerts them to add a location first. ### Fixed * Team Fortress named 'Insurgency' in panel in database seeder. ([#96](https://github.com/Pterodactyl/Panel/issues/96), PR by [@MeltedLux](https://github.com/MeltedLux)) diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index 097354834..e5025eadd 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -65,6 +65,11 @@ class NodesController extends Controller public function getNew(Request $request) { + if (!Models\Location::all()->count()) { + Alert::warning('You must add a location before you can add a new node.')->flash(); + return redirect()->route('admin.locations'); + } + return view('admin.nodes.new', [ 'locations' => Models\Location::all() ]);