summaryrefslogtreecommitdiffhomepage
path: root/modules/niu/luasrc/view
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-10-31 17:27:07 +0000
committerSteven Barth <steven@midlink.org>2009-10-31 17:27:07 +0000
commitb2671410bf5468443d6eb49f525d6c3e3fd7e28f (patch)
treea30a7a6fa499bde367fe4696a786bf3f06a356fa /modules/niu/luasrc/view
parentbd43ccc886b54dbfa3e6fc41d1a132d289884a87 (diff)
NIU: Fixes, System
Diffstat (limited to 'modules/niu/luasrc/view')
-rw-r--r--modules/niu/luasrc/view/niu/system.htm35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/niu/luasrc/view/niu/system.htm b/modules/niu/luasrc/view/niu/system.htm
new file mode 100644
index 0000000000..0f955d7bb4
--- /dev/null
+++ b/modules/niu/luasrc/view/niu/system.htm
@@ -0,0 +1,35 @@
+<%
+local dsp = require "luci.dispatcher"
+local utl = require "luci.util"
+local nxo = require "nixio"
+local sinfo = nxo.sysinfo()
+local load1 = nxo.bit.div(sinfo.loads[1] * 100, 1)
+local days = nxo.bit.div(sinfo.uptime, 86400)
+local hour = nxo.bit.div(sinfo.uptime, 3600) % 24
+local mins = nxo.bit.div(sinfo.uptime, 60) % 60
+%>
+<div>Status:</div>
+<table>
+<tr>
+<th>System Load</th>
+<td><%=load1%> %</td>
+</tr>
+<tr>
+<th>Uptime</th>
+<td><%=days%>d, <%=hour%>:<%=mins%></td>
+</tr>
+</table>
+<br />
+<ul>
+<%
+local nodes = dsp.node("niu", "system").nodes
+local function cmp(a, b)
+ return (nodes[a].order or 100) < (nodes[b].order or 100)
+end
+for k, v in utl.spairs(nodes, cmp) do
+%>
+<li><a href="<%=dsp.build_url("niu", "system", k)%>"><%=v.title%></a></li>
+<%
+end
+%>
+</ul> \ No newline at end of file