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>
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url('admin/network/dhcplease_status')%>', null,
|
||||
XHR.poll(5, '<%=url('admin/dhcplease_status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('lease_status_table');
|
@ -17,7 +17,7 @@
|
||||
return s;
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url('admin/network/wireless_assoclist')%>', null,
|
||||
XHR.poll(5, '<%=url('admin/wireless_assoclist')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('wifi_assoclist_table');
|
@ -7,9 +7,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Administration - full-featured for full control
|
||||
LUCI_DEPENDS:=+luci-base
|
||||
LUCI_DEPENDS:=+luci-base +luci-mod-status +luci-mod-system +luci-mod-network
|
||||
|
||||
PKG_BUILD_DEPENDS:=iwinfo
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include ../../luci.mk
|
||||
|
17
modules/luci-mod-network/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Network Administration
|
||||
LUCI_DEPENDS:=+luci-base +libiwinfo-lua
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
@ -37,9 +37,6 @@ function index()
|
||||
end)
|
||||
|
||||
if has_wifi then
|
||||
page = entry({"admin", "network", "wireless_assoclist"}, call("wifi_assoclist"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "network", "wireless_join"}, post("wifi_join"), nil)
|
||||
page.leaf = true
|
||||
|
||||
@ -110,9 +107,6 @@ function index()
|
||||
page.title = _("DHCP and DNS")
|
||||
page.order = 30
|
||||
|
||||
page = entry({"admin", "network", "dhcplease_status"}, call("lease_status"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = node("admin", "network", "hosts")
|
||||
page.target = cbi("admin_network/hosts")
|
||||
page.title = _("Hostnames")
|
||||
@ -302,14 +296,6 @@ function wifi_reconnect(radio)
|
||||
end
|
||||
end
|
||||
|
||||
function wifi_assoclist()
|
||||
local s = require "luci.tools.status"
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(s.wifi_assoclist())
|
||||
end
|
||||
|
||||
|
||||
local function _wifi_get_scan_results(cache_key)
|
||||
local results = luci.util.ubus("session", "get", {
|
||||
ubus_rpc_session = luci.model.uci:get_session_id(),
|
||||
@ -381,17 +367,6 @@ function wifi_scan_results(radio)
|
||||
end
|
||||
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 switch_status(switches)
|
||||
local s = require "luci.tools.status"
|
||||
|
@ -266,7 +266,7 @@ o = s:taboption("general", DynamicList, "notinterface",
|
||||
o.optional = true
|
||||
o:depends("nonwildcard", true)
|
||||
|
||||
m:section(SimpleSection).template = "admin_network/lease_status"
|
||||
m:section(SimpleSection).template = "lease_status"
|
||||
|
||||
s = m:section(TypedSection, "host", translate("Static Leases"),
|
||||
translate("Static leases are used to assign fixed IP addresses and symbolic hostnames to " ..
|
@ -216,7 +216,7 @@ s = m:section(NamedSection, "__assoclist__")
|
||||
function s.render(self, sid)
|
||||
tpl.render_string([[
|
||||
<h2><%:Associated Stations%></h2>
|
||||
<%+admin_network/wifi_assoclist%>
|
||||
<%+wifi_assoclist%>
|
||||
]])
|
||||
end
|
||||
|
18
modules/luci-mod-status/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Status Pages
|
||||
LUCI_DEPENDS:=+luci-base +libiwinfo +libiwinfo-lua
|
||||
|
||||
PKG_BUILD_DEPENDS:=iwinfo
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 973 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -442,7 +442,7 @@
|
||||
|
||||
<%
|
||||
if has_dhcp then
|
||||
include("admin_network/lease_status")
|
||||
include("lease_status")
|
||||
end
|
||||
%>
|
||||
|
||||
@ -468,7 +468,7 @@
|
||||
<div class="cbi-section">
|
||||
<h3><%:Associated Stations%></h3>
|
||||
|
||||
<%+admin_network/wifi_assoclist%>
|
||||
<%+wifi_assoclist%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
17
modules/luci-mod-system/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Administration - Global System Settings
|
||||
LUCI_DEPENDS:=+luci-base
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|