summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-09-13 14:18:43 +0200
committerJo-Philipp Wich <jo@mein.io>2019-09-13 14:18:43 +0200
commit2dd17fad6cfda3e54bc59de9a58fa789767a11d4 (patch)
tree0ee8ad30d1cd5d28ebd817af7a2d898d17d7622b /modules/luci-base
parent3734f88c3588600bb03a2a413b2f3979ff5a07cf (diff)
luci-base: network.js: implement Hosts.getMACHints()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/network.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js
index 235ea1e41..106139f26 100644
--- a/modules/luci-base/htdocs/luci-static/resources/network.js
+++ b/modules/luci-base/htdocs/luci-static/resources/network.js
@@ -1307,6 +1307,18 @@ Hosts = L.Class.extend({
if (this.hosts[mac].ipv6 == ip6addr)
return mac;
return null;
+ },
+
+ getMACHints: function(preferIp6) {
+ var rv = [];
+ for (var mac in this.hosts) {
+ var hint = this.hosts[mac].name ||
+ this.hosts[mac][preferIp6 ? 'ipv6' : 'ipv4'] ||
+ this.hosts[mac][preferIp6 ? 'ipv4' : 'ipv6'];
+
+ rv.push([mac, hint]);
+ }
+ return rv.sort(function(a, b) { return a[0] > b[0] });
}
});