From 9a8ee5664f583f8be20331f36295fc6672b07778 Mon Sep 17 00:00:00 2001 From: Remi Bergsma Date: Sun, 12 Apr 2015 23:20:29 -0500 Subject: [PATCH] CLOUDSTACK-6543 Sort domain lists in UI As recently discussed on the dev list: This sorts the domain lists based on their path. Especially handy when having a lot of domains, like in a public cloud. Cherry-picked to 4.5 branch since commit exists in 4.4 and master branch. (cherry picked from commit befa28251d0e250f07c52a9a2cd4441cc8bd86d8) Signed-off-by: Rohit Yadav --- ui/scripts/accountsWizard.js | 3 +++ ui/scripts/configuration.js | 9 +++++++++ ui/scripts/events.js | 3 +++ ui/scripts/instances.js | 6 ++++++ ui/scripts/network.js | 9 +++++++++ ui/scripts/projects.js | 3 +++ ui/scripts/regions.js | 3 +++ ui/scripts/sharedFunctions.js | 3 +++ ui/scripts/storage.js | 6 ++++++ ui/scripts/system.js | 27 ++++++++++++++++++++++++--- 10 files changed, 69 insertions(+), 3 deletions(-) diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js index 6b0dd19682f..82e7eabb390 100644 --- a/ui/scripts/accountsWizard.js +++ b/ui/scripts/accountsWizard.js @@ -92,6 +92,9 @@ if (this.level === 0) rootDomainId = this.id; }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items }); diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 724fcf73380..1f5de9e5584 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -552,6 +552,9 @@ description: this.path }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items }); @@ -1192,6 +1195,9 @@ description: this.path }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items }); @@ -1857,6 +1863,9 @@ description: this.path }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items }); diff --git a/ui/scripts/events.js b/ui/scripts/events.js index ea4b940b303..b3c6912daef 100644 --- a/ui/scripts/events.js +++ b/ui/scripts/events.js @@ -301,6 +301,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index eb30ee0e3c9..b8d1299f74d 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -230,6 +230,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); @@ -1632,6 +1635,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 436694389ba..9eaa33a6fb5 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -656,6 +656,9 @@ description: this.path }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items }); @@ -830,6 +833,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); @@ -5222,6 +5228,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js index 7453b535c0d..f6c91362f5a 100644 --- a/ui/scripts/projects.js +++ b/ui/scripts/projects.js @@ -734,6 +734,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 9f3de5ff42f..6e91f81bb49 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -377,6 +377,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 2ab4ca90ba3..1e1514b0be9 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -483,6 +483,9 @@ var addGuestNetworkDialog = { } }); } + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items }); diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 3d3db821cf7..d56835cd7e0 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -429,6 +429,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); @@ -1680,6 +1683,9 @@ }); } } + array1.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: array1 }); diff --git a/ui/scripts/system.js b/ui/scripts/system.js index bd9e9ca34f9..7169a95632a 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -7920,7 +7920,10 @@ description: this.name }); }); - + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); + args.response.success({ data: items }); @@ -13170,6 +13173,9 @@ description: this.name }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items @@ -13385,7 +13391,10 @@ description: this.name }); }); - + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); + args.response.success({ data: items }); @@ -13983,7 +13992,10 @@ description: this.name }); }); - + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); + args.response.success({ data: items }); @@ -14510,6 +14522,9 @@ description: this.name }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items @@ -15341,6 +15356,9 @@ description: this.name }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items @@ -15655,6 +15673,9 @@ description: this.name }); }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); args.response.success({ data: items