luci-mod-admin-full: always indicate missing DHCPv6 hostname
authorMathias Kresin <dev@kresin.me>
Thu, 16 Nov 2017 06:32:58 +0000 (07:32 +0100)
committerMathias Kresin <dev@kresin.me>
Fri, 17 Nov 2017 00:37:19 +0000 (01:37 +0100)
Don't show a DHCPv6 supplied hostname if none was send. It happens in
case the DUID can be mapped to the MAC-Address of an existing host and
the existing host has a name set.

Signed-off-by: Mathias Kresin <dev@kresin.me>
modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm
modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm

index 7e2cc090e439f5bf5818e78cdbd50390afcc64e0..1f50db5b9e45ac3df63d7c61926ad5513b093f5b 100644 (file)
                                                tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
 
                                        var host = hosts[duid2mac(st[1][i].duid)];
-                                       if (!st[1][i].hostname && host)
-                                               tr.insertCell(-1).innerHTML = String.format(
-                                                       '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
-                                                       ((host.name && (host.ipv4 || host.ipv6))
-                                                               ? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
-                                                               : '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
-                                               );
+                                       if (!st[1][i].hostname)
+                                               tr.insertCell(-1).innerHTML =
+                                                       (host && (host.name || host.ipv4 || host.ipv6))
+                                                               ? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
+                                                               : '?';
                                        else
-                                               tr.insertCell(-1).innerHTML = st[1][i].hostname ? st[1][i].hostname : '?';
+                                               tr.insertCell(-1).innerHTML = st[1][i].hostname;
 
                                        tr.insertCell(-1).innerHTML = st[1][i].ip6addr;
                                        tr.insertCell(-1).innerHTML = st[1][i].duid;
index a46ee835c3b70df12cadb841fcae40010c858c78..626532e1b9bb50ede8478192786cf78a281f0d05 100644 (file)
                                                tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
 
                                        var host = hosts[duid2mac(info.leases6[i].duid)];
-                                       if (!info.leases6[i].hostname && host)
-                                               tr.insertCell(-1).innerHTML = String.format(
-                                                       '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
-                                                       ((host.name && (host.ipv4 || host.ipv6))
-                                                               ? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
-                                                               : '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
-                                               );
+                                       if (!info.leases6[i].hostname)
+                                               tr.insertCell(-1).innerHTML =
+                                                       (host && (host.name || host.ipv4 || host.ipv6))
+                                                               ? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
+                                                               : '?';
                                        else
-                                               tr.insertCell(-1).innerHTML = info.leases6[i].hostname ? info.leases6[i].hostname : '?';
+                                               tr.insertCell(-1).innerHTML = info.leases6[i].hostname;
 
                                        tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
                                        tr.insertCell(-1).innerHTML = info.leases6[i].duid;