diff options
author | Jo-Philipp Wich <jo@mein.io> | 2017-12-07 14:03:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-07 14:03:54 +0100 |
commit | a41215581d916d2716d6ffb2428a0cfd83bb4e92 (patch) | |
tree | a9f50f8a146d1486a7e9b339e46e9933f6900658 /modules/luci-mod-admin-full/luasrc | |
parent | 78ebfba390168b7ba801db1ec8d694a7a90d3786 (diff) | |
parent | 0a2c7b9e5c1745e28451825c838fc38752bebf60 (diff) |
Merge pull request #1452 from mkresin/master
fix DHCPv6 hostname display
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc')
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm | 17 | ||||
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm | 17 |
2 files changed, 18 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 b4baedff2..ea6ee91c7 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,16 @@ tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); var host = hosts[duid2mac(st[1][i].duid)]; - if (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 = + (host && host.name && st[1][i].hostname != host.name) + ? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(st[1][i].hostname, host.name) + : 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 5979210e2..18f66c2a8 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,16 @@ tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); var host = hosts[duid2mac(info.leases6[i].duid)]; - if (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 = + (host && host.name && info.leases6[i].hostname != host.name) + ? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name) + : info.leases6[i].hostname; tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr; tr.insertCell(-1).innerHTML = info.leases6[i].duid; |