diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-12-06 22:59:33 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-12-16 18:07:18 +0100 |
commit | 5448a10e302bae5c5f0a45b2e43328ed00664cb0 (patch) | |
tree | 95d113323099b43e700d3a168f1c126666b57ee2 /modules/luci-mod-network | |
parent | 566a99591b9dd49f1736982a52e17d76f877fa76 (diff) |
luci-mod-network: convert menu nodes to JSON
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network')
-rw-r--r-- | modules/luci-mod-network/luasrc/controller/admin/network.lua | 57 | ||||
-rw-r--r-- | modules/luci-mod-network/root/usr/share/luci/menu.d/luci-mod-network.json | 130 |
2 files changed, 130 insertions, 57 deletions
diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua index bd00235fa..4e9d27e8a 100644 --- a/modules/luci-mod-network/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua @@ -4,63 +4,6 @@ module("luci.controller.admin.network", package.seeall) -function index() - local page - --- if page.inreq then - page = entry({"admin", "network", "switch"}, view("network/switch"), _("Switch"), 20) - page.uci_depends = { network = { ["@switch[0]"] = "switch" } } - - page = entry({"admin", "network", "wireless"}, view("network/wireless"), _('Wireless'), 15) - page.uci_depends = { wireless = { ["@wifi-device[0]"] = "wifi-device" } } - page.leaf = true - - page = entry({"admin", "network", "remote_addr"}, call("remote_addr"), nil) - page.leaf = true - - page = entry({"admin", "network", "network"}, view("network/interfaces"), _("Interfaces"), 10) - page.leaf = true - page.subindex = true - - page = node("admin", "network", "dhcp") - page.uci_depends = { dhcp = true } - page.target = view("network/dhcp") - page.title = _("DHCP and DNS") - page.order = 30 - - page = node("admin", "network", "hosts") - page.uci_depends = { dhcp = true } - page.target = view("network/hosts") - page.title = _("Hostnames") - page.order = 40 - - page = node("admin", "network", "routes") - page.target = view("network/routes") - page.title = _("Static Routes") - page.order = 50 - - page = node("admin", "network", "diagnostics") - page.target = template("admin_network/diagnostics") - page.title = _("Diagnostics") - page.order = 60 - - page = entry({"admin", "network", "diag_ping"}, post("diag_ping"), nil) - page.leaf = true - - page = entry({"admin", "network", "diag_nslookup"}, post("diag_nslookup"), nil) - page.leaf = true - - page = entry({"admin", "network", "diag_traceroute"}, post("diag_traceroute"), nil) - page.leaf = true - - page = entry({"admin", "network", "diag_ping6"}, post("diag_ping6"), nil) - page.leaf = true - - page = entry({"admin", "network", "diag_traceroute6"}, post("diag_traceroute6"), nil) - page.leaf = true --- end -end - local function addr2dev(addr, src) local ip = require "luci.ip" local route = ip.route(addr, src) diff --git a/modules/luci-mod-network/root/usr/share/luci/menu.d/luci-mod-network.json b/modules/luci-mod-network/root/usr/share/luci/menu.d/luci-mod-network.json new file mode 100644 index 000000000..990c5d35e --- /dev/null +++ b/modules/luci-mod-network/root/usr/share/luci/menu.d/luci-mod-network.json @@ -0,0 +1,130 @@ +{ + "admin/network/switch": { + "title": "Switch", + "order": 20, + "action": { + "type": "view", + "path": "network/switch" + }, + "depends": { + "fs": { "/sbin/swconfig": "executable" }, + "uci": { "network": { "@switch": true } } + } + }, + + "admin/network/wireless": { + "title": "Wireless", + "order": 15, + "action": { + "type": "view", + "path": "network/wireless" + }, + "depends": { + "uci": { "wireless": { "@wifi-device": true } } + } + }, + + "admin/network/remote_addr/*": { + "action": { + "type": "call", + "module": "luci.controller.admin.network", + "function": "remote_addr" + } + }, + + "admin/network/network": { + "title": "Interfaces", + "order": 10, + "action": { + "type": "view", + "path": "network/interfaces" + } + }, + + "admin/network/dhcp": { + "title": "DHCP and DNS", + "order": 30, + "action": { + "type": "view", + "path": "network/dhcp" + }, + "depends": { + "uci": { "dhcp": true } + } + }, + + "admin/network/hosts": { + "title": "Hostnames", + "order": 40, + "action": { + "type": "view", + "path": "network/hosts" + }, + "depends": { + "uci": { "dhcp": true } + } + }, + + "admin/network/routes": { + "title": "Static Routes", + "order": 50, + "action": { + "type": "view", + "path": "network/routes" + } + }, + + "admin/network/diagnostics": { + "title": "Diagnostics", + "order": 60, + "action": { + "type": "template", + "path": "admin_network/diagnostics" + } + }, + + "admin/network/diag_ping/*": { + "action": { + "post": true, + "type": "call", + "module": "luci.controller.admin.network", + "function": "diag_ping" + } + }, + + "admin/network/diag_nslookup/*": { + "action": { + "post": true, + "type": "call", + "module": "luci.controller.admin.network", + "function": "diag_nslookup" + } + }, + + "admin/network/diag_traceroute/*": { + "action": { + "post": true, + "type": "call", + "module": "luci.controller.admin.network", + "function": "diag_traceroute" + } + }, + + "admin/network/diag_ping6/*": { + "action": { + "post": true, + "type": "call", + "module": "luci.controller.admin.network", + "function": "diag_ping6" + } + }, + + "admin/network/diag_traceroute6/*": { + "action": { + "post": true, + "type": "call", + "module": "luci.controller.admin.network", + "function": "diag_traceroute6" + } + } +} |