From 6ea0204a554536367dd762b8b96b5de57171afa9 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 13 Mar 2011 22:12:42 +0000 Subject: modules/admin-full: merge "Active Connections" and "Realtime Connections" --- .../luasrc/view/admin_status/connections.htm | 124 ++++++++++++++------- .../luasrc/view/admin_status/conntrack.htm | 82 -------------- 2 files changed, 85 insertions(+), 121 deletions(-) delete mode 100644 modules/admin-full/luasrc/view/admin_status/conntrack.htm (limited to 'modules/admin-full/luasrc/view/admin_status') diff --git a/modules/admin-full/luasrc/view/admin_status/connections.htm b/modules/admin-full/luasrc/view/admin_status/connections.htm index eb48398527..7ce791ba9e 100644 --- a/modules/admin-full/luasrc/view/admin_status/connections.htm +++ b/modules/admin-full/luasrc/view/admin_status/connections.htm @@ -57,12 +57,35 @@ $Id$ var label_scale; + var conn_table; + function update_graph() { bwxhr.get('<%=build_url("admin/status/connections_status")%>', null, - function(x, data) + function(x, json) { + var conn = json.connections; + + while (conn_table.rows.length > 1) + conn_table.rows[0].parentNode.deleteRow(-1); + + for (var i = 0; i < conn.length; i++) + { + var c = conn[i]; + var tr = conn_table.rows[0].parentNode.insertRow(-1); + tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2)); + + tr.insertCell(-1).innerHTML = c.layer3.toUpperCase(); + tr.insertCell(-1).innerHTML = c.layer4.toUpperCase(); + tr.insertCell(-1).innerHTML = String.format(c.layer3 == 'ipv6' ? '[%s]:%d' : '%s:%d', c.src, c.sport); + tr.insertCell(-1).innerHTML = String.format(c.layer3 == 'ipv6' ? '[%s]:%d' : '%s:%d', c.dst, c.dport); + tr.insertCell(-1).innerHTML = String.format('%1024.2mB (%d <%:Pkts.%>)', c.bytes, c.packets); + } + + + var data = json.statistics; + var data_max = 0; var data_scale = 0; @@ -177,7 +200,7 @@ $Id$ window.setTimeout( function() { var svg = document.getElementById('bwsvg'); - + try { G = svg.getSVGDocument ? svg.getSVGDocument() : svg.contentDocument; @@ -226,7 +249,9 @@ $Id$ label_otr_avg = document.getElementById('lb_otr_avg'); label_otr_peak = document.getElementById('lb_otr_peak'); - label_scale = document.getElementById('scale'); + label_scale = document.getElementById('scale'); + + conn_table = document.getElementById('connections'); /* plot horizontal time interval lines */ @@ -260,41 +285,62 @@ $Id$

<%:Realtime Connections%>

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<%:UDP:%>0<%:Average:%>0<%:Peak:%>0
<%:TCP:%>0<%:Average:%>0<%:Peak:%>0
<%:Other:%>0<%:Average:%>0<%:Peak:%>0
+
<%:This page gives an overview over currently active network connections.%>
+ +
+ <%:Active Connections%> + + +
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<%: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...%>
+
+
<%+footer%> diff --git a/modules/admin-full/luasrc/view/admin_status/conntrack.htm b/modules/admin-full/luasrc/view/admin_status/conntrack.htm deleted file mode 100644 index 2697c1cda3..0000000000 --- a/modules/admin-full/luasrc/view/admin_status/conntrack.htm +++ /dev/null @@ -1,82 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008-2009 Steven Barth -Copyright 2008-2011 Jo-Philipp Wich - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> - -<%- - require "luci.sys" - local style = true --%> - -<%+header%> - -
-

<%:Active Connections%>

-
<%:This page gives an overview over currently active network connections.%>
- -
- ARP -
- - - - - - - - <% luci.sys.net.arptable(function(e) %> - - - - - - <% style = not style; end) %> -
<%_IPv4-Address%><%_MAC-Address%><%:Interface%>
<%=e["IP address"]%><%=e["HW address"]%><%=e["Device"]%>
-
-
-
- -
- <%:Active Connections%> -
- - - - - - - - - <% style = true; luci.sys.net.conntrack(function(c) %> - - - - - - - <% style = not style; end) %> -
<%:Network%><%:Protocol%><%:Source%><%:Destination%>
<%=c.layer3:upper()%><%=c.layer4:upper()%><%= - c.layer3 == "ipv6" - and "[%s]:%d" %{ c.src, c.sport } - or "%s:%d" %{ c.src, c.sport } - %><%= - c.layer3 == "ipv6" - and "[%s]:%d" %{ c.dst, c.dport } - or "%s:%d" %{ c.dst, c.dport } - %>
-
-
-
-
- -<%+footer%> -- cgit v1.2.3