From 0c21d401e323de285324cc93c2e6a4f2c2c4a5bd Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 21 Sep 2017 19:03:29 -0400 Subject: [PATCH] Combine Locations and Nodes on Create Server page (#641) --- app/Models/Server.php | 2 ++ .../themes/pterodactyl/js/admin/new-server.js | 23 ----------------- .../pterodactyl/admin/servers/new.blade.php | 25 +++++++++---------- 3 files changed, 14 insertions(+), 36 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index b31a89a7c..2dd37c5f9 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -81,6 +81,8 @@ class Server extends Model implements CleansAttributes, ValidableContract 'disk' => 'required', 'service_id' => 'required', 'option_id' => 'required', + 'node_id' => 'required', + 'allocation_id' => 'required', 'pack_id' => 'sometimes', 'auto_deploy' => 'sometimes', 'custom_id' => 'sometimes', diff --git a/public/themes/pterodactyl/js/admin/new-server.js b/public/themes/pterodactyl/js/admin/new-server.js index ecc0b9fb7..2501a4cc9 100644 --- a/public/themes/pterodactyl/js/admin/new-server.js +++ b/public/themes/pterodactyl/js/admin/new-server.js @@ -27,9 +27,6 @@ $(document).ready(function() { $('#pPackId').select2({ placeholder: 'Select a Service Pack', }); - $('#pLocationId').select2({ - placeholder: 'Select a Location', - }).change(); $('#pNodeId').select2({ placeholder: 'Select a Node', }); @@ -100,29 +97,9 @@ $(document).on('click', function (event) { lastActiveBox.addClass('box-primary'); }); -var currentLocation = null; var curentNode = null; var NodeData = []; -$('#pLocationId').on('change', function (event) { - showLoader(); - currentLocation = $(this).val(); - currentNode = null; - - $.ajax({ - method: 'POST', - url: Router.route('admin.servers.new.nodes'), - headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }, - data: { location: currentLocation }, - }).done(function (data) { - NodeData = data; - $('#pNodeId').html('').select2({data: data}).change(); - }).fail(function (jqXHR) { - cosole.error(jqXHR); - currentLocation = null; - }).always(hideLoader); -}); - $('#pNodeId').on('change', function (event) { currentNode = $(this).val(); $.each(NodeData, function (i, v) { diff --git a/resources/themes/pterodactyl/admin/servers/new.blade.php b/resources/themes/pterodactyl/admin/servers/new.blade.php index 1fafa0e0f..fce6f538a 100644 --- a/resources/themes/pterodactyl/admin/servers/new.blade.php +++ b/resources/themes/pterodactyl/admin/servers/new.blade.php @@ -78,21 +78,20 @@
- - @foreach($locations as $location) - + + @foreach($location->nodes as $node) + + + + @endforeach + @endforeach -

The location in which this server will be deployed.

-
-
- -

The node which this server will be deployed to.

@@ -100,7 +99,7 @@

The main allocation that will be assigned to this server.

-
+

Additional allocations to assign to this server on creation.