From: Daniel F. Dickinson Date: Fri, 3 Aug 2018 16:36:51 +0000 (-0400) Subject: modules: Split luci-mod-full X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=58d97b5e271bc0d7507eab5b9bd2902181864e02;p=openwrt-luci.git modules: Split luci-mod-full Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson --- diff --git a/modules/luci-base/luasrc/controller/admin/index.lua b/modules/luci-base/luasrc/controller/admin/index.lua index 39e6e573b1..360298b1cd 100644 --- a/modules/luci-base/luasrc/controller/admin/index.lua +++ b/modules/luci-base/luasrc/controller/admin/index.lua @@ -16,6 +16,8 @@ function index() end end + local uci = require("luci.model.uci").cursor() + local root = node() if not root.target then root.target = alias("admin") @@ -23,6 +25,7 @@ function index() end local page = node("admin") + page.title = _("Administration") page.order = 10 page.sysauth = "root" @@ -61,6 +64,24 @@ function index() page.index = true toplevel_page(page, false, false) + if nixio.fs.access("/etc/config/dhcp") then + page = entry({"admin", "dhcplease_status"}, call("lease_status"), nil) + page.leaf = true + end + + local has_wifi = false + + uci:foreach("wireless", "wifi-device", + function(s) + has_wifi = true + return false + end) + + if has_wifi then + page = entry({"admin", "wireless_assoclist"}, call("wifi_assoclist"), nil) + page.leaf = true + end + -- Logout is last entry({"admin", "logout"}, call("action_logout"), _("Logout"), 999) end @@ -80,3 +101,22 @@ function action_logout() luci.http.redirect(dsp.build_url()) end + + +function lease_status() + local s = require "luci.tools.status" + + luci.http.prepare_content("application/json") + luci.http.write('[') + luci.http.write_json(s.dhcp_leases()) + luci.http.write(',') + luci.http.write_json(s.dhcp6_leases()) + luci.http.write(']') +end + +function wifi_assoclist() + local s = require "luci.tools.status" + + luci.http.prepare_content("application/json") + luci.http.write_json(s.wifi_assoclist()) +end diff --git a/modules/luci-mod-admin-full/luasrc/view/cbi/wireless_modefreq.htm b/modules/luci-base/luasrc/view/cbi/wireless_modefreq.htm similarity index 100% rename from modules/luci-mod-admin-full/luasrc/view/cbi/wireless_modefreq.htm rename to modules/luci-base/luasrc/view/cbi/wireless_modefreq.htm diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-base/luasrc/view/lease_status.htm similarity index 97% rename from modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm rename to modules/luci-base/luasrc/view/lease_status.htm index 8fbbdc9477..15b6b6908e 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ b/modules/luci-base/luasrc/view/lease_status.htm @@ -1,5 +1,5 @@