diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2018-03-09 11:57:06 -0600 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-03-23 20:07:09 +0000 |
commit | cdd9d6bc7afa94b2c106f10e2dcc2110708ac145 (patch) | |
tree | ca531d6c2aab6f4683f98625d8d681ac72548f6f | |
parent | 08744f89dbd6356b2d1e8bdfa5fc3c9febd638fb (diff) | |
download | phosphor-webui-cdd9d6bc7afa94b2c106f10e2dcc2110708ac145.tar.gz phosphor-webui-cdd9d6bc7afa94b2c106f10e2dcc2110708ac145.zip |
Sort inventory subcomponents
Sort the inventory subcomponents by alphanumeric.
This sorting produces:
"core 0, core 1, core 2,... core 12, core 13"
Before the order was
"core 0, core 1, core 10, core 11, ... core 2, core 21"
Tested: Verified the order
Change-Id: I470684d39e5f6c850368b43fde8073b03556dd12
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rw-r--r-- | app/common/services/api-utils.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js index c8a7969..bc89eb1 100644 --- a/app/common/services/api-utils.js +++ b/app/common/services/api-utils.js @@ -998,6 +998,12 @@ window.angular && (function (angular) { data.title = title; hardwareData[componentIndex].sub_components.push(data); hardwareData[componentIndex].search_text += " " + title.toLowerCase(); + + // Sort the subcomponents alphanumeric so they are displayed on the + // inventory page in order (e.g. core 0, core 1, core 2, ... core 12, core 13) + hardwareData[componentIndex].sub_components.sort(function (a, b) { + return a.title.localeCompare(b.title, 'en', { numeric: true }); + }); } } } |