modules/admin-full: remove redundant code
This commit is contained in:
parent
99f2e78b16
commit
1d40f7fbea
2 changed files with 12 additions and 49 deletions
|
@ -77,28 +77,8 @@ $Id$
|
||||||
for (var i = 0; i < ifcs.length; i++)
|
for (var i = 0; i < ifcs.length; i++)
|
||||||
{
|
{
|
||||||
var ifc = ifcs[i];
|
var ifc = ifcs[i];
|
||||||
var rxb = ifc.rx_bytes || 0;
|
|
||||||
var txb = ifc.tx_bytes || 0;
|
|
||||||
var rxp = ifc.rx_packets || 0;
|
|
||||||
var txp = ifc.tx_packets || 0;
|
|
||||||
var mac = ifc.macaddr;
|
|
||||||
var upt = null;
|
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
var icon;
|
|
||||||
if (ifc.is_up)
|
|
||||||
{
|
|
||||||
if (ifc.uptime)
|
|
||||||
upt = String.format('%t', ifc.uptime);
|
|
||||||
|
|
||||||
icon = "<%=resource%>/icons/%s.png";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
icon = "<%=resource%>/icons/%s_disabled.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
var s = document.getElementById(ifc.id + '-ifc-devices');
|
var s = document.getElementById(ifc.id + '-ifc-devices');
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
|
@ -138,20 +118,21 @@ $Id$
|
||||||
var d = document.getElementById(ifc.id + '-ifc-description');
|
var d = document.getElementById(ifc.id + '-ifc-description');
|
||||||
if (d && ifc.ifname)
|
if (d && ifc.ifname)
|
||||||
{
|
{
|
||||||
if (upt)
|
if (ifc.is_up)
|
||||||
{
|
{
|
||||||
html += String.format('<strong><%:Uptime%>:</strong> %s<br />', upt);
|
html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifc.type != 'tunnel')
|
if (ifc.type != 'tunnel')
|
||||||
{
|
{
|
||||||
html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', mac);
|
html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', ifc.macaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
html += String.format(
|
html += String.format(
|
||||||
'<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' +
|
'<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' +
|
||||||
'<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />',
|
'<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />',
|
||||||
rxb, rxp, txb, txp
|
ifc.rx_bytes, ifc.rx_packets,
|
||||||
|
ifc.tx_bytes, ifc.tx_packets
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ifc.ipaddrs && ifc.ipaddrs.length)
|
if (ifc.ipaddrs && ifc.ipaddrs.length)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
var iwxhr = new XHR();
|
var iwxhr = new XHR();
|
||||||
|
|
||||||
function iface_shutdown(id, reconnect) {
|
function iface_shutdown(id, reconnect) {
|
||||||
if (!reconnect && !confirm(String.format('<%_Really shutdown network ?\nYou might loose access to this router if you are connected via this interface.%>', id)))
|
if (!reconnect && !confirm(String.format('<%_Really shutdown network ?\nYou might lose access to this router if you are connected via this interface.%>', id)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var a = document.getElementById(id + '-ifc-addrs');
|
var a = document.getElementById(id + '-ifc-addrs');
|
||||||
|
@ -49,26 +49,7 @@
|
||||||
{
|
{
|
||||||
if (ifc && (ifc = ifc[0]))
|
if (ifc && (ifc = ifc[0]))
|
||||||
{
|
{
|
||||||
var rxb = ifc.rx_bytes || 0;
|
|
||||||
var txb = ifc.tx_bytes || 0;
|
|
||||||
var rxp = ifc.rx_packets || 0;
|
|
||||||
var txp = ifc.tx_packets || 0;
|
|
||||||
var mac = ifc.macaddr;
|
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
var upt, icon;
|
|
||||||
|
|
||||||
if (ifc.is_up)
|
|
||||||
{
|
|
||||||
if (ifc.uptime)
|
|
||||||
upt = String.format('%t', ifc.uptime);
|
|
||||||
|
|
||||||
icon = "<%=resource%>/icons/%s.png";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
icon = "<%=resource%>/icons/%s_disabled.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
var s = document.getElementById('<%=self.option%>-ifc-signal');
|
var s = document.getElementById('<%=self.option%>-ifc-signal');
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -80,22 +61,23 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
var d = document.getElementById('<%=self.option%>-ifc-description');
|
var d = document.getElementById('<%=self.option%>-ifc-description');
|
||||||
if (d && ifc.ifname && mac != '00:00:00:00:00:00')
|
if (d && ifc.ifname && ifc.macaddr != '00:00:00:00:00:00')
|
||||||
{
|
{
|
||||||
if (upt)
|
if (ifc.is_up)
|
||||||
{
|
{
|
||||||
html += String.format('<strong><%:Uptime%>:</strong> %s<br />', upt);
|
html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifc.type != 'tunnel')
|
if (ifc.type != 'tunnel')
|
||||||
{
|
{
|
||||||
html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', mac);
|
html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', ifc.macaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
html += String.format(
|
html += String.format(
|
||||||
'<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' +
|
'<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' +
|
||||||
'<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />',
|
'<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />',
|
||||||
rxb, rxp, txb, txp
|
ifc.rx_bytes, ifc.rx_packets,
|
||||||
|
ifc.tx_bytes, ifc.tx_packets
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ifc.ipaddrs && ifc.ipaddrs.length)
|
if (ifc.ipaddrs && ifc.ipaddrs.length)
|
||||||
|
|
Loading…
Reference in a new issue