summaryrefslogtreecommitdiffstats
path: root/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js
blob: 38dab725e322f2b8978b8294998c30f39f00e42b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
'require baseclass';
'require form';
'require tools.widgets as widgets';

return baseclass.extend({
	title: _('Interface Plugin Configuration'),
	description: _('The interface plugin collects traffic statistics on selected interfaces.'),

	addFormOptions(s) {
		let o;

		o = s.option(form.Flag, 'enable', _('Enable this plugin'));

		o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'));
		o.multiple = true;
		o.noaliases = true;
		o.default = 'br-lan';
		o.depends('enable', '1');

		o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
		o.depends('enable', '1');
	},

	configSummary(section) {
		const ifaces = L.toArray(section.Interfaces);
		const invert = section.IgnoreSelected == '1';

		if (ifaces.length == 0)
			return _('Monitoring all interfaces');
		else if (invert)
			return N_(ifaces.length, 'Monitoring all but one interface', 'Monitoring all but %d interfaces').format(ifaces.length);
		else
			return N_(ifaces.length, 'Monitoring one interface', 'Monitoring %d interfaces').format(ifaces.length);
	}
});