Skip to content

Commit 0f07d6b

Browse files
lancepiochDaneEveritt
authored andcommitted
The nodes create page will redirect you to the locations page if you don't have a location, the concept is the same here (pterodactyl#640)
1 parent 7c41a69 commit 0f07d6b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ public function index()
226226
*/
227227
public function create()
228228
{
229+
$nodes = $this->nodeRepository->all();
230+
if (count($nodes) < 1) {
231+
$this->alert->warning(trans('admin/server.alerts.node_required'))->flash();
232+
233+
return redirect()->route('admin.nodes');
234+
}
235+
229236
$services = $this->serviceRepository->getWithOptions();
230237

231238
Javascript::put([

resources/lang/en/admin/server.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
'server_reinstalled' => 'This server has been queued for a reinstallation beginning now.',
4242
'details_updated' => 'Server details have been successfully updated.',
4343
'docker_image_updated' => 'Successfully changed the default Docker image to use for this server. A reboot is required to apply this change.',
44+
'node_required' => 'You must have at least one node configured before you can add a server to this panel.',
4445
],
4546
];

0 commit comments

Comments
 (0)