luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js
Jo-Philipp Wich d4a475163e luci-app-statistics: clean and fix plugin configurations
- Remove redundant form flags
 - Fix various default values
 - Add some new collect options and remove options that do not exist anymore

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-22 23:26:49 +01:00

41 lines
1.2 KiB
JavaScript

'use strict';
'require form';
return L.Class.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 = '1';
o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports'));
o.optional = true;
o.datatype = 'port';
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)
);
}
});