diff --git a/CHANGELOG.md b/CHANGELOG.md index ce9568ebc..a61ce2026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### 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)) * Server allocation listing display now showing the connection IP unless an alias was assigned. +* Fixed bug where node allocation would appear to be successful but actual encounter an error. Made it cleared how to enter ports. ### Deprecated ### Removed diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index e5025eadd..24ac37614 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -27,6 +27,7 @@ use Alert; use Debugbar; use Log; use DB; +use Validator; use Pterodactyl\Models; use Pterodactyl\Repositories\NodeRepository; @@ -116,6 +117,10 @@ class NodesController extends Controller ->orderBy('allocations.ip', 'asc') ->orderBy('allocations.port', 'asc') ->paginate(20, ['*'], 'allocations'), + 'allocation_ips' => Models\Allocation::select('id', 'ip') + ->where('node', $node->id) + ->groupBy('ip') + ->get(), ]); } @@ -169,7 +174,7 @@ class NodesController extends Controller Alert::success('Deleted all unallocated ports for ' . $request->input('ip') . '.')->flash(); return redirect()->route('admin.nodes.view', [ 'id' => $node, - 'tab' => 'tab_allocations' + 'tab' => 'tab_allocation' ]); } @@ -198,6 +203,19 @@ class NodesController extends Controller public function postAllocations(Request $request, $id) { + + $validator = Validator::make($request->all(), [ + 'allocate_ip.*' => 'required|string', + 'allocate_port.*' => 'required' + ]); + + if ($validator->fails()) { + return redirect()->route('admin.nodes.view', [ + 'id' => $id, + 'tab' => 'tab_allocation' + ])->withErrors($validator->errors())->withInput(); + } + $processedData = []; foreach($request->input('allocate_ip') as $ip) { if (!array_key_exists($ip, $processedData)) { @@ -217,9 +235,6 @@ class NodesController extends Controller } try { - if(empty($processedData)) { - throw new DisplayException('It seems that no data was passed to this function.'); - } $node = new NodeRepository; $node->addAllocations($id, $processedData); Alert::success('Successfully added new allocations to this node.')->flash(); diff --git a/resources/views/admin/nodes/view.blade.php b/resources/views/admin/nodes/view.blade.php index 5f70604fd..19742f069 100644 --- a/resources/views/admin/nodes/view.blade.php +++ b/resources/views/admin/nodes/view.blade.php @@ -275,7 +275,7 @@ }, "docker": { "socket": "/var/run/docker.sock", - "autoupdate_images": false + "autoupdate_images": true }, "sftp": { "path": "{{ $node->daemonBase }}", @@ -318,8 +318,8 @@
@@ -334,7 +334,7 @@ -

Please enter a comma (,) after each port or port range.

+

You must enter a comma (,) or press the enter key after each port or range that you enter. They should appear in a blue box.

@@ -468,12 +468,8 @@