treewide: import utility classes explicitly
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / view / statistics / plugins / netlink.js
1 'use strict';
2 'require baseclass';
3 'require form';
4 'require tools.widgets as widgets';
5
6 return baseclass.extend({
7 title: _('Netlink Plugin Configuration'),
8 description: _('The netlink plugin collects extended information like qdisc-, class- and filter-statistics for selected interfaces.'),
9
10 addFormOptions: function(s) {
11 var o;
12
13 o = s.option(form.Flag, 'enable', _('Enable this plugin'));
14 o.default = '0';
15
16 o = s.option(widgets.DeviceSelect, 'Interfaces', _('Basic monitoring'));
17 o.multiple = true;
18 o.noaliases = true;
19 o.depends('enable', '1');
20
21 o = s.option(widgets.DeviceSelect, 'VerboseInterfaces', _('Verbose monitoring'));
22 o.multiple = true;
23 o.noaliases = true;
24 o.depends('enable', '1');
25
26 o = s.option(widgets.DeviceSelect, 'QDiscs', _('Qdisc monitoring'));
27 o.multiple = true;
28 o.noaliases = true;
29 o.depends('enable', '1');
30
31 o = s.option(widgets.DeviceSelect, 'Classes', _('Shaping class monitoring'));
32 o.multiple = true;
33 o.noaliases = true;
34 o.depends('enable', '1');
35
36 o = s.option(widgets.DeviceSelect, 'Filters', _('Filter class monitoring'));
37 o.multiple = true;
38 o.noaliases = true;
39 o.depends('enable', '1');
40
41 o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
42 o.depends('enable', '1');
43 },
44
45 configSummary: function(section) {
46 var basic = L.toArray(section.Interfaces),
47 verbose = L.toArray(section.VerboseInterfaces),
48 count = basic.length + verbose.length,
49 invert = section.IgnoreSelected == '1';
50
51 if (invert && count == 0)
52 return _('Monitoring all interfaces');
53 else if (invert)
54 return N_(count, 'Monitoring all but one interface', 'Monitoring all but %d interfaces').format(count);
55 else if (count)
56 return N_(count, 'Monitoring one interface', 'Monitoring %d interfaces').format(count);
57 }
58 });