luci-app-statistics: treat APC UPS "host" setting as single value option
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / view / statistics / plugins / interface.js
1 'use strict';
2 'require baseclass';
3 'require form';
4 'require tools.widgets as widgets';
5
6 return baseclass.extend({
7 title: _('Interface Plugin Configuration'),
8 description: _('The interface plugin collects traffic statistics on selected interfaces.'),
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'));
16 o.multiple = true;
17 o.noaliases = true;
18 o.default = 'br-lan';
19 o.depends('enable', '1');
20
21 o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
22 o.depends('enable', '1');
23 },
24
25 configSummary: function(section) {
26 var ifaces = L.toArray(section.Interfaces),
27 invert = section.IgnoreSelected == '1';
28
29 if (ifaces.length == 0)
30 return _('Monitoring all interfaces');
31 else if (invert)
32 return N_(ifaces.length, 'Monitoring all but one interface', 'Monitoring all but %d interfaces').format(ifaces.length);
33 else
34 return N_(ifaces.length, 'Monitoring one interface', 'Monitoring %d interfaces').format(ifaces.length);
35 }
36 });