178b510a2be09f2f205ccb82b661afebce9a276d
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / view / statistics / plugins / interface.js
1 'use strict';
2 'require form';
3 'require tools.widgets as widgets';
4
5 return L.Class.extend({
6 title: _('Interface Plugin Configuration'),
7 description: _('The interface plugin collects traffic statistics on selected interfaces.'),
8
9 addFormOptions: function(s) {
10 var o;
11
12 o = s.option(form.Flag, 'enable', _('Enable this plugin'));
13 o.default = '0';
14
15 o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'));
16 o.multiple = true;
17 o.noaliases = true;
18 o.depends('enable', '1');
19
20 o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
21 o.default = '0';
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 });