luci-base: network.js: sort interface statuses by metric, then name
[project/luci.git] / modules / luci-base / htdocs / luci-static / resources / network.js
index 1f749c593cacffeddd02de6f4c2f64bc77ffa65e..1e24915f979ff700a7961cfef1f86c0227b15344 100644 (file)
@@ -1453,6 +1453,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));
        },