summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua')
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua46
1 files changed, 8 insertions, 38 deletions
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua
index b9ff321a1..f29a06093 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua
@@ -1,49 +1,19 @@
--- ------ extra functions ------ --
-
-function policyCheck() -- check to see if this policy's name exceed the maximum of 15 characters
- policyNameLength = string.len(arg[1])
- if policyNameLength > 15 then
- nameTooLong = 1
- end
-end
-
-function policyWarn() -- display status and warning messages at the top of the page
- if nameTooLong == 1 then
- return "<font color=\"ff0000\"><strong>" .. translatef("WARNING: This policy's name is %d characters exceeding the maximum of 15!", policyNameLength) .. "</strong></font>"
- else
- return ""
- end
-end
-
-function cbiAddMember(field)
- uci.cursor():foreach("mwan3", "member",
- function (section)
- field:value(section[".name"])
- end
- )
-end
-
--- ------ policy configuration ------ --
-
dsp = require "luci.dispatcher"
arg[1] = arg[1] or ""
-nameTooLong = 0
-policyCheck()
-
-
-m5 = Map("mwan3", translatef("MWAN Policy Configuration - %s", arg[1]),
- policyWarn())
- m5.redirect = dsp.build_url("admin", "network", "mwan", "policy")
-
+m5 = Map("mwan3", translatef("MWAN Policy Configuration - %s", arg[1]))
+m5.redirect = dsp.build_url("admin", "network", "mwan", "policy")
mwan_policy = m5:section(NamedSection, arg[1], "policy", "")
mwan_policy.addremove = false
mwan_policy.dynamic = false
-
-use_member = mwan_policy:option(DynamicList, "use_member", translate("Member used"))
- cbiAddMember(use_member)
+member = mwan_policy:option(DynamicList, "use_member", translate("Member used"))
+m5.uci:foreach("mwan3", "member",
+ function(s)
+ member:value(s['.name'], s['.name'])
+ end
+)
last_resort = mwan_policy:option(ListValue, "last_resort", translate("Last resort"),
translate("When all policy members are offline use this behavior for matched traffic"))