From 8e10118843664377d6f49398dd8bf8424a585ead Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 9 Jul 2018 11:13:06 +0200 Subject: [PATCH] luci-mod-admin-full: rework connection status table handling Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/admin_status/connections.htm | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) 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 ea919a8d3..19f828429 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 @@ -136,12 +136,9 @@ XHR.poll(3, '<%=build_url("admin/status/realtime/connections_status")%>', null, function(x, json) { + var rows = []; var conn = json.connections; - while (conn_table.firstElementChild !== conn_table.lastElementChild) - conn_table.removeChild(conn_table.lastElementChild); - - var lookup_queue = [ ]; conn.sort(function(a, b) { @@ -165,15 +162,17 @@ 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); - 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)), - ])); + rows.push([ + c.layer3.toUpperCase(), + c.layer4.toUpperCase(), + src + ':' + c.sport, + dst + ':' + c.dport, + '%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets) + ]); } + cbi_update_table(conn_table, rows, '<%:No information available%>'); + if (lookup_queue.length > 0) XHR.get('<%=build_url("admin/status/nameinfo")%>/' + lookup_queue.slice(0, 100).join('/'), null, function(x, json) @@ -321,7 +320,7 @@
-

-
+
<%:UDP:%>
0
@@ -356,16 +355,20 @@
-
-
-
<%:Network%>
-
<%:Protocol%>
-
<%:Source%>
-
<%:Destination%>
-
<%:Transfer%>
+
+
+
<%:Network%>
+
<%:Protocol%>
+
<%:Source%>
+
<%:Destination%>
+
<%:Transfer%>
-
<%:Collecting data...%>
+
+
+ <%:Collecting data...%> +
+
-- 2.25.1