From 840413843b2cebb6db48252cdd0c730890ad5830 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Thu, 24 Oct 2024 22:00:50 +1100 Subject: [PATCH] Network diagram - Alphabetical sorting #860 --- front/network.php | 36 ++- front/pluginsCoreOld.php | 599 --------------------------------------- 2 files changed, 23 insertions(+), 612 deletions(-) delete mode 100755 front/pluginsCoreOld.php diff --git a/front/network.php b/front/network.php index cda833a6..4616c15e 100755 --- a/front/network.php +++ b/front/network.php @@ -481,21 +481,31 @@ return; } - devicesListnew = rawData["data"].map(item => { return { - "name":item[0], - "type":item[2], - "icon":item[3], - "mac":item[11], - "parentMac":item[14], - "rowid":item[13], - "status":item[10], - "childrenQty":item[15], - "port":item[18] - }}) + devicesListnew = rawData["data"].map(item => { + return { + "name": item[0], + "type": item[2], + "icon": item[3], + "mac": item[11], + "parentMac": item[14], + "rowid": item[13], + "status": item[10], + "childrenQty": item[15], + "port": item[18] + }; + }).sort((a, b) => { + // First sort by name alphabetically + const nameCompare = a.name.localeCompare(b.name); + if (nameCompare !== 0) { + return nameCompare; + } + // If names are the same, sort by port numerically + return a.port - b.port; + }); - setCache('devicesListNew', JSON.stringify(devicesListnew)) + setCache('devicesListNew', JSON.stringify(devicesListnew)); - // init global variable + // Init global variable deviceListGlobal = devicesListnew; diff --git a/front/pluginsCoreOld.php b/front/pluginsCoreOld.php deleted file mode 100755 index 0f4abef2..00000000 --- a/front/pluginsCoreOld.php +++ /dev/null @@ -1,599 +0,0 @@ - - - - - -
-
-
- - -
-
-
- - - -