luci-app-firewall: convert controller to static menu JSON
authorJo-Philipp Wich <jo@mein.io>
Fri, 6 Dec 2019 20:59:52 +0000 (21:59 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 16 Dec 2019 17:07:17 +0000 (18:07 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-firewall/luasrc/controller/firewall.lua [deleted file]
applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json [new file with mode: 0644]

diff --git a/applications/luci-app-firewall/luasrc/controller/firewall.lua b/applications/luci-app-firewall/luasrc/controller/firewall.lua
deleted file mode 100644 (file)
index 5f8cb6e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-module("luci.controller.firewall", package.seeall)
-
-function index()
-       entry({"admin", "network", "firewall"},
-               alias("admin", "network", "firewall", "zones"),
-               _("Firewall"), 60)
-
-       entry({"admin", "network", "firewall", "zones"},
-               view("firewall/zones"), _("General Settings"), 10)
-
-       entry({"admin", "network", "firewall", "forwards"},
-               view("firewall/forwards"), _("Port Forwards"), 20)
-
-       entry({"admin", "network", "firewall", "rules"},
-               view("firewall/rules"), _("Traffic Rules"), 30)
-
-       entry({"admin", "network", "firewall", "custom"},
-               view("firewall/custom"), _("Custom Rules"), 40).leaf = true
-end
diff --git a/applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json b/applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json
new file mode 100644 (file)
index 0000000..c414f36
--- /dev/null
@@ -0,0 +1,50 @@
+{
+       "admin/network/firewall": {
+               "title": "Firewall",
+               "order": 60,
+               "action": {
+                       "type": "alias",
+                       "path": "admin/network/firewall/zones"
+               },
+               "depends": {
+                       "fs": { "/sbin/fw3": "executable" },
+                       "uci": { "firewall": true }
+               }
+       },
+
+       "admin/network/firewall/zones": {
+               "title": "General Settings",
+               "order": 10,
+               "action": {
+                       "type": "view",
+                       "path": "firewall/zones"
+               }
+       },
+
+       "admin/network/firewall/forwards": {
+               "title": "Port Forwards",
+               "order": 20,
+               "action": {
+                       "type": "view",
+                       "path": "firewall/forwards"
+               }
+       },
+
+       "admin/network/firewall/rules": {
+               "title": "Traffic Rules",
+               "order": 30,
+               "action": {
+                       "type": "view",
+                       "path": "firewall/rules"
+               }
+       },
+
+       "admin/network/firewall/custom": {
+               "title": "Custom Rules",
+               "order": 40,
+               "action": {
+                       "type": "view",
+                       "path": "firewall/custom"
+               }
+       }
+}