From 0acc260b81e9675f4b794e194bdd69d8a6a75292 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 8 Jan 2018 22:21:35 -0600 Subject: [PATCH] Change order that allocations are loaded in on the allocation listing --- CHANGELOG.md | 1 + app/Repositories/Eloquent/NodeRepository.php | 2 +- resources/lang/en/admin/node.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a27383f97..22629eb2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Changed * Changed behavior of allocation IP Address/Ports box to automatically store the value entered if a user unfocuses the field without hitting space. +* c order in which allocations are displayed to prioritize those with servers attached (in ascending IP & port order) followed by ascending IP & port order where no server is attached. ## v0.7.0-beta.3 (Derelict Dermodactylus) ### Fixed diff --git a/app/Repositories/Eloquent/NodeRepository.php b/app/Repositories/Eloquent/NodeRepository.php index f943441d1..4a640fb9a 100644 --- a/app/Repositories/Eloquent/NodeRepository.php +++ b/app/Repositories/Eloquent/NodeRepository.php @@ -106,7 +106,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa public function loadNodeAllocations(Node $node, bool $refresh = false): Node { $node->setRelation('allocations', - $node->allocations()->orderBy('ip', 'asc')->orderBy('port', 'asc')->with('server')->paginate(50) + $node->allocations()->orderByRaw('server_id IS NOT NULL DESC, server_id IS NULL')->orderByRaw('INET_ATON(ip) ASC')->orderBy('port', 'asc')->with('server')->paginate(50) ); return $node; diff --git a/resources/lang/en/admin/node.php b/resources/lang/en/admin/node.php index 875bde890..5d59e41ce 100644 --- a/resources/lang/en/admin/node.php +++ b/resources/lang/en/admin/node.php @@ -18,6 +18,6 @@ return [ 'location_required' => 'You must have at least one location configured before you can add a node to this panel.', 'node_created' => 'Successfully created new node. You can automatically configure the daemon on this machine by visiting the \'Configuration\' tab. Before you can add any servers you must first allocate at least one IP address and port.', 'node_updated' => 'Node information has been updated. If any daemon settings were changed you will need to reboot it for those changes to take effect.', - 'unallocated_deleted' => 'Deleted all unallocatred ports for :ip.', + 'unallocated_deleted' => 'Deleted all un-allocated ports for :ip.', ], ];