From c698cd5ab9ad9021ac7b92a45d7ba401cb3617d0 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 10 Dec 2019 08:49:24 +0100 Subject: [PATCH] luci-mod-status: convert menu nodes to JSON Signed-off-by: Jo-Philipp Wich --- .../luasrc/controller/admin/status.lua | 24 ---- .../share/luci/menu.d/luci-mod-status.json | 129 ++++++++++++++++++ 2 files changed, 129 insertions(+), 24 deletions(-) create mode 100644 modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json diff --git a/modules/luci-mod-status/luasrc/controller/admin/status.lua b/modules/luci-mod-status/luasrc/controller/admin/status.lua index 6f84149223..2684bdf715 100644 --- a/modules/luci-mod-status/luasrc/controller/admin/status.lua +++ b/modules/luci-mod-status/luasrc/controller/admin/status.lua @@ -4,30 +4,6 @@ module("luci.controller.admin.status", package.seeall) -function index() - local page - - entry({"admin", "status", "overview"}, template("admin_status/index"), _("Overview"), 1) - - entry({"admin", "status", "iptables"}, template("admin_status/iptables"), _("Firewall"), 2).leaf = true - entry({"admin", "status", "iptables_dump"}, call("dump_iptables")).leaf = true - entry({"admin", "status", "iptables_action"}, post("action_iptables")).leaf = true - - entry({"admin", "status", "routes"}, template("admin_status/routes"), _("Routes"), 3) - entry({"admin", "status", "syslog"}, call("action_syslog"), _("System Log"), 4) - entry({"admin", "status", "dmesg"}, call("action_dmesg"), _("Kernel Log"), 5) - entry({"admin", "status", "processes"}, view("status/processes"), _("Processes"), 6) - - entry({"admin", "status", "realtime"}, alias("admin", "status", "realtime", "load"), _("Realtime Graphs"), 7) - - 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 - function action_syslog() local syslog = luci.sys.syslog() luci.template.render("admin_status/syslog", {syslog=syslog}) diff --git a/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json b/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json new file mode 100644 index 0000000000..03f7dce3b9 --- /dev/null +++ b/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json @@ -0,0 +1,129 @@ +{ + "admin/status/overview": { + "title": "Overview", + "order": 1, + "action": { + "type": "template", + "path": "admin_status/index" + } + }, + + "admin/status/iptables/*": { + "title": "Firewall", + "order": 2, + "action": { + "type": "template", + "path": "admin_status/iptables" + } + }, + + "admin/status/iptables_dump/*": { + "action": { + "type": "call", + "module": "luci.controller.admin.status", + "function": "dump_iptables" + } + }, + + "admin/status/iptables_action/*": { + "action": { + "type": "call", + "module": "luci.controller.admin.status", + "function": "action_iptables" + } + }, + + "admin/status/routes": { + "title": "Routes", + "order": 3, + "action": { + "type": "template", + "path": "admin_status/routes" + } + }, + + "admin/status/syslog": { + "title": "System Log", + "order": 4, + "action": { + "type": "call", + "module": "luci.controller.admin.status", + "function": "action_syslog" + } + }, + + "admin/status/dmesg": { + "title": "Kernel Log", + "order": 5, + "action": { + "type": "call", + "module": "luci.controller.admin.status", + "function": "action_dmesg" + } + }, + + "admin/status/processes": { + "title": "Processes", + "order": 6, + "action": { + "type": "view", + "path": "status/processes" + } + }, + + "admin/status/realtime": { + "title": "Realtime Graphs", + "order": 7, + "action": { + "type": "alias", + "path": "admin/status/realtime/load" + } + }, + + "admin/status/realtime/load": { + "title": "Load", + "order": 1, + "action": { + "type": "view", + "path": "status/load" + } + }, + + "admin/status/realtime/bandwidth": { + "title": "Traffic", + "order": 2, + "action": { + "type": "view", + "path": "status/bandwidth" + } + }, + + "admin/status/realtime/wireless": { + "title": "Wireless", + "order": 3, + "action": { + "type": "view", + "path": "status/wireless" + }, + "depends": { + "uci": { "wireless": { "@wifi-device": true } } + } + }, + + "admin/status/realtime/connections": { + "title": "Connections", + "order": 4, + "action": { + "type": "view", + "path": "status/connections" + } + }, + + "admin/status/nameinfo/*": { + "action": { + "type": "call", + "module": "luci.controller.admin.status", + "function": "action_nameinfo" + } + } +} -- 2.30.2