diff --git a/app/Http/Controllers/Admin/AjaxController.php b/app/Http/Controllers/Admin/AjaxController.php index a63609e59..20f4317c5 100644 --- a/app/Http/Controllers/Admin/AjaxController.php +++ b/app/Http/Controllers/Admin/AjaxController.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Controllers\Admin; use Debugbar; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Node; +use Pterodactyl\Models\ServiceOptions; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Http\Request; @@ -24,6 +25,12 @@ class AjaxController extends Controller } + /** + * Returns a JSON tree of all avaliable nodes in a given location. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\View\View + */ public function postNewServerGetNodes(Request $request) { @@ -33,10 +40,16 @@ class AjaxController extends Controller ], 500); } - return response(Node::select('id', 'name', 'public')->where('location', $request->input('location'))->get()->toJson()); + return response()->json(Node::select('id', 'name', 'public')->where('location', $request->input('location'))->get()); } + /** + * Returns a JSON tree of all avaliable IPs and Ports on a given node. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\View\View + */ public function postNewServerGetIps(Request $request) { @@ -60,4 +73,23 @@ class AjaxController extends Controller } + /** + * Returns a JSON tree of all avaliable options for a given service. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\View\View + */ + public function postNewServerServiceOptions(Request $request) + { + + if(!$request->input('service')) { + return response()->json([ + 'error' => 'Missing service in request.' + ], 500); + } + + return response()->json(ServiceOptions::select('id', 'name')->where('parent_service', $request->input('service'))->orderBy('name', 'asc')->get()); + + } + } diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index d5834c270..ce520564e 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -4,8 +4,8 @@ namespace Pterodactyl\Http\Controllers\Admin; use Debugbar; use Pterodactyl\Models\Server; -use Pterodactyl\Models\Node; use Pterodactyl\Models\Location; +use Pterodactyl\Models\Service; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Http\Request; @@ -38,7 +38,8 @@ class ServersController extends Controller public function getNew(Request $request) { return view('admin.servers.new', [ - 'locations' => Location::all() + 'locations' => Location::all(), + 'services' => Service::all() ]); } diff --git a/app/Http/Routes/AdminRoutes.php b/app/Http/Routes/AdminRoutes.php index ed89779fa..582a788c8 100644 --- a/app/Http/Routes/AdminRoutes.php +++ b/app/Http/Routes/AdminRoutes.php @@ -28,6 +28,7 @@ class AdminRoutes { $router->group(['prefix' => 'ajax'], function ($server) use ($router) { $router->post('/new/server/get-nodes', [ 'uses' => 'Admin\AjaxController@postNewServerGetNodes' ]); $router->post('/new/server/get-ips', [ 'uses' => 'Admin\AjaxController@postNewServerGetIps' ]); + $router->post('/new/server/service-options', [ 'uses' => 'Admin\AjaxController@postNewServerServiceOptions' ]); }); }); diff --git a/public/css/bootstrap.css b/public/css/bootstrap.css index 45adcab38..199189cc3 100755 --- a/public/css/bootstrap.css +++ b/public/css/bootstrap.css @@ -1205,4 +1205,4 @@ input[type=checkbox],input[type=radio]{margin-top:1px} .dropdown-header{padding-left:15px;padding-right:15px;font-size:9px;text-transform:uppercase} .popover{color:#fff;font-size:12px;font-weight:300} .panel-footer,.panel-heading{border-top-right-radius:0;border-top-left-radius:0} -.modal .close,.panel-default .close{color:#222} \ No newline at end of file +.modal .close,.panel-default .close{color:#222} diff --git a/public/css/pterodactyl.css b/public/css/pterodactyl.css index a43260d74..b28497705 100755 --- a/public/css/pterodactyl.css +++ b/public/css/pterodactyl.css @@ -73,3 +73,4 @@ pre{display:block;padding:12px 12px;margin:0;font-size:12px;color:#c7254e;backgr .close {color:#000;opacity:0.2;font-size:1.6em;} .close:hover {color:#000;opacity:0.5;} .filename {outline: none;width:450px;background: transparent;margin-left:-5px;padding:0;border: 0px;font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight: 250;line-height: 1.1;font-size: 19px;color: #aaa} +form .text-muted {margin: 0 0 -5.5px} diff --git a/resources/views/admin/servers/new.blade.php b/resources/views/admin/servers/new.blade.php index cdfb68e85..18a2bc8e5 100644 --- a/resources/views/admin/servers/new.blade.php +++ b/resources/views/admin/servers/new.blade.php @@ -7,10 +7,10 @@ @section('content')
+

Create New Server


@@ -19,7 +19,7 @@
-

Character limits: a-zA-Z0-9_- and [Space] (max 35 characters)

+

Character limits: a-zA-Z0-9_- and [Space] (max 35 characters)

@@ -33,7 +33,7 @@
- +
@@ -43,6 +43,7 @@ @endforeach +

The location in which this server will be deployed.

@@ -61,12 +63,97 @@ +

Select the main IP that this server will be listening on. You can assign additional open IPs and ports below.

+
+ + +
+
+
+ +
+ + MB +
+
+
+ +
+ + MB +
+
+
+ +
+ + % +
+
+
+ +
+ + I/O +
+
+
+
+
+

If you do not want to limit CPU usage set the value to 0. To determine a value, take the number physical cores and multiply it by 100. For example, on a quad core system (4 * 100 = 400) there is 400% available. To limit a server to using half of a single core, you would set the value to 50. To allow a server to use up to two physical cores, set the value to 200. BlockIO should be a value between 10 and 1000. Please see this documentation for more information about it.

+

+
+
+
+
+
+
+ +
+ +
+ +

Select the type of service that this server will be running.

+
+
+ +
+
+
+
+
+
+
+ +
+ + + + +
+

If you would like to use a custom docker image for this server please enter it here. Most users can ignore this option.

@@ -76,9 +163,15 @@