3 <!--[if IE]><script type="text/javascript" src="<%=resource%>/livestats/ExCanvas.js"></script><![endif]-->
4 <script type=
"text/javascript" src=
"<%=resource%>/livestats/MochiKit.js"></script>
5 <script type=
"text/javascript" src=
"<%=resource%>/livestats/JsonRpc.js"></script>
6 <script type=
"text/javascript" src=
"<%=resource%>/livestats/PlotKit.js"></script>
7 <script type=
"text/javascript" src=
"<%=resource%>/livestats/GraphRPC.js"></script>
8 <script type=
"text/javascript" src=
"<%=resource%>/livestats/Legend.js"></script>
11 local interfaces = { }
13 local uci = luci.model.uci.cursor_state()
15 uci:foreach(
"network",
"interface",
17 if s.ifname ~=
"lo" then
18 table.insert( interfaces,
19 "'" .. ( s.ifname or s['.name'] ) ..
"'"
21 ifnames[s.ifname or s['.name']] = s['.name']
27 <script type=
"text/javascript">
28 function initGraphs() {
29 var rpc = new GraphRPC(
30 document.getElementById('live_graphs'),
31 '<%=luci.dispatcher.build_url('rpc', 'sys')%
>', 'net.deviceinfo',
35 [
"0",
"<%:livestats_incoming%> (kiB/s)",
"8",
"<%:livestats_outgoing%> (kiB/s)" ],
37 // Graph layout options
40 drawBackground: false,
42 title: '<%:livestats_traffic%
> %s',
43 strokeWidth:
2.5, height:
140,
44 padding: { left:
70, right:
10, top:
10, bottom:
20 },
45 instances: [ <%=table.concat(interfaces,
", ") %
> ],
47 <%- for iface, network in pairs(ifnames) do %
>
48 <%
-=
"%q:%q," % {iface, network}-%
>
54 function (cur, last) {
55 return (cur - last) /
2048;
61 MochiKit.DOM.addLoadEvent(initGraphs);
64 <div id=
"live_graphs"></div>