diff --git a/CHANGELOG.md b/CHANGELOG.md index a623e9d09..a27383f97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,14 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * `[beta.3]` — Fixes error handling of the settings service provider when no migrations have been run. * `[beta.3]` — Fixes validation error when trying to use 'None' as the 'Copy Script From' option for an egg script. * Fixes a design bug in the database that prevented the storage of negative numbers, thus preventing a server from being assigned unlimited swap. +* Fixes a bug where the 'Assign New Allocations' box would only show IPs that were present in the current pagination block. ### Added * Nest and Egg listings now show the associated ID in order to make API requests easier. +### Changed +* Changed behavior of allocation IP Address/Ports box to automatically store the value entered if a user unfocuses the field without hitting space. + ## v0.7.0-beta.3 (Derelict Dermodactylus) ### Fixed * `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances. diff --git a/app/Contracts/Repository/AllocationRepositoryInterface.php b/app/Contracts/Repository/AllocationRepositoryInterface.php index fa854e24a..22ca07656 100644 --- a/app/Contracts/Repository/AllocationRepositoryInterface.php +++ b/app/Contracts/Repository/AllocationRepositoryInterface.php @@ -22,4 +22,12 @@ interface AllocationRepositoryInterface extends RepositoryInterface * @return \Illuminate\Support\Collection */ public function getAllocationsForNode(int $node): Collection; + + /** + * Return all of the unique IPs that exist for a given node. + * + * @param int $node + * @return \Illuminate\Support\Collection + */ + public function getUniqueAllocationIpsForNode(int $node): Collection; } diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index a2b80b4f9..e5d50fb40 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -210,15 +210,16 @@ class NodesController extends Controller * * @param \Pterodactyl\Models\Node $node * @return \Illuminate\View\View - * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function viewAllocation(Node $node) { $this->repository->loadNodeAllocations($node); Javascript::put(['node' => collect($node)->only(['id'])]); - return view('admin.nodes.view.allocation', ['node' => $node]); + return view('admin.nodes.view.allocation', [ + 'allocations' => $this->allocationRepository->setColumns(['ip'])->getUniqueAllocationIpsForNode($node->id), + 'node' => $node, + ]); } /** diff --git a/app/Repositories/Eloquent/AllocationRepository.php b/app/Repositories/Eloquent/AllocationRepository.php index 674d8b8fd..1a89134ca 100644 --- a/app/Repositories/Eloquent/AllocationRepository.php +++ b/app/Repositories/Eloquent/AllocationRepository.php @@ -40,4 +40,18 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos { return $this->getBuilder()->where('node_id', $node)->get($this->getColumns()); } + + /** + * Return all of the unique IPs that exist for a given node. + * + * @param int $node + * @return \Illuminate\Support\Collection + */ + public function getUniqueAllocationIpsForNode(int $node): Collection + { + return $this->getBuilder()->where('node_id', $node) + ->groupBy('ip') + ->orderByRaw('INET_ATON(ip) ASC') + ->get($this->getColumns()); + } } diff --git a/resources/themes/pterodactyl/admin/nodes/view/allocation.blade.php b/resources/themes/pterodactyl/admin/nodes/view/allocation.blade.php index 50a6a84e5..75b40811c 100644 --- a/resources/themes/pterodactyl/admin/nodes/view/allocation.blade.php +++ b/resources/themes/pterodactyl/admin/nodes/view/allocation.blade.php @@ -90,7 +90,7 @@