From ee07c302073db861766e376c6362daf48c6f97b9 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 1 Mar 2021 10:42:10 +0100 Subject: [PATCH] luci-base: network.js: sort interface statuses by metric, then name Fixes: #4693 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 0ee422b4c0e266f0ece70fa60e0ebfa84851992e) --- .../htdocs/luci-static/resources/network.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js index 5c6d732d67..80d413e4d4 100644 --- a/modules/luci-base/htdocs/luci-static/resources/network.js +++ b/modules/luci-base/htdocs/luci-static/resources/network.js @@ -1437,6 +1437,18 @@ Network = baseclass.extend(/** @lends LuCI.network.prototype */ { } } + rv.sort(function(a, b) { + if (a.metric != b.metric) + return (a.metric - b.metric); + + if (a.interface < b.interface) + return -1; + else if (a.interface > b.interface) + return 1; + + return 0; + }); + return rv; }, this)); }, -- 2.30.2