summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-livestats/luasrc/view/livestats
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-livestats/luasrc/view/livestats')
-rw-r--r--applications/luci-livestats/luasrc/view/livestats/loadavg.htm23
-rw-r--r--applications/luci-livestats/luasrc/view/livestats/traffic.htm32
-rw-r--r--applications/luci-livestats/luasrc/view/livestats/wireless.htm20
3 files changed, 44 insertions, 31 deletions
diff --git a/applications/luci-livestats/luasrc/view/livestats/loadavg.htm b/applications/luci-livestats/luasrc/view/livestats/loadavg.htm
index f1d434b5d2..49f800ead4 100644
--- a/applications/luci-livestats/luasrc/view/livestats/loadavg.htm
+++ b/applications/luci-livestats/luasrc/view/livestats/loadavg.htm
@@ -5,19 +5,9 @@
<script type="text/javascript" src="<%=resource%>/livestats/JsonRpc.js"></script>
<script type="text/javascript" src="<%=resource%>/livestats/PlotKit.js"></script>
<script type="text/javascript" src="<%=resource%>/livestats/GraphRPC.js"></script>
+<script type="text/javascript" src="<%=resource%>/livestats/Legend.js"></script>
<script type="text/javascript">
- PlotKit.Base.baseColors = function () {
- var hexColor = MochiKit.Color.Color.fromHexString;
- return [hexColor("#ff0000"),
- hexColor("#ff6000"),
- hexColor("#fff000"),
- hexColor("#00ff00"),
- hexColor("#00ff77"),
- hexColor("#0090ff"),
- hexColor("#000000")];
- };
-
function initGraphs() {
var rpc = new GraphRPC(
document.getElementById('live_graphs'),
@@ -25,14 +15,14 @@
2000,
// Data sources
- [ 0, "1 Minute Load", 1, "5 Minutes Load", 2, "15 Minutes Load" ],
+ [ 0, "1 min", 1, "5 min", 2, "15 min" ],
// Graph layout options
- { shouldFill: false, drawBackground: false, strokeColor: null,
- strokeColorTransform: "asFillColor",
- title: 'Average Load', strokeWidth: 1,
+ { title: '<%:livestats_loadavg%>', strokeWidth: 2.5, shouldFill: false, strokeColor: null,
padding: { left: 70, right: 10, top: 10, bottom: 20 },
- instances: [ false ], yAxis: [ 0, 2 ] }
+ instances: [ false ], yAxis: [ 0, 2 ], drawBackground: false },
+ null,
+ 'live_graphs'
);
}
@@ -40,5 +30,4 @@
</script>
<div id="live_graphs"></div>
-
<%+footer%>
diff --git a/applications/luci-livestats/luasrc/view/livestats/traffic.htm b/applications/luci-livestats/luasrc/view/livestats/traffic.htm
index 083b5cc2e6..f0c194dac5 100644
--- a/applications/luci-livestats/luasrc/view/livestats/traffic.htm
+++ b/applications/luci-livestats/luasrc/view/livestats/traffic.htm
@@ -5,9 +5,11 @@
<script type="text/javascript" src="<%=resource%>/livestats/JsonRpc.js"></script>
<script type="text/javascript" src="<%=resource%>/livestats/PlotKit.js"></script>
<script type="text/javascript" src="<%=resource%>/livestats/GraphRPC.js"></script>
+<script type="text/javascript" src="<%=resource%>/livestats/Legend.js"></script>
<%
local interfaces = { }
+ local ifnames = {}
local uci = luci.model.uci.cursor_state()
uci:foreach("network", "interface",
@@ -16,6 +18,7 @@
table.insert( interfaces,
"'" .. ( s.ifname or s['.name'] ) .. "'"
)
+ ifnames[s.ifname or s['.name']] = s['.name']
end
end
)
@@ -29,20 +32,29 @@
2000,
// Data sources
- [ "1", "received Bytes/s", "9", "transmitted Bytes/s" ],
+ [ "0", "<%:livestats_incoming%> (kiB/s)", "8", "<%:livestats_outgoing%> (kiB/s)" ],
// Graph layout options
- { shouldFill: true, drawBackground: false, strokeColor: null,
- strokeColorTransform: "asFillColor",
- title: 'Traffic on interface "%s"',
- separateDS: true, strokeWidth: 0.5, height: 140,
- padding: { left: 70, right: 10, top: 10, bottom: 20 },
- instances: [ <%=table.concat(interfaces, ", ") %> ] },
+ {
+ shouldFill: false,
+ drawBackground: false,
+ strokeColor: null,
+ title: '<%:livestats_traffic%> %s',
+ strokeWidth: 2.5, height: 140,
+ padding: { left: 70, right: 10, top: 10, bottom: 20 },
+ instances: [ <%=table.concat(interfaces, ", ") %> ],
+ instanceNames: {
+ <%- for iface, network in pairs(ifnames) do %>
+ <%-="%q:%q," % {iface, network}-%>
+ <% end %>
+ "0": ""
+ }},
// transform function
- function(thisval, lastval) {
- return ( ( thisval - lastval ) / 2 );
- }
+ function (cur, last) {
+ return (cur - last) / 2048;
+ },
+ 'live_graphs'
);
}
diff --git a/applications/luci-livestats/luasrc/view/livestats/wireless.htm b/applications/luci-livestats/luasrc/view/livestats/wireless.htm
index 2e34df978e..670d9fbf6c 100644
--- a/applications/luci-livestats/luasrc/view/livestats/wireless.htm
+++ b/applications/luci-livestats/luasrc/view/livestats/wireless.htm
@@ -5,6 +5,7 @@
<script type="text/javascript" src="<%=resource%>/livestats/JsonRpc.js"></script>
<script type="text/javascript" src="<%=resource%>/livestats/PlotKit.js"></script>
<script type="text/javascript" src="<%=resource%>/livestats/GraphRPC.js"></script>
+<script type="text/javascript" src="<%=resource%>/livestats/Legend.js"></script>
<script type="text/javascript">
function initGraphs() {
@@ -14,12 +15,23 @@
1500,
// Data sources
- [ "Noise level", null, "Signal level", null ],
+ [ function(data) {
+ return parseFloat(data["Signal level"])
+ - parseFloat(data["Noise level"]);
+ }, "S/N (dBm)"],
// Graph layout options
- { drawBackground: false, yAxis: [ 0, 150 ],
- title: 'Wifi Interface "%s": Signal and Noise',
- padding: { left: 40, right: 10, top: 10, bottom: 20 } }
+ { drawBackground: false, yAxis: [ 0, 50 ],
+ title: '<%:livestats_wifi%> %s',
+ padding: { left: 40, right: 10, top: 10, bottom: 20 },
+ instanceNames: {
+ <%- for k,v in pairs(luci.sys.wifi.getiwconfig()) do %>
+ <%-="%q:%q," % {k, "%s (%s)" % {k, tostring(v.ESSID)}}-%>
+ <% end %>
+ "0": ""
+ }},
+ null,
+ 'live_graphs'
);
}