luci-mod-status: convert menu nodes to JSON
authorJo-Philipp Wich <jo@mein.io>
Tue, 10 Dec 2019 07:49:24 +0000 (08:49 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 7 May 2020 17:40:50 +0000 (19:40 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit c698cd5ab9ad9021ac7b92a45d7ba401cb3617d0)

modules/luci-mod-status/luasrc/controller/admin/status.lua [deleted file]
modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json [new file with mode: 0644]

diff --git a/modules/luci-mod-status/luasrc/controller/admin/status.lua b/modules/luci-mod-status/luasrc/controller/admin/status.lua
deleted file mode 100644 (file)
index c78a83b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
--- Copyright 2008 Steven Barth <steven@midlink.org>
--- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
--- Licensed to the public under the Apache License 2.0.
-
-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"}, view("status/iptables"), _("Firewall"), 2).leaf = true
-
-       entry({"admin", "status", "routes"}, view("status/routes"), _("Routes"), 3)
-       entry({"admin", "status", "syslog"}, view("status/syslog"), _("System Log"), 4)
-       entry({"admin", "status", "dmesg"}, view("status/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
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 (file)
index 0000000..0dcf6e8
--- /dev/null
@@ -0,0 +1,103 @@
+{
+       "admin/status/overview": {
+               "title": "Overview",
+               "order": 1,
+               "action": {
+                       "type": "template",
+                       "path": "admin_status/index"
+               }
+       },
+
+       "admin/status/iptables": {
+               "title": "Firewall",
+               "order": 2,
+               "action": {
+                       "type": "view",
+                       "path": "status/iptables"
+               }
+       },
+
+       "admin/status/routes": {
+               "title": "Routes",
+               "order": 3,
+               "action": {
+                       "type": "view",
+                       "path": "status/routes"
+               }
+       },
+
+       "admin/status/syslog": {
+               "title": "System Log",
+               "order": 4,
+               "action": {
+                       "type": "view",
+                       "path": "status/syslog"
+               }
+       },
+
+       "admin/status/dmesg": {
+               "title": "Kernel Log",
+               "order": 5,
+               "action": {
+                       "type": "view",
+                       "path": "status/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"
+               }
+       }
+}