luci-app-statistics: clean and fix plugin configurations
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / view / statistics / plugins / network.js
1 'use strict';
2 'require form';
3
4 return L.Class.extend({
5 title: _('Network Plugin Configuration'),
6 description: _('The network plugin provides network based communication between different collectd instances. Collectd can operate both in client and server mode. In client mode locally collected data is transferred to a collectd server instance, in server mode the local instance receives data from other hosts.'),
7
8 addFormOptions: function(s) {
9 var o, ss;
10
11 o = s.option(form.Flag, 'enable', _('Enable this plugin'));
12 o.default = '0';
13
14 o = s.option(form.Value, 'TimeToLive', _('TTL for network packets'));
15 o.placeholder = '1';
16 o.datatype = 'range(1, 255)';
17 o.depends('enable', '1');
18
19 o = s.option(form.Value, 'MaxPacketSize', _('Maximum packet size'), _('Set the maximum size for datagrams sent over the network'));
20 o.placeholder = '1452';
21 o.datatype = 'range(1024, 65535)';
22 o.depends('enable', '1');
23
24 o = s.option(form.Flag, 'Forward', _('Enable forwarding'), _('Forwarding between listen and server addresses'));
25 o.depends('enable', '1');
26
27 o = s.option(form.Flag, 'ReportStats', _('Enable statistics'), _('Create statistics about the network plugin itself'));
28 o.depends('enable', '1');
29
30 o = s.option(form.SectionValue, '__listeners', form.TableSection, 'collectd_network_listen');
31 o.title = _('Listener interfaces');
32 o.description = _('This section defines on which interfaces collectd will wait for incoming connections.');
33 o.depends('enable', '1');
34
35 ss = o.subsection;
36 ss.anonymous = true;
37 ss.addremove = true;
38
39 o = ss.option(form.Value, 'host', _('Listen host'));
40 o.default = '0.0.0.0';
41 o.datatype = 'ipaddr("nomask")';
42
43 o = ss.option(form.Value, 'port', _('Listen port'));
44 o.default = '25826';
45 o.datatype = 'port';
46 //o.optional = true;
47
48 o = s.option(form.SectionValue, '__servers', form.TableSection, 'collectd_network_server');
49 o.title = _('Server interfaces');
50 o.description = _('This section defines to which servers the locally collected data is sent to.');
51 o.depends('enable', '1');
52
53 ss = o.subsection;
54 ss.anonymous = true;
55 ss.addremove = true;
56
57 o = ss.option(form.Value, 'host', _('Server host'));
58 o.default = '0.0.0.0';
59 o.datatype = 'ipaddr("nomask")';
60
61 o = ss.option(form.Value, 'port', _('Server port'));
62 o.default = '25826';
63 o.datatype = 'port';
64 //o.optional = true;
65 },
66
67 configSummary: function(section) {
68 return _('Network communication enabled');
69 }
70 });