luci-mod-status,mod-network: Added fqdn-name to DHCPv4 lease table
authorMax S Kash <asukms@ya.ru>
Tue, 8 Mar 2022 13:57:01 +0000 (18:57 +0500)
committerFlorian Eckert <fe@dev.tdt.de>
Mon, 28 Mar 2022 07:52:05 +0000 (09:52 +0200)
Added code to display fcdn-name in DHCPv4 lease table.
(based on code in DHCPv6 lease table)

Signed-off-by: Max S Kash <asukms@ya.ru>
Indentation adjused and wrapped commit message
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js

index bf67785df1565fd67329f5fda1aadee2b6f3905d..5059b389b4234eb9c7e92f305ff3dea811759f4c 100644 (file)
@@ -726,8 +726,17 @@ return view.extend({
                                                        else
                                                                exp = '%t'.format(lease.expires);
 
+                                                       var hint = lease.macaddr ? hosts[lease.macaddr] : null,
+                                                           name = hint ? hint.name : null,
+                                                           host = null;
+
+                                                       if (name && lease.hostname && lease.hostname != name)
+                                                               host = '%s (%s)'.format(lease.hostname, name);
+                                                       else if (lease.hostname)
+                                                               host = lease.hostname;
+
                                                        return [
-                                                               lease.hostname || '?',
+                                                               host || '-',
                                                                lease.ipaddr,
                                                                lease.macaddr,
                                                                exp
index b93f26875d8603064b21912f9542fce1d2abc5f6..956c1b20f98261f2504221984b6e5249187127c1 100644 (file)
@@ -102,8 +102,16 @@ return baseclass.extend({
                        else
                                exp = '%t'.format(lease.expires);
 
+                       var hint = lease.macaddr ? machints.filter(function(h) { return h[0] == lease.macaddr })[0] : null,
+                           host = null;
+
+                       if (hint && lease.hostname && lease.hostname != hint[1])
+                               host = '%s (%s)'.format(lease.hostname, hint[1]);
+                       else if (lease.hostname)
+                               host = lease.hostname;
+
                        rows = [
-                               lease.hostname || '-',
+                               host || '-',
                                lease.ipaddr,
                                lease.macaddr,
                                exp