summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status/luasrc/controller/admin
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-11-02 22:55:59 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-03 17:56:58 +0100
commitcfb5af89e108960c33d12cbd6dd76e9aa4e19bee (patch)
treeeff25a43f550318944e8c018b4129f36bc7da8bd /modules/luci-mod-status/luasrc/controller/admin
parenta2f43983b63b2e65aba7dd7f7f2fa22306c12e21 (diff)
luci-base, luci-mod-status: convert realtime stats to client side views
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-status/luasrc/controller/admin')
-rw-r--r--modules/luci-mod-status/luasrc/controller/admin/status.lua114
1 files changed, 4 insertions, 110 deletions
diff --git a/modules/luci-mod-status/luasrc/controller/admin/status.lua b/modules/luci-mod-status/luasrc/controller/admin/status.lua
index d09cb6e2f7..e888ccf097 100644
--- a/modules/luci-mod-status/luasrc/controller/admin/status.lua
+++ b/modules/luci-mod-status/luasrc/controller/admin/status.lua
@@ -20,22 +20,10 @@ function index()
entry({"admin", "status", "realtime"}, alias("admin", "status", "realtime", "load"), _("Realtime Graphs"), 7)
- entry({"admin", "status", "realtime", "load"}, template("admin_status/load"), _("Load"), 1).leaf = true
- entry({"admin", "status", "realtime", "load_status"}, call("action_load")).leaf = true
-
- entry({"admin", "status", "realtime", "bandwidth"}, template("admin_status/bandwidth"), _("Traffic"), 2).leaf = true
- entry({"admin", "status", "realtime", "bandwidth_status"}, call("action_bandwidth")).leaf = true
-
- page = entry({"admin", "status", "realtime", "wireless"}, template("admin_status/wireless"), _("Wireless"), 3)
- page.uci_depends = { wireless = true }
- page.leaf = true
-
- page = entry({"admin", "status", "realtime", "wireless_status"}, call("action_wireless"))
- page.uci_depends = { wireless = true }
- page.leaf = true
-
- entry({"admin", "status", "realtime", "connections"}, template("admin_status/connections"), _("Connections"), 4).leaf = true
- entry({"admin", "status", "realtime", "connections_status"}, call("action_connections")).leaf = true
+ entry({"admin", "status", "realtime", "load"}, view("status/load"), _("Load"), 1)
+ entry({"admin", "status", "realtime", "bandwidth"}, view("status/bandwidth"), _("Traffic"), 2)
+ entry({"admin", "status", "realtime", "wireless"}, view("status/wireless"), _("Wireless"), 3).uci_depends = { wireless = true }
+ entry({"admin", "status", "realtime", "connections"}, view("status/connections"), _("Connections"), 4)
entry({"admin", "status", "nameinfo"}, call("action_nameinfo")).leaf = true
end
@@ -84,97 +72,3 @@ function action_iptables()
luci.http.redirect(luci.dispatcher.build_url("admin/status/iptables"))
end
-
-function action_bandwidth(iface)
- luci.http.prepare_content("application/json")
-
- local bwc = io.popen("luci-bwc -i %s 2>/dev/null"
- % luci.util.shellquote(iface))
-
- if bwc then
- luci.http.write("[")
-
- while true do
- local ln = bwc:read("*l")
- if not ln then break end
- luci.http.write(ln)
- end
-
- luci.http.write("]")
- bwc:close()
- end
-end
-
-function action_wireless(iface)
- luci.http.prepare_content("application/json")
-
- local bwc = io.popen("luci-bwc -r %s 2>/dev/null"
- % luci.util.shellquote(iface))
-
- if bwc then
- luci.http.write("[")
-
- while true do
- local ln = bwc:read("*l")
- if not ln then break end
- luci.http.write(ln)
- end
-
- luci.http.write("]")
- bwc:close()
- end
-end
-
-function action_load()
- luci.http.prepare_content("application/json")
-
- local bwc = io.popen("luci-bwc -l 2>/dev/null")
- if bwc then
- luci.http.write("[")
-
- while true do
- local ln = bwc:read("*l")
- if not ln then break end
- luci.http.write(ln)
- end
-
- luci.http.write("]")
- bwc:close()
- end
-end
-
-function action_connections()
- local sys = require "luci.sys"
-
- luci.http.prepare_content("application/json")
-
- luci.http.write('{ "connections": ')
- luci.http.write_json(sys.net.conntrack())
-
- local bwc = io.popen("luci-bwc -c 2>/dev/null")
- if bwc then
- luci.http.write(', "statistics": [')
-
- while true do
- local ln = bwc:read("*l")
- if not ln then break end
- luci.http.write(ln)
- end
-
- luci.http.write("]")
- bwc:close()
- end
-
- luci.http.write(" }")
-end
-
-function action_nameinfo(...)
- local util = require "luci.util"
-
- luci.http.prepare_content("application/json")
- luci.http.write_json(util.ubus("network.rrdns", "lookup", {
- addrs = { ... },
- timeout = 5000,
- limit = 1000
- }) or { })
-end