luci-base: network.js: sort interface statuses by metric, then name
authorJo-Philipp Wich <jo@mein.io>
Mon, 1 Mar 2021 09:42:10 +0000 (10:42 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 1 Mar 2021 09:44:06 +0000 (10:44 +0100)
Fixes: #4693
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0ee422b4c0e266f0ece70fa60e0ebfa84851992e)

modules/luci-base/htdocs/luci-static/resources/network.js

index 5c6d732d67f18b6e9a4ec5fb5be0433ea1b8f93d..80d413e4d4aafc269db5e6ca2ed56e63c2f27a46 100644 (file)
@@ -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));
        },