* Moved Freifunk status pages to admin-core and linked them in Freifunk
* luci/web: Added assign() to dispatcher to reference foreign nodes in the dispatching tree
This commit is contained in:
parent
953510ccac
commit
561b0cfaa3
12 changed files with 38 additions and 33 deletions
|
@ -293,20 +293,29 @@ function createtree()
|
||||||
built_tree = true
|
built_tree = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Shortcut for creating a dispatching node
|
-- Reassigns a node to another position
|
||||||
function entry(path, target, title, order, add)
|
function assign(path, clone, title, order)
|
||||||
add = add or {}
|
local obj = node(path)
|
||||||
|
obj.nodes = nil
|
||||||
|
obj.module = nil
|
||||||
|
|
||||||
|
obj.title = title
|
||||||
|
obj.order = order
|
||||||
|
|
||||||
|
setmetatable(obj, {__index = clone})
|
||||||
|
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Shortcut for creating a dispatching node
|
||||||
|
function entry(path, target, title, order)
|
||||||
local c = node(path)
|
local c = node(path)
|
||||||
|
|
||||||
c.target = target
|
c.target = target
|
||||||
c.title = title
|
c.title = title
|
||||||
c.order = order
|
c.order = order
|
||||||
c.module = getfenv(2)._NAME
|
c.module = getfenv(2)._NAME
|
||||||
|
|
||||||
for k,v in pairs(add) do
|
|
||||||
c[k] = v
|
|
||||||
end
|
|
||||||
|
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ function index()
|
||||||
|
|
||||||
entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20)
|
entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20)
|
||||||
entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll"))
|
entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll"))
|
||||||
|
entry({"admin", "status", "routes"}, template("admin_status/routes"), "Routingtabelle", 10)
|
||||||
|
entry({"admin", "status", "iwscan"}, template("admin_status/iwscan"), "WLAN-Scan", 20)
|
||||||
end
|
end
|
||||||
|
|
||||||
function action_syslog()
|
function action_syslog()
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
module("luci.controller.freifunk.olsr", package.seeall)
|
module("luci.controller.admin.status_olsr", package.seeall)
|
||||||
require("luci.sys")
|
require("luci.sys")
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
local page = node("freifunk", "olsr")
|
local page = node("admin", "status", "olsr")
|
||||||
page.target = call("action_index")
|
page.target = call("action_index")
|
||||||
page.title = "OLSR"
|
page.title = "OLSR"
|
||||||
page.order = 30
|
|
||||||
|
|
||||||
local page = node("freifunk", "olsr", "routes")
|
local page = node("admin", "status", "olsr", "routes")
|
||||||
page.target = call("action_routes")
|
page.target = call("action_routes")
|
||||||
page.title = "Routen"
|
page.title = "Routen"
|
||||||
page.order = 10
|
page.order = 10
|
||||||
|
|
||||||
local page = node("freifunk", "olsr", "topology")
|
local page = node("admin", "status", "olsr", "topology")
|
||||||
page.target = call("action_topology")
|
page.target = call("action_topology")
|
||||||
page.title = "Topologie"
|
page.title = "Topologie"
|
||||||
page.order = 20
|
page.order = 20
|
||||||
|
|
||||||
local page = node("freifunk", "olsr", "hna")
|
local page = node("admin", "status", "olsr", "hna")
|
||||||
page.target = call("action_hna")
|
page.target = call("action_hna")
|
||||||
page.title = "HNA"
|
page.title = "HNA"
|
||||||
page.order = 30
|
page.order = 30
|
||||||
|
|
||||||
local page = node("freifunk", "olsr", "mid")
|
local page = node("admin", "status", "olsr", "mid")
|
||||||
page.target = call("action_mid")
|
page.target = call("action_mid")
|
||||||
page.title = "MID"
|
page.title = "MID"
|
||||||
page.order = 50
|
page.order = 50
|
||||||
|
@ -32,7 +31,7 @@ function action_index()
|
||||||
local data = fetch_txtinfo("links")
|
local data = fetch_txtinfo("links")
|
||||||
|
|
||||||
if not data or not data.Links then
|
if not data or not data.Links then
|
||||||
luci.template.render("freifunk-olsr/error_olsr")
|
luci.template.render("status-olsr/error_olsr")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,14 +49,14 @@ function action_index()
|
||||||
|
|
||||||
table.sort(data.Links, compare)
|
table.sort(data.Links, compare)
|
||||||
|
|
||||||
luci.template.render("freifunk-olsr/index", {links=data.Links})
|
luci.template.render("status-olsr/index", {links=data.Links})
|
||||||
end
|
end
|
||||||
|
|
||||||
function action_routes()
|
function action_routes()
|
||||||
local data = fetch_txtinfo("routes")
|
local data = fetch_txtinfo("routes")
|
||||||
|
|
||||||
if not data or not data.Routes then
|
if not data or not data.Routes then
|
||||||
luci.template.render("freifunk-olsr/error_olsr")
|
luci.template.render("status-olsr/error_olsr")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,14 +74,14 @@ function action_routes()
|
||||||
|
|
||||||
table.sort(data.Routes, compare)
|
table.sort(data.Routes, compare)
|
||||||
|
|
||||||
luci.template.render("freifunk-olsr/routes", {routes=data.Routes})
|
luci.template.render("status-olsr/routes", {routes=data.Routes})
|
||||||
end
|
end
|
||||||
|
|
||||||
function action_topology()
|
function action_topology()
|
||||||
local data = fetch_txtinfo("topology")
|
local data = fetch_txtinfo("topology")
|
||||||
|
|
||||||
if not data or not data.Topology then
|
if not data or not data.Topology then
|
||||||
luci.template.render("freifunk-olsr/error_olsr")
|
luci.template.render("status-olsr/error_olsr")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -92,14 +91,14 @@ function action_topology()
|
||||||
|
|
||||||
table.sort(data.Topology, compare)
|
table.sort(data.Topology, compare)
|
||||||
|
|
||||||
luci.template.render("freifunk-olsr/topology", {routes=data.Topology})
|
luci.template.render("status-olsr/topology", {routes=data.Topology})
|
||||||
end
|
end
|
||||||
|
|
||||||
function action_hna()
|
function action_hna()
|
||||||
local data = fetch_txtinfo("hna")
|
local data = fetch_txtinfo("hna")
|
||||||
|
|
||||||
if not data or not data.HNA then
|
if not data or not data.HNA then
|
||||||
luci.template.render("freifunk-olsr/error_olsr")
|
luci.template.render("status-olsr/error_olsr")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,14 +108,14 @@ function action_hna()
|
||||||
|
|
||||||
table.sort(data.HNA, compare)
|
table.sort(data.HNA, compare)
|
||||||
|
|
||||||
luci.template.render("freifunk-olsr/hna", {routes=data.HNA})
|
luci.template.render("status-olsr/hna", {routes=data.HNA})
|
||||||
end
|
end
|
||||||
|
|
||||||
function action_mid()
|
function action_mid()
|
||||||
local data = fetch_txtinfo("mid")
|
local data = fetch_txtinfo("mid")
|
||||||
|
|
||||||
if not data or not data.MID then
|
if not data or not data.MID then
|
||||||
luci.template.render("freifunk-olsr/error_olsr")
|
luci.template.render("status-olsr/error_olsr")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -126,7 +125,7 @@ function action_mid()
|
||||||
|
|
||||||
table.sort(data.MID, compare)
|
table.sort(data.MID, compare)
|
||||||
|
|
||||||
luci.template.render("freifunk-olsr/mid", {mids=data.MID})
|
luci.template.render("status-olsr/mid", {mids=data.MID})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,11 @@ function index()
|
||||||
page.order = 20
|
page.order = 20
|
||||||
page.setuser = false
|
page.setuser = false
|
||||||
page.setgroup = false
|
page.setgroup = false
|
||||||
|
|
||||||
local page = node("freifunk", "status", "routes")
|
|
||||||
page.target = template("public_status/routes")
|
|
||||||
page.title = "Routingtabelle"
|
|
||||||
page.order = 10
|
|
||||||
|
|
||||||
local page = node("freifunk", "status", "iwscan")
|
assign({"freifunk", "status", "routes"}, node("admin", "status", "routes"), "Routingtabelle", 10)
|
||||||
page.target = template("public_status/iwscan")
|
assign({"freifunk", "status", "iwscan"}, node("admin", "status", "iwscan"), "WLAN-Scan", 20)
|
||||||
page.title = "WLAN-Scan"
|
|
||||||
page.order = 20
|
assign({"freifunk", "olsr"}, node("admin", "status", "olsr"), "OLSR", 30)
|
||||||
|
|
||||||
local page = node("admin", "index", "freifunk")
|
local page = node("admin", "index", "freifunk")
|
||||||
page.target = cbi("freifunk/freifunk")
|
page.target = cbi("freifunk/freifunk")
|
||||||
|
|
Loading…
Reference in a new issue