mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 19:01:56 +00:00
luci-app-firewall: fix zone log option
Changes the zone log checkbox to a multivalue selection as the underlying uci option is a bitfield. Signed-off-by: Jan Froch <jan@froch.eu>
This commit is contained in:
@@ -293,11 +293,23 @@ return view.extend({
|
||||
for (var i = 0; i < ctHelpers.length; i++)
|
||||
o.value(ctHelpers[i].name, E('<span><span class="hide-close">%s (%s)</span><span class="hide-open">%s</span></span>'.format(ctHelpers[i].description, ctHelpers[i].name.toUpperCase(), ctHelpers[i].name.toUpperCase())));
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'log', _('Enable logging on this zone'));
|
||||
o = s.taboption('advanced', form.MultiValue, 'log', _('Enable logging'), _('Log matched packets on the selected tables to syslog.'));
|
||||
o.modalonly = true;
|
||||
o.value('filter');
|
||||
o.value('mangle');
|
||||
o.placeholder = 'No table selected';
|
||||
const TABLES = { filter: 1, mangle: 2 };
|
||||
o.cfgvalue = function (section_id) {
|
||||
let bitfield = this.super('load', [section_id]) || this.default;
|
||||
return Object.keys(TABLES).filter(table => bitfield & TABLES[table]);
|
||||
};
|
||||
o.write = function (section_id, value) {
|
||||
let bitfield = L.toArray(value).reduce((acc, table) => acc | (TABLES[table] || 0), 0);
|
||||
return this.super('write', [section_id, bitfield]);
|
||||
};
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'log_limit', _('Limit log messages'));
|
||||
o.depends('log', '1');
|
||||
o.depends({log: [], "!reverse": true});
|
||||
o.placeholder = '10/minute';
|
||||
o.modalonly = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user