From f94fb5ac1843ae47a28cfa1ef2ea4cbdd6b239f2 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 15 Aug 2008 22:22:54 +0000 Subject: [PATCH] Some cleanups --- libs/cbi/luasrc/cbi.lua | 2 ++ .../model/cbi/admin_network/dhcpleases.lua | 3 --- .../luasrc/model/cbi/admin_network/routes.lua | 18 ++---------------- .../luasrc/model/cbi/admin_system/fstab.lua | 19 +------------------ 4 files changed, 5 insertions(+), 37 deletions(-) diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index ab342feec1..7e2f53c80c 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -492,6 +492,8 @@ function Table.__init__(self, form, data, ...) AbstractSection.__init__(self, datasource, "table", ...) self.template = "cbi/tblsection" + self.rowcolors = true + self.anonymous = true end function Table.cfgsections(self) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua index 25187ae90f..3c89de31da 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua @@ -31,9 +31,6 @@ end if leases then v = m2:section(Table, leases, translate("dhcp_leases_active")) - v.anonymous = true - v.rowcolors = true - ip = v:option(DummyValue, 3, translate("ipaddress")) mac = v:option(DummyValue, 2, translate("macaddress")) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua b/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua index ec659a521f..a6f47ced11 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua @@ -17,18 +17,7 @@ m = Map("network", translate("a_n_routes"), translate("a_n_routes1")) if not arg or not arg[1] then local routes = luci.sys.net.routes() - v = m:section(TypedSection, "_virtual", translate("a_n_routes_kernel4")) - v.anonymous = true - v.rowcolors = true - v.template = "cbi/tblsection" - - function v.cfgsections(self) - local sections = {} - for i=1,#routes do - table.insert(sections, i) - end - return sections - end + v = m:section(Table, routes, translate("a_n_routes_kernel4")) net = v:option(DummyValue, "iface", translate("network")) function net.cfgvalue(self, section) @@ -51,10 +40,7 @@ if not arg or not arg[1] then return luci.ip.Hex(routes[section].Gateway, 32):string() end - metric = v:option(DummyValue, "metric", translate("metric")) - function metric.cfgvalue(self, section) - return routes[section].Metric - end + metric = v:option(DummyValue, "Metric", translate("metric")) end diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/fstab.lua b/modules/admin-full/luasrc/model/cbi/admin_system/fstab.lua index 7aaaac832b..2c21288597 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_system/fstab.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_system/fstab.lua @@ -16,28 +16,11 @@ m = Map("fstab", translate("a_s_fstab")) local mounts = luci.sys.mounts() -v = m:section(TypedSection, "_virtual", translate("a_s_fstab_active")) -v.anonymous = true -v.rowcolors = true -v.template = "cbi/tblsection" - -function v.cfgsections(self) - local sections = {} - for i=1,#mounts do - table.insert(sections, i) - end - return sections -end +v = m:section(Table, mounts, translate("a_s_fstab_active")) fs = v:option(DummyValue, "fs", translate("filesystem")) -function fs.cfgvalue(self, section) - return mounts[section].fs -end mp = v:option(DummyValue, "mountpoint", translate("a_s_fstab_mountpoint")) -function mp.cfgvalue(self, section) - return mounts[section].mountpoint -end avail = v:option(DummyValue, "avail", translate("a_s_fstab_avail")) function avail.cfgvalue(self, section) -- 2.30.2