summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status/luasrc/view
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-status/luasrc/view')
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index.htm169
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index/10-system.htm29
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index/20-memory.htm31
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index/30-network.htm17
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index/40-dhcp-leases.htm14
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index/50-dsl.htm20
-rw-r--r--modules/luci-mod-status/luasrc/view/admin_status/index/60-wifi.htm26
7 files changed, 49 insertions, 257 deletions
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index.htm b/modules/luci-mod-status/luasrc/view/admin_status/index.htm
index 5b53e8ed34..958212a01f 100644
--- a/modules/luci-mod-status/luasrc/view/admin_status/index.htm
+++ b/modules/luci-mod-status/luasrc/view/admin_status/index.htm
@@ -4,130 +4,55 @@
Licensed to the public under the Apache License 2.0.
-%>
-<%
- local fs = require "nixio.fs"
- local ipc = require "luci.ip"
- local util = require "luci.util"
- local stat = require "luci.tools.status"
- local ver = require "luci.version"
-
- if luci.http.formvalue("status") == "1" then
-
- local sysinfo = luci.util.ubus("system", "info") or { }
-
- local meminfo = sysinfo.memory or {
- total = 0,
- free = 0,
- buffered = 0,
- shared = 0
- }
-
- local swapinfo = sysinfo.swap or {
- total = 0,
- free = 0
- }
-
- local has_dsl = fs.access("/etc/init.d/dsl_control")
-
- local ntm = require "luci.model.network".init()
- local wan_nets = ntm:get_wan_networks()
- local wan6_nets = ntm:get_wan6_networks()
-
- local conn_count = tonumber(
- fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
-
- local conn_max = tonumber(luci.sys.exec(
- "sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
- ):match("%d+")) or 4096
-
- local rv = {
- uptime = sysinfo.uptime or 0,
- localtime = os.date(),
- loadavg = sysinfo.load or { 0, 0, 0 },
- memory = meminfo,
- swap = swapinfo,
- connmax = conn_max,
- conncount = conn_count,
- wifinets = stat.wifi_networks()
- }
-
- if #wan_nets > 0 then
- local k, v
-
- rv.wan = { }
-
- for k, v in pairs(wan_nets) do
- local dev = v:get_interface()
- local link = dev and ipc.link(dev:name())
-
- local wan_info = {
- ipaddrs = v:ipaddrs(),
- gwaddr = v:gwaddr(),
- dns = v:dnsaddrs(),
- expires = v:expires(),
- uptime = v:uptime(),
- proto = v:proto(),
- i18n = v:get_i18n(),
- ifname = v:ifname(),
- link = v:adminlink(),
- mac = dev and dev:mac(),
- type = dev and dev:type(),
- name = dev and dev:get_i18n(),
- ether = link and link.type == 1
- }
-
- rv.wan[#rv.wan+1] = wan_info
- end
- end
-
- if #wan6_nets > 0 then
- local k, v
-
- rv.wan6 = { }
-
- for k, v in pairs(wan6_nets) do
- local dev = v:get_interface()
- local link = dev and ipc.link(dev:name())
- local wan6_info = {
- ip6addrs = v:ip6addrs(),
- gw6addr = v:gw6addr(),
- dns = v:dns6addrs(),
- ip6prefix = v:ip6prefix(),
- uptime = v:uptime(),
- proto = v:proto(),
- i18n = v:get_i18n(),
- ifname = v:ifname(),
- link = v:adminlink(),
- mac = dev and dev:mac(),
- type = dev and dev:type(),
- name = dev and dev:get_i18n(),
- ether = link and link.type == 1
- }
-
- rv.wan6[#rv.wan6+1] = wan6_info
- end
- end
-
- if has_dsl then
- local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
- local dsl_func = loadstring(dsl_stat)
- if dsl_func then
- rv.dsl = dsl_func()
- end
- end
-
- luci.http.prepare_content("application/json")
- luci.http.write_json(rv)
-
- return
- end
--%>
-
<%+header%>
<h2 name="content"><%:Status%></h2>
+<div id="view">
+ <div class="spinning"><%:Loading view…%></div>
+</div>
+
+<script type="text/javascript">//<![CDATA[
+function progressbar(query, value, max, byte)
+{
+ var pg = document.querySelector(query),
+ vn = parseInt(value) || 0,
+ mn = parseInt(max) || 100,
+ fv = byte ? String.format('%1024.2mB', value) : value,
+ fm = byte ? String.format('%1024.2mB', max) : max,
+ pc = Math.floor((100 / mn) * vn);
+
+ if (pg) {
+ pg.firstElementChild.style.width = pc + '%';
+ pg.setAttribute('title', '%s / %s (%d%%)'.format(fv, fm, pc));
+ }
+}
+
+function renderBox(title, active, childs) {
+ childs = childs || [];
+ childs.unshift(L.itemlist(E('span'), [].slice.call(arguments, 3)));
+
+ return E('div', { class: 'ifacebox' }, [
+ E('div', { class: 'ifacebox-head center ' + (active ? 'active' : '') },
+ E('strong', title)),
+ E('div', { class: 'ifacebox-body left' }, childs)
+ ]);
+}
+
+function renderBadge(icon, title) {
+ return E('span', { class: 'ifacebadge' }, [
+ E('img', { src: icon, title: title || '' }),
+ L.itemlist(E('span'), [].slice.call(arguments, 2))
+ ]);
+}
+
+//]]></script>
+
+<div class="includes" style="display:none">
<%-
+ local util = require "luci.util"
+ local fs = require "nixio.fs"
+
local incdir = util.libpath() .. "/view/admin_status/index/"
if fs.access(incdir) then
local _, inc
@@ -142,7 +67,11 @@
end
end
-%>
+</div>
-<script type="text/javascript" src="<%=resource%>/view/status/index.js"></script>
+<script type="text/javascript">L.require('view.status.index').catch(function(err) {
+ L.dom.content(document.querySelector('#view'), null);
+ L.error(err);
+});</script>
<%+footer%>
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index/10-system.htm b/modules/luci-mod-status/luasrc/view/admin_status/index/10-system.htm
deleted file mode 100644
index 994550ec2b..0000000000
--- a/modules/luci-mod-status/luasrc/view/admin_status/index/10-system.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<%
- local boardinfo = luci.util.ubus("system", "board") or { }
- local unameinfo = nixio.uname() or { }
- local ver = require "luci.version"
-%>
-
-<div class="cbi-section">
- <h3><%:System%></h3>
-
- <div class="table" width="100%">
- <div class="tr"><div class="td left" width="33%"><%:Hostname%></div><div class="td left"><%=luci.sys.hostname() or "?"%></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Model%></div><div class="td left"><%=pcdata(boardinfo.model or "?")%></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Architecture%></div><div class="td left"><%=pcdata(boardinfo.system or "?")%></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Firmware Version%></div><div class="td left">
- <%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
- <%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
- </div></div>
- <div class="tr"><div class="td left" width="33%"><%:Kernel Version%></div><div class="td left"><%=unameinfo.release or "?"%></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Local Time%></div><div class="td left" id="localtime">-</div></div>
- <div class="tr"><div class="td left" width="33%"><%:Uptime%></div><div class="td left" id="uptime">-</div></div>
- <div class="tr"><div class="td left" width="33%"><%:Load Average%></div><div class="td left" id="loadavg">-</div></div>
- </div>
-</div>
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index/20-memory.htm b/modules/luci-mod-status/luasrc/view/admin_status/index/20-memory.htm
deleted file mode 100644
index 13774704fe..0000000000
--- a/modules/luci-mod-status/luasrc/view/admin_status/index/20-memory.htm
+++ /dev/null
@@ -1,31 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<%
- local sysinfo = luci.util.ubus("system", "info") or { }
- local has_swap = sysinfo.swap and sysinfo.swap.total > 0 or false
-%>
-
-<div class="cbi-section">
- <h3><%:Memory%></h3>
-
- <div class="table" width="100%">
- <div class="tr"><div class="td left" width="33%"><%:Total Available%></div><div class="td left"><div id="memtotal" class="cbi-progressbar" title="-"><div></div></div></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Free%></div><div class="td left"><div id="memfree" class="cbi-progressbar" title="-"><div></div></div></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Buffered%></div><div class="td left"><div id="membuff" class="cbi-progressbar" title="-"><div></div></div></div></div>
- </div>
-</div>
-
-<% if has_swap then %>
-<div class="cbi-section">
- <h3><%:Swap%></h3>
-
- <div class="table" width="100%">
- <div class="tr"><div class="td left" width="33%"><%:Total Available%></div><div class="td left"><div id="swaptotal" class="cbi-progressbar" title="-"><div></div></div></div></div>
- <div class="tr"><div class="td left" width="33%"><%:Free%></div><div class="td left"><div id="swapfree" class="cbi-progressbar" title="-"><div></div></div></div></div>
- </div>
-</div>
-<% end %>
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index/30-network.htm b/modules/luci-mod-status/luasrc/view/admin_status/index/30-network.htm
deleted file mode 100644
index 945a31b2e5..0000000000
--- a/modules/luci-mod-status/luasrc/view/admin_status/index/30-network.htm
+++ /dev/null
@@ -1,17 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<div class="cbi-section">
- <h3><%:Network%></h3>
-
- <div id="upstream_status_table" class="network-status-table">
- <p><em><%:Collecting data...%></em></p>
- </div>
-
- <div class="table" width="100%">
- <div class="tr"><div class="td left" width="33%"><%:Active Connections%></div><div class="td left"><div id="conns" class="cbi-progressbar" title="-"><div></div></div></div></div>
- </div>
-</div>
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index/40-dhcp-leases.htm b/modules/luci-mod-status/luasrc/view/admin_status/index/40-dhcp-leases.htm
deleted file mode 100644
index aaf3661442..0000000000
--- a/modules/luci-mod-status/luasrc/view/admin_status/index/40-dhcp-leases.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<%
- local fs = require "nixio.fs"
- local has_dhcp = fs.access("/etc/config/dhcp")
-
- if has_dhcp then
- include("lease_status")
- end
-%>
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index/50-dsl.htm b/modules/luci-mod-status/luasrc/view/admin_status/index/50-dsl.htm
deleted file mode 100644
index f37bf147a3..0000000000
--- a/modules/luci-mod-status/luasrc/view/admin_status/index/50-dsl.htm
+++ /dev/null
@@ -1,20 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<%
- local fs = require "nixio.fs"
- local has_dsl = fs.access("/etc/init.d/dsl_control")
-%>
-
-<% if has_dsl then %>
-<div class="cbi-section">
- <h3><%:DSL%></h3>
-
- <div id="dsl_status_table" class="network-status-table">
- <p><em><%:Collecting data...%></em></p>
- </div>
-</div>
-<% end %>
diff --git a/modules/luci-mod-status/luasrc/view/admin_status/index/60-wifi.htm b/modules/luci-mod-status/luasrc/view/admin_status/index/60-wifi.htm
deleted file mode 100644
index 7338bc77f1..0000000000
--- a/modules/luci-mod-status/luasrc/view/admin_status/index/60-wifi.htm
+++ /dev/null
@@ -1,26 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<%
- local fs = require "nixio.fs"
- local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
-%>
-
-<% if has_wifi then %>
-<div class="cbi-section">
- <h3><%:Wireless%></h3>
-
- <div id="wifi_status_table" class="network-status-table">
- <p><em><%:Collecting data...%></em></p>
- </div>
-</div>
-
-<div class="cbi-section">
- <h3><%:Associated Stations%></h3>
-
- <%+wifi_assoclist%>
-</div>
-<% end %>