From e72a526984982f6fa2b6f2ed5ce01523094bfe43 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 7 Aug 2008 19:03:25 +0000 Subject: libs/cbi: Added magic ;-) --- modules/admin-full/luasrc/controller/admin/network.lua | 14 +++++++++++++- .../admin-full/luasrc/model/cbi/admin_network/ifaces.lua | 10 ++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'modules/admin-full/luasrc') diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 871263334a..3fb45f804d 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -15,6 +15,7 @@ module("luci.controller.admin.network", package.seeall) function index() require("luci.i18n") + require("luci.model.uci") local i18n = luci.i18n.translate local page = node("admin", "network") @@ -31,7 +32,18 @@ function index() page.target = cbi("admin_network/ifaces") page.title = i18n("interfaces", "Schnittstellen") page.order = 20 - + page.leaf = true + + luci.model.uci.foreach("network", "interface", + function (section) + local ifc = section[".name"] + if ifc ~= "loopback" then + entry({"admin", "network", "ifaces", ifc}, page.target, ifc) + end + end + ) + + local page = node("admin", "network", "dhcp") page.target = cbi("admin_network/dhcp") page.title = "DHCP" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua index 014de7ddf7..bea425d723 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua @@ -14,8 +14,14 @@ $Id$ m = Map("network", translate("interfaces"), translate("a_n_ifaces1")) s = m:section(TypedSection, "interface", "") -s.addremove = true -s:exclude("loopback") +function s.filter(section) + return section ~= "loopback" and (not arg or #arg == 0 or + luci.util.contains(arg, section)) +end + +if not arg or #arg == 0 then + s.addremove = true +end s:depends("proto", "static") s:depends("proto", "dhcp") -- cgit v1.2.3