From 067d7dc9f708d5ebeda1072fb6dc82e960de0d81 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 28 May 2018 14:57:54 +0200 Subject: treewide: convert HTML tables to div Mostly convert HTML tables to div based markup to allow for easier styling in the future. Also change JS accessor code accordingly. Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/admin_network/iface_overview.htm | 32 +- .../luasrc/view/admin_network/iface_status.htm | 18 +- .../luasrc/view/admin_network/lease_status.htm | 128 ++++---- .../luasrc/view/admin_network/wifi_join.htm | 20 +- .../luasrc/view/admin_network/wifi_overview.htm | 144 ++++----- .../luasrc/view/admin_network/wifi_status.htm | 18 +- .../luasrc/view/admin_status/bandwidth.htm | 44 +-- .../luasrc/view/admin_status/connections.htm | 112 ++++--- .../luasrc/view/admin_status/index.htm | 351 +++++++++------------ .../luasrc/view/admin_status/iptables.htm | 68 ++-- .../luasrc/view/admin_status/load.htm | 64 ++-- .../luasrc/view/admin_status/routes.htm | 112 +++---- .../luasrc/view/admin_status/wireless.htm | 56 ++-- .../luasrc/view/admin_system/packages.htm | 84 ++--- 14 files changed, 589 insertions(+), 662 deletions(-) (limited to 'modules/luci-mod-admin-full/luasrc/view') diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm index 2512a35b3..14be40169 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm @@ -164,7 +164,7 @@ ifc.ip6addrs[i] ); } - + if (ifc.ip6prefix) { html += String.format('<%:IPv6-PD%>: %s
', ifc.ip6prefix); @@ -212,20 +212,20 @@
<%:Interface Overview%> - - - - - - +
+
+
<%:Network%>
+
<%:Status%>
+
<%:Actions%>
+
<% for i, net in ipairs(netlist) do local z = net[3] local c = z and z:get_color() or "#EEEEEE" local t = z and translate("Part of zone %q" % z:name()) or translate("No zone assigned") %> -
- - - - + + <% end %> -
<%:Network%><%:Status%><%:Actions%>
+
+
<%=net[1]:upper()%> @@ -235,19 +235,19 @@ ?
-
+ +
<%:Collecting data...%> -
+ +
'" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net[1]%>-ifc-edit" /> -
+ '" />
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm index b15dd13f3..58f5400da 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm @@ -71,17 +71,17 @@ ); //]]> - - - - - - -
+
+
+
+

? -
+ +
<%:Collecting data...%> -
+ + + <%+cbi/valuefooter%> 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 28a37dcd9..9005279a4 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 @@ -20,10 +20,10 @@ if (st && st[0] && tb) { /* clear all rows */ - while( tb.rows.length > 1 ) - tb.deleteRow(1); + while (tb.firstElementChild !== tb.lastElementChild) + tb.removeChild(tb.lastElementChild); - for( var i = 0; i < st[0].length; i++ ) + for (var i = 0; i < st[0].length; i++) { var timestr; @@ -34,24 +34,16 @@ else timestr = String.format('%t', st[0][i].expires); - var tr = tb.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); - - tr.insertCell(-1).innerHTML = st[0][i].hostname ? st[0][i].hostname : '?'; - tr.insertCell(-1).innerHTML = st[0][i].ipaddr; - tr.insertCell(-1).innerHTML = st[0][i].macaddr; - tr.insertCell(-1).innerHTML = timestr; + tb.appendChild(E('
'.format((i % 2) + 1), [ + E('
', st[0][i].hostname || '?'), + E('
', st[0][i].ipaddr), + E('
', st[0][i].macaddr), + E('
', timestr) + ])); } - if( tb.rows.length == 1 ) - { - var tr = tb.insertRow(-1); - tr.className = 'cbi-section-table-row'; - - var td = tr.insertCell(-1); - td.colSpan = 4; - td.innerHTML = '
<%:There are no active leases.%>
'; - } + if (tb.firstElementChild === tb.lastElementChild) + tb.appendChild(E('

<%:There are no active leases.%>
')); } var tb6 = document.getElementById('lease6_status_table'); @@ -60,10 +52,10 @@ tb6.parentNode.style.display = 'block'; /* clear all rows */ - while( tb6.rows.length > 1 ) - tb6.deleteRow(1); + while (tb6.firstElementChild !== tb6.lastElementChild) + tb6.removeChild(tb6.lastElementChild); - for( var i = 0; i < st[1].length; i++ ) + for (var i = 0; i < st[1].length; i++) { var timestr; @@ -74,35 +66,29 @@ else timestr = String.format('%t', st[1][i].expires); - var tr = tb6.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); - - var host = hosts[duid2mac(st[1][i].duid)]; - 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 = - (host && host.name && st[1][i].hostname != host.name) - ? '
%h (%h)
'.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; - tr.insertCell(-1).innerHTML = timestr; + var host = hosts[duid2mac(st[1][i].duid)], + name = st[1][i].hostname, + hint = null; + + if (!name) { + if (host) + hint = host.name || host.ipv4 || host.ipv6; + } + else { + if (host && host.name && st[1][i].hostname != host.name) + hint = host.name; + } + + tb6.appendChild(E('
'.format((i % 2) + 1), [ + E('
', hint ? '
%h (%h)
'.format(name || '?', hint) : (name || '?')), + E('
', st[1][i].ip6addr), + E('
', st[1][i].duid), + E('
', timestr) + ])); } - if( tb6.rows.length == 1 ) - { - var tr = tb6.insertRow(-1); - tr.className = 'cbi-section-table-row'; - - var td = tr.insertCell(-1); - td.colSpan = 4; - td.innerHTML = '
<%:There are no active leases.%>
'; - } + if (tb6.firstElementChild === tb6.lastElementChild) + tb6.appendChild(E('

<%:There are no active leases.%>
')); } } ); @@ -110,30 +96,30 @@
<%:Active DHCP Leases%> - - - - - - - - - - -
<%:Hostname%><%:IPv4-Address%><%:MAC-Address%><%:Leasetime remaining%>

<%:Collecting data...%>
+
+
+
<%:Hostname%>
+
<%:IPv4-Address%>
+
<%:MAC-Address%>
+
<%:Leasetime remaining%>
+
+
+

<%:Collecting data...%>
+
+
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm index 3533c6fa4..e9cfb3e85 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm @@ -91,24 +91,24 @@
- +
<% for i, net in ipairs(scanlist(3)) do net.encryption = net.encryption or { } %> -
- - - - + + <% end %> -
+
+

<%=percent_wifi_signal(net)%>%
-
+ +
<%=net.ssid and utl.pcdata(net.ssid) or "%s" % translate("hidden")%>
Channel: <%=net.channel%> | Mode: <%=net.mode%> | BSSID: <%=net.bssid%> | Encryption: <%=format_wifi_encryption(net.encryption)%> -
+ +
@@ -128,11 +128,11 @@
-
+
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm index 4465095ff..31f1fed81 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -195,8 +195,8 @@ { var assoctable = document.getElementById('iw-assoclist'); if (assoctable) - while (assoctable.rows.length > 1) - assoctable.rows[1].parentNode.removeChild(assoctable.rows[1]); + while (assoctable.firstElementChild !== assoctable.lastElementChild) + assoctable.removeChild(assoctable.lastElementChild); var devup = { }; var rowstyle = 1; @@ -293,7 +293,7 @@ if (assoctable) { var assoclist = [ ]; - for( var bssid in iw.assoclist ) + for (var bssid in iw.assoclist) { assoclist.push(iw.assoclist[bssid]); assoclist[assoclist.length-1].bssid = bssid; @@ -301,11 +301,8 @@ assoclist.sort(function(a, b) { a.bssid < b.bssid }); - for( var j = 0; j < assoclist.length; j++ ) + for (var j = 0; j < assoclist.length; j++) { - var tr = assoctable.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + rowstyle; - var icon; var q = (-1 * (assoclist[j].noise - assoclist[j].signal)) / 5; if (q < 1) @@ -319,48 +316,35 @@ else icon = "<%=resource%>/icons/signal-75-100.png"; - tr.insertCell(-1).innerHTML = String.format( - ' %h', - iw.device.name, iw.ifname - ); - - tr.insertCell(-1).innerHTML = nowrap(String.format('%h', iw.ssid ? iw.ssid : '?')); - tr.insertCell(-1).innerHTML = assoclist[j].bssid; - - var host = hosts[assoclist[j].bssid]; - if (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() - ); - else - tr.insertCell(-1).innerHTML = '?'; - - tr.insertCell(-1).innerHTML = String.format( - ' %d / %d <%:dBm%>', - assoclist[j].signal, assoclist[j].noise, assoclist[j].signal - assoclist[j].noise, - icon, - assoclist[j].signal, assoclist[j].noise - ); - - tr.insertCell(-1).innerHTML = nowrap(wifirate(assoclist[j], true)) + '
' + nowrap(wifirate(assoclist[j], false)); + var host = hosts[assoclist[j].bssid], + name = host ? (host.name || host.ipv4 || host.ipv6) : null, + hint = (host && host.name && (host.ipv4 || host.ipv6)) ? (host.ipv4 || host.ipv6) : null; + + assoctable.appendChild(E('
'.format(rowstyle), [ + E('
%h
' + .format(iw.device.name, iw.ifname)), + E('
%h
' + .format(iw.ssid || '?')), + E('
%h
' + .format(assoclist[j].bssid)), + E('
', hint ? '
%h (%h)
' + .format(name || '?', hint) : (name || '?')), + E('
%d / %d <%:dBm%>
' + .format(assoclist[j].signal, assoclist[j].noise, assoclist[j].signal - assoclist[j].noise, icon, assoclist[j].signal, assoclist[j].noise)), + E('
', [ + E('', wifirate(assoclist[j], true)), + E('
'), + E('', wifirate(assoclist[j], false)) + ]) + ])); rowstyle = (rowstyle == 1) ? 2 : 1; } } } - if (assoctable && assoctable.rows.length == 1) - { - var tr = assoctable.insertRow(-1); - tr.className = 'cbi-section-table-row'; - - var td = tr.insertCell(-1); - td.colSpan = 8; - td.innerHTML = '
<%:No information available%>'; - } + if (assoctable && assoctable.firstElementChild === assoctable.lastElementChild) + assoctable.appendChild(E('

<%:No information available%>
')); for (var dev in devup) { @@ -386,15 +370,17 @@ <% for _, dev in ipairs(devices) do local nets = dev:get_wifinets() %>
- +
-
- - - - + + <% if #nets > 0 then %> <% for i, net in ipairs(nets) do %> - - - - - - + + <% end %> <% else %> - - - - + + <% end %> -
+
+
+ +
+
<%=guess_wifi_hw(dev)%> (<%=dev:name()%>)
-
+ +
@@ -405,38 +391,36 @@
-
+
+
0% -
+ +
<%:Collecting data...%> -
+ +
-
+
+
<%:No network configured on this device%> -
+
<% end %> @@ -445,21 +429,21 @@

<%:Associated Stations%>

- - - - - - - - - - - - -
<%:SSID%><%:MAC-Address%><%:Host%><%:Signal%> / <%:Noise%><%:RX Rate%> / <%:TX Rate%>
+
+
+
+
<%:SSID%>
+
<%:MAC-Address%>
+
<%:Host%>
+
<%:Signal%> / <%:Noise%>
+
<%:RX Rate%> / <%:TX Rate%>
+
+
+
<%:Collecting data...%> -
+
+
+
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm index 04687f38e..85468252e 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm @@ -62,17 +62,17 @@ ); //]]> - - - - - - -
+
+
+
+

0% -
+ +
<%:Collecting data...%> -
+
+
+
<%+cbi/valuefooter%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm index 33bbee784..db1d0b888 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm @@ -275,27 +275,27 @@
-

- - - - - - - - - - - - - - - - - - - - - -
<%:Inbound:%>0 <%:kbit/s%>
(0 <%:kB/s%>)
<%:Average:%>0 <%:kbit/s%>
(0 <%:kB/s%>)
<%:Peak:%>0 <%:kbit/s%>
(0 <%:kB/s%>)
<%:Outbound:%>0 <%:kbit/s%>
(0 <%:kB/s%>)
<%:Average:%>0 <%:kbit/s%>
(0 <%:kB/s%>)
<%:Peak:%>0 <%:kbit/s%>
(0 <%:kB/s%>)
+
+
+
<%:Inbound:%>
+
0 <%:kbit/s%>
(0 <%:kB/s%>)
+ +
<%:Average:%>
+
0 <%:kbit/s%>
(0 <%:kB/s%>)
+ +
<%:Peak:%>
+
0 <%:kbit/s%>
(0 <%:kB/s%>)
+
+
+
<%:Outbound:%>
+
0 <%:kbit/s%>
(0 <%:kB/s%>)
+ +
<%:Average:%>
+
0 <%:kbit/s%>
(0 <%:kB/s%>)
+ +
<%:Peak:%>
+
0 <%:kbit/s%>
(0 <%:kB/s%>)
+
+
<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm index b7ebc4145..30d93f78b 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm @@ -139,8 +139,8 @@ { var conn = json.connections; - while (conn_table.rows.length > 1) - conn_table.rows[0].parentNode.deleteRow(-1); + while (conn_table.firstElementChild !== conn_table.lastElementChild) + conn_table.removeChild(conn_table.lastElementChild); var lookup_queue = [ ]; @@ -153,13 +153,10 @@ { var c = conn[i]; - if ((c.src == '127.0.0.1' && c.dst == '127.0.0.1') - || (c.src == '::1' && c.dst == '::1')) + if ((c.src == '127.0.0.1' && c.dst == '127.0.0.1') || + (c.src == '::1' && c.dst == '::1')) continue; - var tr = conn_table.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2)); - if (!dns_cache[c.src]) lookup_queue.push(c.src); @@ -169,14 +166,13 @@ var src = dns_cache[c.src] || (c.layer3 == 'ipv6' ? '[' + c.src + ']' : c.src); var dst = dns_cache[c.dst] || (c.layer3 == 'ipv6' ? '[' + c.dst + ']' : c.dst); - tr.insertCell(-1).innerHTML = c.layer3.toUpperCase(); - tr.insertCell(-1).innerHTML = c.layer4.toUpperCase(); - tr.insertCell(-1).innerHTML = String.format('%s:%d', src, c.sport); - tr.insertCell(-1).innerHTML = String.format('%s:%d', dst, c.dport); - - var traf = tr.insertCell(-1); - traf.style.whiteSpace = 'nowrap'; - traf.innerHTML = String.format('%1024.2mB (%d <%:Pkts.%>)', c.bytes, c.packets); + conn_table.appendChild(E('
'.format(1 + (i % 2)), [ + E('
', c.layer3.toUpperCase()), + E('
', c.layer4.toUpperCase()), + E('
', [ src, ':', c.sport ]), + E('
', [ dst, ':', c.dport ]), + E('
', '%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets)), + ])); } if (lookup_queue.length > 0) @@ -324,52 +320,52 @@
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<%:UDP:%>0<%:Average:%>0<%:Peak:%>0
<%:TCP:%>0<%:Average:%>0<%:Peak:%>0
<%:Other:%>0<%:Average:%>0<%:Peak:%>0
+
+
+
<%:UDP:%>
+
0
+ +
<%:Average:%>
+
0
+ +
<%:Peak:%>
+
0
+
+
+
<%:TCP:%>
+
0
+ +
<%:Average:%>
+
0
+ +
<%:Peak:%>
+
0
+
+
+
<%:Other:%>
+
0
+ +
<%:Average:%>
+
0
+ +
<%:Peak:%>
+
0
+
+

- - - - - - - - - - -
<%:Network%><%:Protocol%><%:Source%><%:Destination%><%:Transfer%>
<%:Collecting data...%>
+
+
+
<%:Network%>
+
<%:Protocol%>
+
<%:Source%>
+
<%:Destination%>
+
<%:Transfer%>
+
+ +
<%:Collecting data...%>
+
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 5e6e494ad..a72936f32 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 @@ -235,7 +235,7 @@ '<%:Type%>: %s%s
', ifc6.proto, (ifc6.ip6prefix) ? '-pd' : '' ); - + if (!ifc6.ip6prefix) { s += String.format( @@ -358,10 +358,10 @@ if (ls) { /* clear all rows */ - while( ls.rows.length > 1 ) - ls.rows[0].parentNode.deleteRow(1); + while (ls.firstElementChild !== ls.lastElementChild) + ls.removeChild(ls.lastElementChild); - for( var i = 0; i < info.leases.length; i++ ) + for (var i = 0; i < info.leases.length; i++) { var timestr; @@ -372,24 +372,16 @@ else timestr = String.format('%t', info.leases[i].expires); - var tr = ls.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); - - tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?'; - tr.insertCell(-1).innerHTML = info.leases[i].ipaddr; - tr.insertCell(-1).innerHTML = info.leases[i].macaddr; - tr.insertCell(-1).innerHTML = timestr; + ls.appendChild(E('
'.format((i % 2) + 1), [ + E('
', info.leases[i].hostname ? info.leases[i].hostname : '?'), + E('
', info.leases[i].ipaddr), + E('
', info.leases[i].macaddr), + E('
', timestr) + ])); } - if( ls.rows.length == 1 ) - { - var tr = ls.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row'; - - var td = tr.insertCell(-1); - td.colSpan = 4; - td.innerHTML = '
<%:There are no active leases.%>
'; - } + if (ls.firstElementChild === ls.lastElementChild) + ls.appendChild(E('

<%:There are no active leases.%>
')); } var ls6 = document.getElementById('lease6_status_table'); @@ -398,10 +390,10 @@ ls6.parentNode.style.display = 'block'; /* clear all rows */ - while( ls6.rows.length > 1 ) - ls6.rows[0].parentNode.deleteRow(1); + while (ls6.firstElementChild !== ls6.lastElementChild) + ls6.removeChild(ls6.lastElementChild); - for( var i = 0; i < info.leases6.length; i++ ) + for (var i = 0; i < info.leases6.length; i++) { var timestr; @@ -412,35 +404,29 @@ else timestr = String.format('%t', info.leases6[i].expires); - var tr = ls6.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); - - var host = hosts[duid2mac(info.leases6[i].duid)]; - 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 = - (host && host.name && info.leases6[i].hostname != host.name) - ? '
%h (%h)
'.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; - tr.insertCell(-1).innerHTML = timestr; - } + var host = hosts[duid2mac(info.leases6[i].duid)], + name = info.leases6[i].hostname, + hint = null; - if( ls6.rows.length == 1 ) - { - var tr = ls6.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row'; + if (!name) { + if (host) + hint = host.name || host.ipv4 || host.ipv6; + } + else { + if (host && host.name && info.leases6[i].hostname != host.name) + hint = host.name; + } - var td = tr.insertCell(-1); - td.colSpan = 4; - td.innerHTML = '
<%:There are no active leases.%>
'; + ls6.appendChild(E('
'.format((i % 2) + 1), [ + E('
', hint ? '
%h (%h)
'.format(name || '?', hint) : (name || '?')), + E('
', info.leases6[i].ip6addr), + E('
', info.leases6[i].duid), + E('
', timestr) + ])); } + + if (ls6.firstElementChild === ls6.lastElementChild) + ls6.appendChild(E('

<%:There are no active leases.%>
')); } <% end %> @@ -450,24 +436,12 @@ var ws = document.getElementById('wifi_status_table'); if (ws) { - var wsbody = ws.rows[0].parentNode; - while (ws.rows.length > 0) - wsbody.deleteRow(0); + while (ws.lastElementChild) + ws.removeChild(ws.lastElementChild); for (var didx = 0; didx < info.wifinets.length; didx++) { var dev = info.wifinets[didx]; - - var tr = wsbody.insertRow(-1); - var td; - - td = tr.insertCell(-1); - td.width = "33%"; - td.innerHTML = dev.name; - td.style.verticalAlign = "top"; - - td = tr.insertCell(-1); - var s = ''; for (var nidx = 0; nidx < dev.networks.length; nidx++) @@ -490,10 +464,10 @@ icon = "<%=resource%>/icons/signal-75-100.png"; s += String.format( - '
' + + '
' + '' + '
%d%%' + - '
' + + '
' + '<%:SSID%>: %h
' + '<%:Mode%>: %s
' + '<%:Channel%>: %d (%.3f <%:GHz%>)
' + @@ -520,7 +494,7 @@ s += '<%:Wireless is disabled or not associated%>'; } - s += '
'; + s += '
'; for (var bssid in net.assoclist) { @@ -539,7 +513,10 @@ if (!s) s = '<%:No information available%>'; - td.innerHTML = s; + ws.appendChild(E('
', [ + E('
', dev.name), + E('
', s) + ])); } } @@ -547,8 +524,8 @@ if (ac) { /* clear all rows */ - while( ac.rows.length > 1 ) - ac.rows[0].parentNode.deleteRow(1); + while (ac.firstElementChild !== ac.lastElementChild) + ac.removeChild(ac.lastElementChild); assoclist.sort(function(a, b) { return (a.name == b.name) @@ -557,11 +534,8 @@ ; }); - for( var i = 0; i < assoclist.length; i++ ) + for (var i = 0; i < assoclist.length; i++) { - var tr = ac.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2)); - var icon; var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5; if (q < 1) @@ -575,49 +549,31 @@ else icon = "<%=resource%>/icons/signal-75-100.png"; - tr.insertCell(-1).innerHTML = String.format( - ' %h', - assoclist[i].radio, assoclist[i].ifname - ); - - tr.insertCell(-1).innerHTML = String.format( - '%s', - assoclist[i].link, - '%h'.format(assoclist[i].name).nobr() - ); - - tr.insertCell(-1).innerHTML = assoclist[i].bssid; - - var host = hosts[assoclist[i].bssid]; - if (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() - ); - else - tr.insertCell(-1).innerHTML = '?'; - - tr.insertCell(-1).innerHTML = String.format( - ' %d / %d <%:dBm%>', - assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise, - icon, - assoclist[i].signal, assoclist[i].noise - ); - - tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '
' + wifirate(assoclist[i], false).nobr(); + var host = hosts[assoclist[i].bssid], + name = host ? (host.name || host.ipv4 || host.ipv6) : null, + hint = (host && host.name && (host.ipv4 || host.ipv6)) ? (host.ipv4 || host.ipv6) : null; + + ac.appendChild(E('
'.format(1 + (i % 2)), [ + E('
%h
' + .format(assoclist[i].radio, assoclist[i].ifname)), + E('' + .format(assoclist[i].link, assoclist[i].name)), + E('
', + assoclist[i].bssid), + E('
', + hint ? '
%h (%h)
'.format(name || '?', hint) : (name || '?')), + E('
%d / %d <%:dBm%>
' + .format(assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise, icon, assoclist[i].signal, assoclist[i].noise)), + E('
', [ + E('', wifirate(assoclist[i], true)), + E('
'), + E('', wifirate(assoclist[i], false)) + ]) + ])); } - if (ac.rows.length == 1) - { - var tr = ac.rows[0].parentNode.insertRow(-1); - tr.className = 'cbi-section-table-row'; - - var td = tr.insertCell(-1); - td.colSpan = 7; - td.innerHTML = '
<%:No information available%>'; - } + if (ac.firstElementChild === ac.lastElementChild) + ac.appendChild(E('

<%:No information available%>
')); } <% end %> @@ -679,108 +635,113 @@
<%:System%> - - - - - - - - -
<%:Hostname%><%=luci.sys.hostname() or "?"%>
<%:Model%><%=pcdata(boardinfo.model or boardinfo.system or "?")%>
<%:Firmware Version%> +
+
<%:Hostname%>
<%=luci.sys.hostname() or "?"%>
+
<%:Model%>
<%=pcdata(boardinfo.model or boardinfo.system or "?")%>
+
<%:Firmware Version%>
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> / <%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>) -
<%:Kernel Version%><%=unameinfo.release or "?"%>
<%:Local Time%>-
<%:Uptime%>-
<%:Load Average%>-
+
+
<%:Kernel Version%>
<%=unameinfo.release or "?"%>
+
<%:Local Time%>
-
+
<%:Uptime%>
-
+
<%:Load Average%>
-
+
<%:Memory%> - - - - -
<%:Total Available%>-
<%:Free%>-
<%:Buffered%>-
+
+
<%:Total Available%>
-
+
<%:Free%>
-
+
<%:Buffered%>
-
+
<% if swapinfo.total > 0 then %>
<%:Swap%> - - - -
<%:Total Available%>-
<%:Free%>-
+
+
<%:Total Available%>
-
+
<%:Free%>
-
+
<% end %>
<%:Network%> - - +
+
<%:IPv4 WAN Status%>
+
+

?
+
<%:Collecting data...%>
+
+
<% if has_ipv6 then %> -
+
<%:IPv6 WAN Status%>
+
+

?
+
<%:Collecting data...%>
+
+
<% end %> - -
<%:IPv4 WAN Status%> - - - -

?
<%:Collecting data...%>
-
<%:IPv6 WAN Status%> - - - -

?
<%:Collecting data...%>
-
<%:Active Connections%>-
+
<%:Active Connections%>
-
+
<% if has_dhcp then %>
<%:DHCP Leases%> - - - - - - - - - - -
<%:Hostname%><%:IPv4-Address%><%:MAC-Address%><%:Leasetime remaining%>

<%:Collecting data...%>
+
+
+
<%:Hostname%>
+
<%:IPv4-Address%>
+
<%:MAC-Address%>
+
<%:Leasetime remaining%>
+
+
+

<%:Collecting data...%>
+
+
<% end %> <% if has_dsl then %>
- <%:DSL%> - - -
<%:DSL Status%> - - - -

?
<%:Collecting data...%>
-
+ <%:DSL%> +
+
+
<%:DSL Status%>
+
+
+
+

?
+
<%:Collecting data...%>
+
+
+
+
+
<% end %> @@ -788,27 +749,27 @@
<%:Wireless%> - - -
<%:Collecting data...%>
+
+
<%:Collecting data...%>
+
<%:Associated Stations%> - - - - - - - - - - - - -
 <%:Network%><%:MAC-Address%><%:Host%><%:Signal%> / <%:Noise%><%:RX Rate%> / <%:TX Rate%>

<%:Collecting data...%>
+
+
+
 
+
<%:Network%>
+
<%:MAC-Address%>
+
<%:Host%>
+
<%:Signal%> / <%:Noise%>
+
<%:RX Rate%> / <%:TX Rate%>
+
+
+

<%:Collecting data...%>
+
+
<% end %> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm index 3f4b83b80..ced4d5f77 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm @@ -92,14 +92,14 @@ <% for _, tbl in ipairs(tables) do chaincnt = 0 %>

<%:Table%>: <%=tbl%>

- +
<% for _, chain in ipairs(ipt:chains(tbl)) do rowcnt = 0 chaincnt = chaincnt + 1 chaininfo = ipt:chain(tbl, chain) %> -
- - - - - - - - - - - - - + + +
+
<%:Pkts.%>
+
<%:Traffic%>
+
<%:Target%>
+
<%:Prot.%>
+
<%:In%>
+
<%:Out%>
+
<%:Source%>
+
<%:Destination%>
+
<%:Options%>
+
<% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %> - - - - - - - - - - - +
+
<%=rule.packets%>
+
<%=wba.byte_format(rule.bytes)%>
+
<%=rule.target and link_target(tbl, rule.target) or "-"%>
+
<%=rule.protocol%>
+
<%=link_iface(rule.inputif)%>
+
<%=link_iface(rule.outputif)%>
+
<%=rule.source%>
+
<%=rule.destination%>
+
<%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%>
+
<% end %> <% if rowcnt == 1 then %> - - - +
+
<%:No rules in this chain%>
+
<% end %> <% end %> <% if chaincnt == 0 then %> - - - +
+
<%:No chains in this table%>
+
<% end %> -
+
+

<%:Chain%> <%=chain%> (<%- if chaininfo.policy then -%> @@ -107,47 +107,47 @@ <%- else -%> <%:References%>: <%=chaininfo.references-%> <%- end -%>) -
<%:Pkts.%><%:Traffic%><%:Target%><%:Prot.%><%:In%><%:Out%><%:Source%><%:Destination%><%:Options%>
<%=rule.packets%><%=wba.byte_format(rule.bytes)%><%=rule.target and link_target(tbl, rule.target) or "-"%><%=rule.protocol%><%=link_iface(rule.inputif)%><%=link_iface(rule.outputif)%><%=rule.source%><%=rule.destination%><%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%>
<%:No rules in this chain%>
<%:No chains in this table%>
+


<% end %> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm index 97a2f5ed5..c8ada7156 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm @@ -248,37 +248,37 @@
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<%:1 Minute Load:%>0<%:Average:%>0<%:Peak:%>0
<%:5 Minute Load:%>0<%:Average:%>0<%:Peak:%>0
<%:15 Minute Load:%>0<%:Average:%>0<%:Peak:%>0
+
+
+
<%:1 Minute Load:%>
+
0
+ +
<%:Average:%>
+
0
+ +
<%:Peak:%>
+
0
+
+
+
<%:5 Minute Load:%>
+
0
+ +
<%:Average:%>
+
0
+ +
<%:Peak:%>
+
0
+
+
+
<%:15 Minute Load:%>
+
0
+ +
<%:Average:%>
+
0
+ +
<%:Peak:%>
+
0
+
+
<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm index f474c7156..af8037135 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm @@ -39,28 +39,28 @@
ARP
- - - - - - +
+
+
<%_IPv4-Address%>
+
<%_MAC-Address%>
+
<%:Interface%>
+
<% for _, v in ipairs(ip.neighbors({ family = 4 })) do if v.mac then %> -
- - - - +
+
<%=v.dest%>
+
<%=v.mac%>
+
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
+
<% style = not style end end %> -
<%_IPv4-Address%><%_MAC-Address%><%:Interface%>
<%=v.dest%><%=v.mac%><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
+

@@ -69,24 +69,24 @@ <%_Active IPv4-Routes%>
- - - - - - - - +
+
+
<%:Network%>
+
<%:Target%>
+
<%_IPv4-Gateway%>
+
<%:Metric%>
+
<%:Table%>
+
<% for _, v in ipairs(ip.routes({ family = 4, type = 1 })) do %> -
- - - - - - +
+
<%=luci.tools.webadmin.iface_get_network(v.dev) or v.dev%>
+
<%=v.dest%>
+
<%=v.gw%>
+
<%=v.metric or 0%>
+
<%=rtn[v.table] or v.table%>
+
<% style = not style end %> -
<%:Network%><%:Target%><%_IPv4-Gateway%><%:Metric%><%:Table%>
<%=luci.tools.webadmin.iface_get_network(v.dev) or v.dev%><%=v.dest%><%=v.gw%><%=v.metric or 0%><%=rtn[v.table] or v.table%>
+

@@ -99,31 +99,31 @@ <%_Active IPv6-Routes%>
- - - - - - - - +
+
+
<%:Network%>
+
<%:Target%>
+
<%:Source%>
+
<%:Metric%>
+
<%:Table%>
+
<% for _, v in ipairs(ip.routes({ family = 6, type = 1 })) do if v.dest and not v.dest:is6linklocal() then %> -
- - - - - - +
+
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
+
<%=v.dest%>
+
<%=v.from%>
+
<%=v.metric or 0%>
+
<%=rtn[v.table] or v.table%>
+
<% style = not style end end %> -
<%:Network%><%:Target%><%:Source%><%:Metric%><%:Table%>
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%><%=v.dest%><%=v.from%><%=v.metric or 0%><%=rtn[v.table] or v.table%>
+

@@ -132,27 +132,27 @@ <%:IPv6 Neighbours%>
- - - - - - +
+
+
<%:IPv6-Address%>
+
<%:MAC-Address%>
+
<%:Interface%>
+
<% for _, v in ipairs(ip.neighbors({ family = 6 })) do if v.dest and not v.dest:is6linklocal() and v.mac then %> -
- - - - +
+
<%=v.dest%>
+
<%=v.mac%>
+
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
+
<% style = not style end end %> -
<%:IPv6-Address%><%:MAC-Address%><%:Interface%>
<%=v.dest%><%=v.mac%><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
+

diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm index aa658ff0c..4211b2647 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm @@ -325,28 +325,28 @@
-

- - - - +
+
+
<%:Signal:%>
+
0 <%:dBm%>
-
- +
<%:Average:%>
+
0 <%:dBm%>
- - - - - - +
<%:Peak:%>
+
0 <%:dBm%>
+ +
+
<%:Noise:%>
+
0 <%:dBm%>
-
- +
<%:Average:%>
+
0 <%:dBm%>
- - - -
<%:Signal:%>0 <%:dBm%><%:Average:%>0 <%:dBm%><%:Peak:%>0 <%:dBm%>
<%:Noise:%>0 <%:dBm%><%:Average:%>0 <%:dBm%><%:Peak:%>0 <%:dBm%>
+
<%:Peak:%>
+
0 <%:dBm%>
+
+

@@ -354,17 +354,17 @@
-

- - - - +
+
+
<%:Phy Rate:%>
+
0 MBit/s
-
- +
<%:Average:%>
+
0 MBit/s
- - - -
<%:Phy Rate:%>0 MBit/s<%:Average:%>0 MBit/s<%:Peak:%>0 MBit/s
+
<%:Peak:%>
+
0 MBit/s
+
+
<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm index 88e0fffd9..4944a232b 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm @@ -128,34 +128,34 @@ end <% if display ~= "available" then %>
- - - - - - +
+
+
 
+
<%:Package name%>
+
<%:Version%>
+
<% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, s, d) empty = false; filter[n] = true %> -
- - - - + +
<%=luci.util.pcdata(n)%>
+
<%=luci.util.pcdata(v)%>
+ <% end) %> <% if empty then %> - - - - - +
+
 
+
<%:none%>
+
<%:none%>
+
<% end %> -
 <%:Package name%><%:Version%>
+ <%=luci.util.pcdata(n)%><%=luci.util.pcdata(v)%>
 <%:none%><%:none%>
+
<% else %>
@@ -168,40 +168,40 @@ end
<% end %> - - - - - - - - +
+
+
 
+
<%:Package name%>
+
<%:Version%>
+
<%:Size (.ipk)%>
+
<%:Description%>
+
<% local empty = true; opkg_list(querypat or letterpat, function(n, v, s, d) if filter[n] then return end; empty = false %> -
- - - - - - + +
<%=luci.util.pcdata(n)%>
+
<%=luci.util.pcdata(v)%>
+
<%=luci.util.pcdata(s)%>
+
<%=luci.util.pcdata(d)%>
+ <% end) %> <% if empty then %> - - - - - - - +
+
 
+
<%:none%>
+
<%:none%>
+
<%:none%>
+
<%:none%>
+
<% end %> -
 <%:Package name%><%:Version%><%:Size (.ipk)%><%:Description%>
+ <%=luci.util.pcdata(n)%><%=luci.util.pcdata(v)%><%=luci.util.pcdata(s)%><%=luci.util.pcdata(d)%>
 <%:none%><%:none%><%:none%><%:none%>
+
<% if not querypat then %>
<% end %> -- cgit v1.2.3