luci-base: network.js: sort interface statuses by metric, then name

Fixes: #4693
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0ee422b4c0)
This commit is contained in:
Jo-Philipp Wich 2021-03-01 10:42:10 +01:00
parent 0e5057cbbb
commit ee07c30207

View 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));
},