From: Jo-Philipp Wich Date: Sat, 30 Oct 2010 00:44:34 +0000 (+0000) Subject: modules/admin-full: convert admin templates to new network model X-Git-Tag: 0.10.0~562 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ba84656d6e00accb9a2fda49f2d0772fe6c8d0aa;p=oweals%2Fluci.git modules/admin-full: convert admin templates to new network model --- 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 4deebeec1..c2790db2c 100644 --- a/modules/admin-full/luasrc/view/admin_network/iface_status.htm +++ b/modules/admin-full/luasrc/view/admin_network/iface_status.htm @@ -7,7 +7,7 @@ function(x) { var ifc = x.responseText ? eval('(' + x.responseText + ')') : { }; - if (ifc) + if (ifc && (ifc = ifc[0])) { var is_up = (ifc.flags && ifc.flags.up); var rxb = ifc.stats ? (ifc.stats["rx_bytes"] / 1024) : 0; 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 4ccee76c0..9f0354cb8 100644 --- a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -1,7 +1,7 @@ <%# LuCI - Lua Configuration Interface Copyright 2008-2009 Steven Barth -Copyright 2008-2009 Jo-Philipp Wich +Copyright 2008-2010 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. @@ -18,9 +18,9 @@ $Id$ local sys = require "luci.sys" local utl = require "luci.util" local uci = require "luci.model.uci".cursor() - local wlm = require "luci.model.wireless" + local ntm = require "luci.model.network" - wlm.init(uci) + ntm.init(uci) function guess_wifi_hw(ifname) local name, idx = ifname:match("^([a-z]+)(%d+)") @@ -92,7 +92,7 @@ $Id$ return icon end - local devices = wlm:get_devices() + local devices = ntm:get_wifidevs() local arpcache = { } sys.net.arptable(function(e) arpcache[e["HW address"]] = e["IP address"] end) -%> @@ -103,7 +103,7 @@ $Id$
- <% for _, dev in ipairs(devices) do local nets = dev:get_networks() %> + <% for _, dev in ipairs(devices) do local nets = dev:get_wifinets() %>
@@ -140,8 +140,8 @@ $Id$ Encryption: <%=net:active_encryption()%> <% end %> @@ -176,7 +176,7 @@ $Id$ <% local count = -1 %> - <% for _, dev in ipairs(devices) do local nets = dev:get_networks() %> + <% for _, dev in ipairs(devices) do local nets = dev:get_wifinets() %> <% for _, net in ipairs(nets) do %> <% for mac, info in utl.kspairs(net:assoclist()) do count = count + 1 %> diff --git a/modules/admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/admin-full/luasrc/view/admin_network/wifi_status.htm index fee8db498..63bd26147 100644 --- a/modules/admin-full/luasrc/view/admin_network/wifi_status.htm +++ b/modules/admin-full/luasrc/view/admin_network/wifi_status.htm @@ -7,7 +7,7 @@ function(x) { var iw = x.responseText ? eval('(' + x.responseText + ')') : null; - if (iw) + if (iw && (iw = iw[0])) { var is_assoc = (iw.bssid && iw.channel); var p = (100 / iw.quality_max * iw.quality); @@ -37,15 +37,15 @@ var d = document.getElementById('<%=self.option%>-iw-description'); if (d && is_assoc) d.innerHTML = String.format( - '<%:Mode%>: %s |' + + '<%:Mode%>: %s | ' + '<%:SSID%>: %s
' + - '<%:BSSID%>: %s |' + + '<%:BSSID%>: %s | ' + '<%:Encryption%>: %s
' + - '<%:Channel%>: %d (%.3f GHz) |' + + '<%:Channel%>: %d (%.3f GHz) | ' + '<%:Tx-Power%>: %d dBm
' + - '<%:Signal%>: %d dBm |' + + '<%:Signal%>: %d dBm | ' + '<%:Noise%>: %d dBm
' + - '<%:Bit Rate%>: %.1f MBit/s |' + + '<%:Bit Rate%>: %.1f MBit/s | ' + '<%:Country%>: %s', iw.mode, iw.ssid, iw.bssid, iw.encryption ? iw.encryption.description : '<%:None%>',
- Edit this network - ">Delete this network + Edit this network + ">Delete this network