diff options
author | Daniel F. Dickinson <cshored@thecshore.com> | 2018-08-03 12:36:51 -0400 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-09-19 20:08:19 +0200 |
commit | 58d97b5e271bc0d7507eab5b9bd2902181864e02 (patch) | |
tree | 80e250346ad33c79b3f821daf7b7d9be90d99240 /modules/luci-base/luasrc/controller/admin | |
parent | 6ec0353201435e0d0d7d32820d8ba600b4ca7b5b (diff) |
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 <cshored@thecshore.com>
Diffstat (limited to 'modules/luci-base/luasrc/controller/admin')
-rw-r--r-- | modules/luci-base/luasrc/controller/admin/index.lua | 40 |
1 files changed, 40 insertions, 0 deletions
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 |