summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--modules/admin-full/luasrc/view/admin_network/iface_overview.htm226
-rw-r--r--modules/admin-full/luasrc/view/admin_network/iface_status.htm2
-rw-r--r--modules/admin-full/luasrc/view/admin_network/wifi_overview.htm2
3 files changed, 228 insertions, 2 deletions
diff --git a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm
new file mode 100644
index 000000000..132a5dddf
--- /dev/null
+++ b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm
@@ -0,0 +1,226 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
+
+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: wifi_overview.htm 6280 2010-10-12 05:06:34Z jow $
+
+-%>
+
+<%-
+ local ntm = require "luci.model.network".init()
+
+ local net
+ local netlist = { }
+ for _, net in ipairs(ntm:get_networks()) do
+ if net:name() ~= "loopback" then
+ netlist[#netlist+1] = net:name()
+ end
+ end
+-%>
+
+<%+header%>
+
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+<script type="text/javascript"><![CDATA[
+ function iface_shutdown(id, reconnect) {
+ if (!reconnect && !confirm(String.format('<%_Really shutdown interface "%s" ?\nYou might loose access to this router if you are connected via this interface.%>', id)))
+ return;
+
+ var a = document.getElementById(id + '-ifc-addrs');
+ if (a)
+ a.innerHTML = reconnect
+ ? '<em><%:Interface is reconnecting...%></em>'
+ : '<em><%:Interface is shutting down...%></em>';
+
+ var s = document.getElementById('ifc-rc-status');
+ if (s)
+ {
+ s.parentNode.style.display = 'block';
+ s.innerHTML = '<%:Waiting for router...%>';
+ }
+
+ var rcxhr = new XHR();
+ rcxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
+ function(x)
+ {
+ if (s)
+ {
+ s.innerHTML = reconnect
+ ? '<%:Interface reconnected%>'
+ : '<%:Interface shut down%>';
+
+ window.setTimeout(function() {
+ s.parentNode.style.display = 'none';
+ }, 1000);
+ }
+ }
+ );
+ }
+
+
+ var iwxhr = new XHR();
+ var wifidevs = <%=luci.http.write_json(netdevs)%>;
+ var arptable = <%=luci.http.write_json(arpcache)%>;
+
+ (function() {
+ iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "iface_status", table.concat(netlist, ","))%>', null,
+ function(x, ifcs)
+ {
+ if (ifcs)
+ {
+ for (var i = 0; i < ifcs.length; i++)
+ {
+ var ifc = ifcs[i];
+ var is_up = (ifc.flags && ifc.flags.up);
+ var rxb = ifc.stats ? (ifc.stats["rx_bytes"] / 1024) : 0;
+ var txb = ifc.stats ? (ifc.stats["tx_bytes"] / 1024) : 0;
+ 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 icon;
+ if (is_up)
+ icon = "<%=resource%>/icons/ethernet.png";
+ else
+ icon = "<%=resource%>/icons/ethernet_disabled.png";
+
+ var s = document.getElementById(ifc.id + '-ifc-signal');
+ if (s)
+ {
+ s.innerHTML = String.format(
+ '<img src="%s" style="width:16px; height:16px" /><br />' +
+ '<small>%s</small>',
+ icon, ifc.ifname ? ifc.ifname : '?'
+ );
+ }
+
+ var m = document.getElementById(ifc.id + '-ifc-mac');
+ if (m)
+ {
+ m.innerHTML = mac.toUpperCase();
+ }
+
+ var a = document.getElementById(ifc.id + '-ifc-addrs');
+ if (a)
+ {
+ if (ifc.ifname)
+ {
+ a.innerHTML = '';
+
+ if (ifc.ipaddrs && ifc.ipaddrs.length)
+ {
+ a.innerHTML += '<strong><%:IPv4%>: </strong>';
+
+ for (var j = 0; j < ifc.ipaddrs.length; j++)
+ a.innerHTML += String.format(
+ '%s%s/%d',
+ j ? ', ' : '',
+ ifc.ipaddrs[j].addr,
+ ifc.ipaddrs[j].prefix
+ );
+
+ a.innerHTML += '<br />';
+ }
+
+ if (ifc.ip6addrs && ifc.ip6addrs.length)
+ {
+ a.innerHTML += '<strong><%:IPv6%>: </strong>';
+
+ for (var j = 0; j < ifc.ip6addrs.length; j++)
+ a.innerHTML += String.format(
+ '%s%s/%d',
+ j ? ', ' : '',
+ ifc.ip6addrs[j].addr.toUpperCase(),
+ ifc.ip6addrs[j].prefix
+ );
+
+ a.innerHTML += '<br />';
+ }
+
+ if (!a.innerHTML)
+ a.innerHTML = '<em><%:No address configured on this interface.%></em>'
+ }
+ else
+ {
+ a.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
+ }
+ }
+
+ var t = document.getElementById(ifc.id + '-ifc-transfer');
+ if (t)
+ {
+ t.innerHTML = String.format(
+ '<strong><%:RX%></strong>: %.2f <%:KB%> (%d <%:Pkts.%>)<br />' +
+ '<strong><%:TX%></strong>: %.2f <%:KB%> (%d <%:Pkts.%>)<br />',
+ txb, txp, rxb, rxp
+ );
+ }
+ }
+ }
+ }
+ )
+
+ window.setTimeout(arguments.callee, 5000);
+ })();
+]]></script>
+
+<h2><a id="content" name="content"><%:Interface Overview%></a></h2>
+
+<fieldset class="cbi-section" style="display:none">
+ <legend><%:Reconnecting interface%></legend>
+ <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
+ <span id="ifc-rc-status"><%:Waiting for router...%></span>
+</fieldset>
+
+<div class="cbi-map">
+ <fieldset class="cbi-section">
+ <table class="cbi-section-table" style="margin:10px; empty-cells:hide">
+ <tr class="cbi-section-table-titles">
+ <th class="cbi-section-table-cell">&nbsp;</th>
+ <th class="cbi-section-table-cell"><%:Interface%></th>
+ <th class="cbi-section-table-cell"><%:MAC%></th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Addresses%></th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Transfer%></th>
+ <th class="cbi-section-table-cell" colspan="2"><%:Actions%></th>
+ </tr>
+ <% for i, net in ipairs(netlist) do %>
+ <tr class="cbi-section-table-row cbi-rowstyle-<%=i % 2 + 1%>">
+ <td>
+ <span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net%></span>
+ </td>
+ <td class="cbi-value-field" style="width:16px; padding:3px; text-align:center" id="<%=net%>-ifc-signal">
+ <img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
+ <small>?</small>
+ </td>
+ <td class="cbi-value-field" id="<%=net%>-ifc-mac">?</td>
+ <td class="cbi-value-field" style="text-align:left; padding:3px" id="<%=net%>-ifc-addrs"><em><%:Collecting data...%></em></td>
+ <td class="cbi-value-field" style="text-align:left; padding:3px" id="<%=net%>-ifc-transfer">
+ <strong><%:RX%></strong>: 0 <%:KB%> (0 <%:Pkts.%>)<br />
+ <strong><%:TX%></strong>: 0 <%:KB%> (0 <%:Pkts.%>)<br />
+ </td>
+ <td>
+ <a href="#" onclick="iface_shutdown('<%=net%>', true)"><img style="border:none" src="<%=resource%>/cbi/reload.gif" alt="<%:Reconnect this interface%>" title="<%:Reconnect this interface%>" /></a>
+ <a href="#" onclick="iface_shutdown('<%=net%>', false)"><img style="border:none" src="<%=resource%>/cbi/reset.gif" alt="<%:Shutdown this interface%>" title="<%:Shutdown this interface%>" /></a>
+ </td>
+ <td>
+ <a href="<%=luci.dispatcher.build_url("admin/network/network", net)%>"><img style="border:none" src="<%=resource%>/cbi/edit.gif" alt="<%:Edit this interface%>" title="<%:Edit this interface%>" /></a>
+ <a href="<%=luci.dispatcher.build_url("admin/network/iface_delete", net)%>" onclick="return confirm('<%:Really delete this interface? The deletion cannot be undone!\nYou might loose access to this router if you are connected via this interface.%>')"><img style="border:none" src="<%=resource%>/cbi/remove.gif" alt="<%:Delete this interface%>" title="<%:Delete this interface%>" /></a>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+ </fieldset>
+
+ <form action="<%=luci.dispatcher.build_url("admin/network/iface_add")%>" method="post">
+ <br />
+ <input type="submit" class="cbi-button cbi-button-apply" value="<%:Add new interface...%>" />
+ </form>
+</div>
+
+<%+footer%>
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 5836d4145..34e3dddfd 100644
--- a/modules/admin-full/luasrc/view/admin_network/iface_status.htm
+++ b/modules/admin-full/luasrc/view/admin_network/iface_status.htm
@@ -61,7 +61,7 @@
d.innerHTML += String.format(
'%s%s/%d',
i ? ', ' : '',
- ifc.ip6addrs[i].addr,
+ ifc.ip6addrs[i].addr.toUpperCase(),
ifc.ip6addrs[i].prefix
);
diff --git a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm
index 0702017de..d23a0853a 100644
--- a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm
+++ b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm
@@ -283,7 +283,7 @@ $Id$
<em><%:Collecting data...%></em>
</td>
<td class="cbi-value-field" style="width:40px">
- <a href="<%=net:adminlink()%>"><img style="border:none" src="<%=resource%>/cbi/edit.gif" alt="Edit this network" title="Edit this network" /></a>
+ <a href="<%=net:adminlink()%>"><img style="border:none" src="<%=resource%>/cbi/edit.gif" alt="<%:Edit this network%>" title="<%:Edit this network%>" /></a>
<a href="<%=luci.dispatcher.build_url("admin/network/wireless_delete", net:ifname())%>"><img style="border:none" src="<%=resource%>/cbi/remove.gif" alt="<%:Delete this network%>" title="<%:Delete this network%>" /></a>
</td>
</tr>