<commit_before>-- Copyright 2017 <NAME> <<EMAIL>>
-- Licensed to the public under the GNU General Public License v2.

local net = require "luci.model.network".init()

local s, m, mask, rtmon, rtlookup, logging, loglevel

m = Map("mwan3", translate("MWAN - Globals"))

s = m:section(NamedSection, "globals", "globals", nil)

mask = s:option(
	Value,
	"mmx_mask",
	translate("Firewall mask"),
	translate("Enter value in hex, starting with <code>0x</code>"))
mask.datatype = "hex(4)"
mask.default = "0xff00"

logging = s:option(Flag,
	"logging",
	translate("Logging"),
	translate("Enables global firewall logging"))

loglevel = s:option(
	ListValue,
	"loglevel",
	translate("Loglevel"),
	translate("Firewall loglevel"))
loglevel.default = "notice"
loglevel:value("emerg", translate("Emergency"))
loglevel:value("alert", translate("Alert"))
loglevel:value("crit", translate("Critical"))
loglevel:value("error", translate("Error"))
loglevel:value("warning", translate("Warning"))
loglevel:value("notice", translate("Notice"))
loglevel:value("info", translate("Info"))
loglevel:value("debug", translate("Debug"))
loglevel:depends("logging", "1")

rtmon = s:option(
	Value,
	"rtmon_interval",
	translate("Update interval"),
	translate("How often should rtmon update the interface routing table"))
rtmon.datatype = "integer"
rtmon.default = "5"
rtmon:value("1", translatef("%d second", 1))
rtmon:value("3", translatef("%d seconds", 3))
rtmon:value("5", translatef("%d seconds", 5))
rtmon:value("7", translatef("%d seconds", 7))
rtmon:value("10", translatef("%d seconds", 10))

rtlookup = s:option(DynamicList,
	"rt_table_lookup",
	translate("Routing table lookup"),
	translate("Also scan this Routing table for connected networks"))
rtlookup.datatype = "integer"
rtlookup:value("1", translatef("Routing table %d", 1))
rtlookup:value("2", translatef("Routing table %d", 2))
rtlookup:value("220", translatef("Routing table %d", 220))

return m<commit_msg>luci-app-mwan3: unify map, section and option variable handling in globalsconfig<commit_after>-- Copyright 2017 <NAME> <<EMAIL>>
-- Licensed to the public under the GNU General Public License v2.

local net = require "luci.model.network".init()

local s, m, o

m = Map("mwan3", translate("MWAN - Globals"))

s = m:section(NamedSection, "globals", "globals", nil)

o = s:option(Value, "mmx_mask",
	translate("Firewall mask"),
	translate("Enter value in hex, starting with <code>0x</code>"))
o.datatype = "hex(4)"
o.default = "0xff00"

o = s:option(Flag, "logging",
	translate("Logging"),
	translate("Enables global firewall logging"))

o = s:option(ListValue, "loglevel",
	translate("Loglevel"),
	translate("Firewall loglevel"))
o.default = "notice"
o:value("emerg", translate("Emergency"))
o:value("alert", translate("Alert"))
o:value("crit", translate("Critical"))
o:value("error", translate("Error"))
o:value("warning", translate("Warning"))
o:value("notice", translate("Notice"))
o:value("info", translate("Info"))
o:value("debug", translate("Debug"))
o:depends("logging", "1")

o = s:option(Value, "rtmon_interval",
	translate("Update interval"),
	translate("How often should rtmon update the interface routing table"))
o.datatype = "integer"
o.default = "5"
o:value("1", translatef("%d second", 1))
o:value("3", translatef("%d seconds", 3))
o:value("5", translatef("%d seconds", 5))
o:value("7", translatef("%d seconds", 7))
o:value("10", translatef("%d seconds", 10))

o = s:option(DynamicList, "rt_table_lookup",
	translate("Routing table lookup"),
	translate("Also scan this Routing table for connected networks"))
o.datatype = "integer"
o:value("1", translatef("Routing table %d", 1))
o:value("2", translatef("Routing table %d", 2))
o:value("220", translatef("Routing table %d", 220))

return m
{'fraction_non_alphanumeric': 0.18729989327641408, 'fraction_numerical': 0.018943436499466382, 'mean_word_length': 7.578947368421052, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4230500', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1212, 'n_words': 323}