summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-mwan3/luasrc/model/cbi/mwan/member.lua
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-mwan3/luasrc/model/cbi/mwan/member.lua')
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/member.lua46
1 files changed, 46 insertions, 0 deletions
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/member.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/member.lua
new file mode 100644
index 0000000000..3bccbd942f
--- /dev/null
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/member.lua
@@ -0,0 +1,46 @@
+-- ------ member configuration ------ --
+
+ds = require "luci.dispatcher"
+
+
+m5 = Map("mwan3", translate("MWAN Member Configuration"))
+ m5:append(Template("mwan/config_css"))
+
+
+mwan_member = m5:section(TypedSection, "member", translate("Members"),
+ translate("Members are profiles attaching a metric and weight to an MWAN interface<br />" ..
+ "Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
+ "Members may not share the same name as configured interfaces, policies or rules"))
+ mwan_member.addremove = true
+ mwan_member.dynamic = false
+ mwan_member.sectionhead = "Member"
+ mwan_member.sortable = true
+ mwan_member.template = "cbi/tblsection"
+ mwan_member.extedit = ds.build_url("admin", "network", "mwan", "configuration", "member", "%s")
+ function mwan_member.create(self, section)
+ TypedSection.create(self, section)
+ m5.uci:save("mwan3")
+ luci.http.redirect(ds.build_url("admin", "network", "mwan", "configuration", "member", section))
+ end
+
+
+interface = mwan_member:option(DummyValue, "interface", translate("Interface"))
+ interface.rawhtml = true
+ function interface.cfgvalue(self, s)
+ return self.map:get(s, "interface") or "&#8212;"
+ end
+
+metric = mwan_member:option(DummyValue, "metric", translate("Metric"))
+ metric.rawhtml = true
+ function metric.cfgvalue(self, s)
+ return self.map:get(s, "metric") or "1"
+ end
+
+weight = mwan_member:option(DummyValue, "weight", translate("Weight"))
+ weight.rawhtml = true
+ function weight.cfgvalue(self, s)
+ return self.map:get(s, "weight") or "1"
+ end
+
+
+return m5