luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js
Hannu Nyman f7e5b56649 luci-app-statistics: Adjust UI defaults to match config file
Adjust the defaults shown in the LuCI user interface to match
the real default values in the default config file.

(If a plugin is disabled and config values get deleted from
the config file, user has been offered incorrect default
values from UI defaults when the plugin is later re-enabled.)

* dns: set br-lan as the interface
* email: socket in /var/run/collectd/ dir
* interface: set br-lan as the interface
* ping: TTL 127, interval 30
* rrdtool: 1hour as shortest period, 144 RRArows
* tcpconns: Do not monitor all, only 22 80
* unixsock: socket in /var/run/collectd/ dir

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-12-13 11:23:09 +02:00

36 lines
1.1 KiB
JavaScript

'use strict';
'require baseclass';
'require form';
'require tools.widgets as widgets';
return baseclass.extend({
title: _('Interface Plugin Configuration'),
description: _('The interface plugin collects traffic statistics on selected interfaces.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'));
o.multiple = true;
o.noaliases = true;
o.default = 'br-lan';
o.depends('enable', '1');
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.depends('enable', '1');
},
configSummary: function(section) {
var ifaces = L.toArray(section.Interfaces),
invert = section.IgnoreSelected == '1';
if (ifaces.length == 0)
return _('Monitoring all interfaces');
else if (invert)
return N_(ifaces.length, 'Monitoring all but one interface', 'Monitoring all but %d interfaces').format(ifaces.length);
else
return N_(ifaces.length, 'Monitoring one interface', 'Monitoring %d interfaces').format(ifaces.length);
}
});