X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-mwan3%2Fluasrc%2Fmodel%2Fcbi%2Fmwan%2Fpolicyconfig.lua;h=f29a06093a27b4dd8ed3084e44a9c9ca6fe61c4a;hp=feb62dc8a307f7d4f8bf5daa905d8f1228b7c4f8;hb=b4350f21ff2f31b7dbcdbc5f034659ba580c059f;hpb=b2274e5d6d27cdd0819d9e35058ebcd2cb8b55f5 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 feb62dc8a..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 "" .. translatef("WARNING: This policy's name is %d characters exceeding the maximum of 15!", policyNameLength) .. "" - 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", "configuration", "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")) @@ -52,14 +22,4 @@ last_resort = mwan_policy:option(ListValue, "last_resort", translate("Last resor last_resort:value("blackhole", translate("blackhole (drop)")) last_resort:value("default", translate("default (use main routing table)")) - --- ------ currently configured members ------ -- - -mwan_member = m5:section(TypedSection, "member", translate("Currently Configured Members")) - mwan_member.addremove = false - mwan_member.dynamic = false - mwan_member.sortable = false - mwan_member.template = "cbi/tblsection" - - return m5