From 9f5a1de8b1f32c30c6f9c0ade42b418ce0aeacd4 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Thu, 16 Nov 2017 07:32:58 +0100 Subject: [PATCH] luci-mod-admin-full: always indicate missing DHCPv6 hostname 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 --- .../luasrc/view/admin_network/lease_status.htm | 14 ++++++-------- .../luasrc/view/admin_status/index.htm | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm index 7e2cc090e..1f50db5b9 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm @@ -78,15 +78,13 @@ 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( - '
%s
', - ((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)) + ? '
? (%h)
'.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; diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index a46ee835c..626532e1b 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -417,15 +417,13 @@ 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( - '
%s
', - ((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)) + ? '
? (%h)
'.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; -- 2.25.1