X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-admin-full%2Fluasrc%2Fview%2Fadmin_status%2Findex.htm;h=a98d790802a099b87382c6568b9709048d234075;hp=cb6371bfadd899bd4e50590547887ba19ca65d58;hb=03a90f161a85bbd79a18a260ba0b702cd941f207;hpb=46beca9fb15695a5c576093bb24a88120e155972 diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index cb6371bfa..a98d79080 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -1,27 +1,22 @@ <%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008-2011 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. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - + Copyright 2008 Steven Barth + Copyright 2008-2011 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. -%> <% - require "luci.fs" - require "luci.tools.status" + local fs = require "nixio.fs" + local util = require "luci.util" + local stat = require "luci.tools.status" + local ver = require "luci.version" - local has_ipv6 = luci.fs.access("/proc/net/ipv6_route") - local has_dhcp = luci.fs.access("/etc/config/dhcp") - local has_wifi = luci.fs.stat("/etc/config/wireless") - has_wifi = has_wifi and has_wifi.size > 0 + local has_ipv6 = fs.access("/proc/net/ipv6_route") + local has_dhcp = fs.access("/etc/config/dhcp") + local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0) local sysinfo = luci.util.ubus("system", "info") or { } local boardinfo = luci.util.ubus("system", "board") or { } + local unameinfo = nixio.uname() or { } local meminfo = sysinfo.memory or { total = 0, @@ -35,7 +30,7 @@ You may obtain a copy of the License at free = 0 } - local has_dsl = luci.fs.stat("/etc/init.d/dsl_control") + local has_dsl = fs.access("/etc/init.d/dsl_control") if luci.http.formvalue("status") == "1" then local ntm = require "luci.model.network".init() @@ -54,15 +49,15 @@ You may obtain a copy of the License at local rv = { uptime = sysinfo.uptime or 0, - localtime = sysinfo.localtime or 0, + localtime = os.date(), loadavg = sysinfo.load or { 0, 0, 0 }, memory = meminfo, swap = swapinfo, connmax = conn_max, conncount = conn_count, - leases = luci.tools.status.dhcp_leases(), - leases6 = luci.tools.status.dhcp6_leases(), - wifinets = luci.tools.status.wifi_networks() + leases = stat.dhcp_leases(), + leases6 = stat.dhcp6_leases(), + wifinets = stat.wifi_networks() } if wan then @@ -93,7 +88,9 @@ You may obtain a copy of the License at if has_dsl then local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat") local dsl_func = loadstring(dsl_stat) - rv.dsl = dsl_func() + if dsl_func then + rv.dsl = dsl_func() + end end luci.http.prepare_content("application/json") @@ -357,7 +354,7 @@ You may obtain a copy of the License at for (var nidx = 0; nidx < dev.networks.length; nidx++) { var net = dev.networks[nidx]; - var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel); + var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled); var icon; if (!is_assoc) @@ -505,7 +502,7 @@ You may obtain a copy of the License at var e; if (e = document.getElementById('localtime')) - e.innerHTML = (new Date(info.localtime * 1000)).toUTCString(); + e.innerHTML = info.localtime; if (e = document.getElementById('uptime')) e.innerHTML = String.format('%t', info.uptime); @@ -564,10 +561,10 @@ You may obtain a copy of the License at <%:Hostname%><%=luci.sys.hostname() or "?"%> <%:Model%><%=pcdata(boardinfo.model or boardinfo.system or "?")%> <%:Firmware Version%> - <%=pcdata(luci.version.distname)%> <%=pcdata(luci.version.distversion)%> / - <%=pcdata(luci.version.luciname)%> (<%=pcdata(luci.version.luciversion)%>) + <%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> / + <%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>) - <%:Kernel Version%><%=luci.sys.exec("uname -r")%> + <%:Kernel Version%><%=unameinfo.release or "?"%> <%:Local Time%>- <%:Uptime%>- <%:Load Average%>- @@ -695,13 +692,10 @@ You may obtain a copy of the License at <% end %> <%- - require "luci.util" - require "nixio.fs" - - local plugins = nixio.fs.dir(luci.util.libpath() .. "/view/admin_status/index") - if plugins then + local incdir = util.libpath() .. "/view/admin_status/index/" + if fs.access(incdir) then local inc - for inc in plugins do + for inc in fs.dir(incdir) do if inc:match("%.htm$") then include("admin_status/index/" .. inc:gsub("%.htm$", "")) end