diff --git a/CHANGELOG.md b/CHANGELOG.md index a61ce2026..027d9c0a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * 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. +* `Server\AjaxController@postSetConnection` is now `Server\AjaxController@postSetPrimary` and accepts one post parameter of `allocation` rather than a combined `ip:port` value. +* Port allocations on server view are now cleaner and should make more sense. ### 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/Server/AjaxController.php b/app/Http/Controllers/Server/AjaxController.php index baf745922..dd81c2184 100644 --- a/app/Http/Controllers/Server/AjaxController.php +++ b/app/Http/Controllers/Server/AjaxController.php @@ -171,35 +171,40 @@ class AjaxController extends Controller } /** - * [postSetConnection description] + * [postSetPrimary description] * @param Request $request * @param string $uuid * @return \Illuminate\Http\Response */ - public function postSetConnection(Request $request, $uuid) + public function postSetPrimary(Request $request, $uuid) { $server = Models\Server::getByUUID($uuid); - $allocation = Models\Allocation::findOrFail($server->allocation); - $this->authorize('set-connection', $server); - if ($request->input('connection') === $allocation->ip . ':' . $allocation->port) { + if ((int) $request->input('allocation') === $server->allocation) { return response()->json([ 'error' => 'You are already using this as your default connection.' ], 409); } try { + $allocation = Models\Allocation::where('id', $request->input('allocation'))->where('assigned_to', $server->id)->first(); + if (!$allocation) { + return response()->json([ + 'error' => 'No allocation matching your request was found in the system.' + ], 422); + } + $repo = new Repositories\ServerRepository; $repo->changeBuild($server->id, [ - 'default' => $request->input('connection'), + 'default' => $allocation->ip . ':' . $allocation->port, ]); return response('The default connection for this server has been updated. Please be aware that you will need to restart your server for this change to go into effect.'); } catch (DisplayValidationException $ex) { return response()->json([ 'error' => json_decode($ex->getMessage(), true), - ], 503); + ], 422); } catch (DisplayException $ex) { return response()->json([ 'error' => $ex->getMessage(), diff --git a/app/Http/Routes/ServerRoutes.php b/app/Http/Routes/ServerRoutes.php index 9707d4447..5a454fcd1 100644 --- a/app/Http/Routes/ServerRoutes.php +++ b/app/Http/Routes/ServerRoutes.php @@ -154,8 +154,8 @@ class ServerRoutes { ]); // Sets the Default Connection for the Server - $router->post('set-connection', [ - 'uses' => 'Server\AjaxController@postSetConnection' + $router->post('set-primary', [ + 'uses' => 'Server\AjaxController@postSetPrimary' ]); $router->post('settings/reset-database-password', [ diff --git a/public/themes/default/css/pterodactyl.css b/public/themes/default/css/pterodactyl.css index 6284089f9..0a5530468 100755 --- a/public/themes/default/css/pterodactyl.css +++ b/public/themes/default/css/pterodactyl.css @@ -185,3 +185,17 @@ li.btn.btn-default.pill:active,li.btn.btn-default.pill:focus,li.btn.btn-default. .text-v-center { vertical-align: middle !important; } + +.muted { + filter: alpha(opacity=20); + opacity: 0.2; +} + +.muted-hover:hover { + filter: alpha(opacity=100); + opacity: 1; +} + +.use-pointer { + cursor: pointer !important; +} diff --git a/resources/views/server/index.blade.php b/resources/views/server/index.blade.php index 0355e9b1f..92eb1bdc1 100644 --- a/resources/views/server/index.blade.php +++ b/resources/views/server/index.blade.php @@ -80,16 +80,36 @@