treewide: import utility classes explicitly
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / view / statistics / plugins / iwinfo.js
1 'use strict';
2 'require baseclass';
3 'require form';
4 'require tools.widgets as widgets';
5
6 return baseclass.extend({
7 title: _('Wireless iwinfo Plugin Configuration'),
8 description: _('The iwinfo plugin collects statistics about wireless signal strength, noise and quality.'),
9
10 addFormOptions: function(s) {
11 var o;
12
13 o = s.option(form.Flag, 'enable', _('Enable this plugin'));
14
15 o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'), _('Leave unselected to automatically determine interfaces to monitor.'));
16 o.multiple = true;
17 o.noaliases = true;
18 o.noinactive = true;
19 o.depends('enable', '1');
20 o.filter = function(section_id, name) {
21 var dev = this.devices.filter(function(dev) { return dev.getName() == name })[0];
22 return (dev && dev.getType() == 'wifi');
23 };
24
25 o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
26 o.depends('enable', '1');
27 },
28
29 configSummary: function(section) {
30 var ifaces = L.toArray(section.Interfaces),
31 invert = section.IgnoreSelected == '1';
32
33 if (ifaces.length == 0)
34 return _('Monitoring all interfaces');
35 else if (invert)
36 return N_(ifaces.length, 'Monitoring all but one interface', 'Monitoring all but %d interfaces').format(ifaces.length);
37 else
38 return N_(ifaces.length, 'Monitoring one interface', 'Monitoring %d interfaces').format(ifaces.length);
39 }
40 });