luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.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

43 lines
1.3 KiB
JavaScript

'use strict';
'require baseclass';
'require form';
return baseclass.extend({
title: _('TCPConns Plugin Configuration'),
description: _('The tcpconns plugin collects information about open tcp connections on selected ports.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.Flag, 'ListeningPorts', _('Monitor all local listen ports'));
o.depends('enable', '1');
o.rmempty = false;
o.default = '0';
o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports'));
o.optional = true;
o.datatype = 'port';
o.default = '22 80';
o.depends({ enable: '1', ListeningPorts: '0' });
o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports'));
o.optional = true;
o.datatype = 'port';
o.depends({ enable: '1', ListeningPorts: '0' });
},
configSummary: function(section) {
var lports = L.toArray(section.LocalPorts),
rports = L.toArray(section.RemotePorts);
if (section.ListeningPorts == '1')
return _('Monitoring local listen ports');
else
return _('Monitoring %s and %s').format(
N_(lports.length, 'one local port', '%d local ports').format(lports.length),
N_(rports.length, 'one remote port', '%d remote ports').format(rports.length)
);
}
});