From 4e1bf37c4345bffa149f144a0c435df9b7fc4e1a Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 1 Dec 2010 21:17:39 +0000 Subject: [PATCH] modules/admin-full: add uptime to iface status templates --- .../luasrc/view/admin_network/iface_overview.htm | 16 ++++++++++++++++ .../luasrc/view/admin_network/iface_status.htm | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm index 957d91749d..f914c404ec 100644 --- a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm +++ b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm @@ -81,12 +81,20 @@ $Id$ var rxp = ifc.stats ? ifc.stats["rx_packets"] : 0; var txp = ifc.stats ? ifc.stats["tx_packets"] : 0; var mac = ifc.macaddr ? ifc.macaddr : '00:00:00:00:00:00'; + var upt = '-'; var icon; if (is_up) + { + if (ifc.uptime) + upt = String.format('%t', ifc.uptime); + icon = "<%=resource%>/icons/ethernet.png"; + } else + { icon = "<%=resource%>/icons/ethernet_disabled.png"; + } var s = document.getElementById(ifc.id + '-ifc-signal'); if (s) @@ -98,6 +106,12 @@ $Id$ ); } + var u = document.getElementById(ifc.id + '-ifc-uptime'); + if (u) + { + u.innerHTML = upt; + } + var m = document.getElementById(ifc.id + '-ifc-mac'); if (m) { @@ -184,6 +198,7 @@ $Id$   <%:Interface%> + <%:Uptime%> <%:MAC%> <%:Addresses%> <%:Transfer%> @@ -198,6 +213,7 @@ $Id$
? + ? ? <%:Collecting data...%> diff --git a/modules/admin-full/luasrc/view/admin_network/iface_status.htm b/modules/admin-full/luasrc/view/admin_network/iface_status.htm index 7c03769657..ed5002bc6c 100644 --- a/modules/admin-full/luasrc/view/admin_network/iface_status.htm +++ b/modules/admin-full/luasrc/view/admin_network/iface_status.htm @@ -14,12 +14,20 @@ var rxp = ifc.stats ? ifc.stats["rx_packets"] : 0; var txp = ifc.stats ? ifc.stats["tx_packets"] : 0; var mac = ifc.macaddr ? ifc.macaddr : '00:00:00:00:00:00'; + var upt = '-'; var icon; if (is_up) + { + if (ifc.uptime) + upt = String.format('%t', ifc.uptime); + icon = "<%=resource%>/icons/ethernet.png"; + } else + { icon = "<%=resource%>/icons/ethernet_disabled.png"; + } var s = document.getElementById('<%=self.option%>-ifc-signal'); if (s) @@ -32,10 +40,11 @@ if (d && ifc.ifname) { d.innerHTML = String.format( + '<%:Uptime%>: %s
' + '<%:MAC Address%>: %s
' + '<%:RX%>: %.2f <%:KB%> (%d <%:Pkts.%>)
' + '<%:TX%>: %.2f <%:KB%> (%d <%:Pkts.%>)
', - mac, rxb, rxp, txb, txp + upt, mac, rxb, rxp, txb, txp ); if (ifc.ipaddrs && ifc.ipaddrs.length) -- 2.30.2