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