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

42 lines
1.1 KiB
JavaScript

'use strict';
'require form';
return L.Class.extend({
title: _('Ping Plugin Configuration'),
description: _('The ping plugin will send icmp echo replies to selected hosts and measure the roundtrip time for each host.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.DynamicList, 'Hosts', _('Monitor hosts'));
o.default = '127.0.0.1';
o.datatype = 'ipaddr("nomask")';
o.depends('enable', '1');
o = s.option(form.ListValue, 'AddressFamily', _('Address family'));
o.default = 'any';
o.depends('enable', '1');
o.value('any');
o.value('ipv4');
o.value('ipv6');
o = s.option(form.Value, 'TTL', _('TTL for ping packets'));
o.default = '128';
o.datatype = 'range(0, 255)';
o.depends('enable', '1');
o = s.option(form.Value, 'Interval', _('Interval for pings'), _('Seconds'));
o.default = '1.0';
o.datatype = 'ufloat';
o.depends('enable', '1');
},
configSummary: function(section) {
var hosts = L.toArray(section.Hosts);
if (hosts.length)
return N_(hosts.length, 'Monitoring one host', 'Monitoring %d hosts').format(hosts.length);
}
});