diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-01-30 12:08:35 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-01-31 08:51:55 +0100 |
commit | 40c56ddd7797f9e916abe5443784b21ed9ba51cf (patch) | |
tree | 2845066826f787cfc2d100a3e073737cfa03cf89 /applications/luci-app-vnstat2/luasrc/view | |
parent | 7cfce565530cbf6103275002ad20af57a509ad7b (diff) |
luci-app-vnstat2: fully convert to client side rendering
This converts the graph rendering to client side JavaScript and replaces
the route registration with declarative JSON.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-vnstat2/luasrc/view')
-rw-r--r-- | applications/luci-app-vnstat2/luasrc/view/vnstat2/graphs.htm | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/applications/luci-app-vnstat2/luasrc/view/vnstat2/graphs.htm b/applications/luci-app-vnstat2/luasrc/view/vnstat2/graphs.htm deleted file mode 100644 index 318611a9d6..0000000000 --- a/applications/luci-app-vnstat2/luasrc/view/vnstat2/graphs.htm +++ /dev/null @@ -1,55 +0,0 @@ -<%# - This is free software, licensed under the Apache License, Version 2.0 --%> - -<%- - -local util = require "luci.util" -local json = require "luci.jsonc" - - -local ifaces = {} - -local data = util.exec("vnstat --json f 1 2>/dev/null") -local content = json.parse(data) -if type(content) == "table" then - for _, iface in pairs(content["interfaces"]) do - table.insert(ifaces, iface["name"]) - end -end - - -local function render_section(style, title) - %><div class="cbi-section" data-tab="<%=style%>" data-tab-title="<%=title%>"><% - - for _, iface in ipairs(ifaces) do - %><p><img src="<%=url("admin/status/vnstat2/graph")%>?iface=<%=iface%>&style=<%=style%>" alt="" style="max-width:100%" /></p><% - end - - %></div><% -end - - --%> - -<%+header%> - -<h2 name="content"><%:vnStat Graphs%></h2> - -<div> - <% - if #ifaces == 0 then - %><p><em><%:No monitored interfaces have been found. Go to the configuration to enable monitoring for one or more interfaces.%></em></p><% - else - render_section("s", translate("Summary")) - render_section("t", translate("Top")) - render_section("5", translate("5 Minute")) - render_section("h", translate("Hourly")) - render_section("d", translate("Daily")) - render_section("m", translate("Monthly")) - render_section("y", translate("Yearly")) - end - %> -</div> - -<%+footer%> |