From cdd9d6bc7afa94b2c106f10e2dcc2110708ac145 Mon Sep 17 00:00:00 2001 From: Gunnar Mills Date: Fri, 9 Mar 2018 11:57:06 -0600 Subject: 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 --- app/common/services/api-utils.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 }); + }); } } } -- cgit v1.2.1