luci-mod-admin-full: rework connection status table handling
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
6cda8e6dab
commit
8e10118843
1 changed files with 23 additions and 20 deletions
|
@ -136,12 +136,9 @@
|
||||||
XHR.poll(3, '<%=build_url("admin/status/realtime/connections_status")%>', null,
|
XHR.poll(3, '<%=build_url("admin/status/realtime/connections_status")%>', null,
|
||||||
function(x, json)
|
function(x, json)
|
||||||
{
|
{
|
||||||
|
var rows = [];
|
||||||
var conn = json.connections;
|
var conn = json.connections;
|
||||||
|
|
||||||
while (conn_table.firstElementChild !== conn_table.lastElementChild)
|
|
||||||
conn_table.removeChild(conn_table.lastElementChild);
|
|
||||||
|
|
||||||
|
|
||||||
var lookup_queue = [ ];
|
var lookup_queue = [ ];
|
||||||
|
|
||||||
conn.sort(function(a, b) {
|
conn.sort(function(a, b) {
|
||||||
|
@ -165,15 +162,17 @@
|
||||||
var src = dns_cache[c.src] || (c.layer3 == 'ipv6' ? '[' + c.src + ']' : c.src);
|
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);
|
var dst = dns_cache[c.dst] || (c.layer3 == 'ipv6' ? '[' + c.dst + ']' : c.dst);
|
||||||
|
|
||||||
conn_table.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format(1 + (i % 2)), [
|
rows.push([
|
||||||
E('<div class="td">', c.layer3.toUpperCase()),
|
c.layer3.toUpperCase(),
|
||||||
E('<div class="td">', c.layer4.toUpperCase()),
|
c.layer4.toUpperCase(),
|
||||||
E('<div class="td">', [ src, ':', c.sport ]),
|
src + ':' + c.sport,
|
||||||
E('<div class="td">', [ dst, ':', c.dport ]),
|
dst + ':' + c.dport,
|
||||||
E('<div class="td" style="white-space:nowrap">', '%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets)),
|
'%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets)
|
||||||
]));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cbi_update_table(conn_table, rows, '<em><%:No information available%></em>');
|
||||||
|
|
||||||
if (lookup_queue.length > 0)
|
if (lookup_queue.length > 0)
|
||||||
XHR.get('<%=build_url("admin/status/nameinfo")%>/' + lookup_queue.slice(0, 100).join('/'), null,
|
XHR.get('<%=build_url("admin/status/nameinfo")%>/' + lookup_queue.slice(0, 100).join('/'), null,
|
||||||
function(x, json)
|
function(x, json)
|
||||||
|
@ -321,7 +320,7 @@
|
||||||
<div style="text-align:right"><small id="scale">-</small></div>
|
<div style="text-align:right"><small id="scale">-</small></div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div class="table" style="width:100%; table-layout:fixed" cellspacing="5">
|
<div class="table">
|
||||||
<div class="tr">
|
<div class="tr">
|
||||||
<div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid blue"><%:UDP:%></strong></div>
|
<div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid blue"><%:UDP:%></strong></div>
|
||||||
<div class="td" id="lb_udp_cur">0</div>
|
<div class="td" id="lb_udp_cur">0</div>
|
||||||
|
@ -356,16 +355,20 @@
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div class="cbi-section-node">
|
<div class="cbi-section-node">
|
||||||
<div class="table cbi-section-table" id="connections">
|
<div class="table" id="connections">
|
||||||
<div class="tr cbi-section-table-titles">
|
<div class="tr table-titles">
|
||||||
<div class="th cbi-section-table-cell"><%:Network%></div>
|
<div class="th col-2 hide-xs"><%:Network%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Protocol%></div>
|
<div class="th col-2"><%:Protocol%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Source%></div>
|
<div class="th col-7"><%:Source%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Destination%></div>
|
<div class="th col-7"><%:Destination%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Transfer%></div>
|
<div class="th col-4"><%:Transfer%></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tr"><div class="td" colspan="5"><em><%:Collecting data...%></em></div></div>
|
<div class="tr placeholder">
|
||||||
|
<div class="td">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in a new issue