From e9762b427705ff3a89f501580eecd4b26a3bb23a Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 17 Feb 2017 19:59:40 -0500 Subject: [PATCH] Fixes port deletion for node allocations as well as server notes on allocations. closes #305 --- CHANGELOG.md | 4 ++++ app/Http/Controllers/Admin/NodesController.php | 4 ++-- app/Models/Allocation.php | 10 ++++++++++ resources/views/admin/nodes/view.blade.php | 10 +++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24a0972fb..1334a5e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,15 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * `[pre.2]` — Fixes inability to edit a server due to owner_id issues. * `[pre.2]` — Fixes bug when trying to add new subusers. * Emails sending with 'Pterodactyl Panel' as the from name. Now configurable by using `php artisan pterodactyl:mail` to update. +* `[pre.2]` — Fixes inability to delete accounts due to SQL changes. +* `[pre.2]` — Fixes bug with checking power-permissions that showed the wrong buttons. Also adds check back to sidebar to only show options a user can use. +* `[pre.2]` — Fixes allocation listing on node allocations tab as well as bug preventing deletion of port. ### Changed * `[pre.2]` — File Manager now displays relevant information on all screen sizes, and includes better button clicking mechanics for dropdown menu. * Reduced the number of database queries being executed when viewing a specific server. This is done by caching the query for up to 60 minutes in memcached. * User creation emails include more information and are sent by the event listener rather than the repository. +* Account password reset emails now auto-fill the email when clicking the link. ### Added * Notifications when a user is added or removed as a subuser for a server. diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index f90cab991..f4a60b5b2 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -108,7 +108,7 @@ class NodesController extends Controller 'servers.user', 'servers.service', 'servers.allocations', 'location' )->findOrFail($id); - $node->setRelation('allocations', $node->allocations()->paginate(40)); + $node->setRelation('allocations', $node->allocations()->with('server')->paginate(40)); return view('admin.nodes.view', [ 'node' => $node, @@ -151,7 +151,7 @@ class NodesController extends Controller public function deallocateSingle(Request $request, $node, $allocation) { - $query = Models\Allocation::where('node', $node)->whereNull('server_id')->where('id', $allocation)->delete(); + $query = Models\Allocation::where('node_id', $node)->whereNull('server_id')->where('id', $allocation)->delete(); if ((int) $query === 0) { return response()->json([ 'error' => 'Unable to find an allocation matching those details to delete.', diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index aad98ac63..cdcf79782 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -74,4 +74,14 @@ class Allocation extends Model { return ! is_null($this->ip_alias); } + + /** + * Gets information for the server associated with this allocation. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function server() + { + return $this->belongsTo(Server::class); + } } diff --git a/resources/views/admin/nodes/view.blade.php b/resources/views/admin/nodes/view.blade.php index 9b569d5c8..5a0879b72 100644 --- a/resources/views/admin/nodes/view.blade.php +++ b/resources/views/admin/nodes/view.blade.php @@ -356,16 +356,20 @@ @foreach($node->allocations as $allocation) - + {{ $allocation->ip }} {{ $allocation->port }} - @if(!is_null($allocation->assigned_to)){{ $allocation->assigned_to_name }}@endif + + @if(! is_null($allocation->server)) + {{ $allocation->server->name }} + @endif + - @if(is_null($allocation->assigned_to)) + @if(is_null($allocation->server_id)) @else