luci-app-mwan3: refactoring warning compilation on the policy config pages
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / member.lua
1 -- ------ member configuration ------ --
2
3 ds = require "luci.dispatcher"
4
5
6 m5 = Map("mwan3", translate("MWAN - Members"))
7
8 mwan_member = m5:section(TypedSection, "member", nil,
9         translate("Members are profiles attaching a metric and weight to an MWAN interface<br />" ..
10         "Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
11         "Members may not share the same name as configured interfaces, policies or rules"))
12         mwan_member.addremove = true
13         mwan_member.dynamic = false
14         mwan_member.sectionhead = translate("Member")
15         mwan_member.sortable = true
16         mwan_member.template = "cbi/tblsection"
17         mwan_member.extedit = ds.build_url("admin", "network", "mwan", "member", "%s")
18         function mwan_member.create(self, section)
19                 TypedSection.create(self, section)
20                 m5.uci:save("mwan3")
21                 luci.http.redirect(ds.build_url("admin", "network", "mwan", "member", section))
22         end
23
24
25 interface = mwan_member:option(DummyValue, "interface", translate("Interface"))
26         interface.rawhtml = true
27         function interface.cfgvalue(self, s)
28                 return self.map:get(s, "interface") or "&#8212;"
29         end
30
31 metric = mwan_member:option(DummyValue, "metric", translate("Metric"))
32         metric.rawhtml = true
33         function metric.cfgvalue(self, s)
34                 return self.map:get(s, "metric") or "1"
35         end
36
37 weight = mwan_member:option(DummyValue, "weight", translate("Weight"))
38         weight.rawhtml = true
39         function weight.cfgvalue(self, s)
40                 return self.map:get(s, "weight") or "1"
41         end
42
43
44 return m5