treewide: import utility classes explicitly
[oweals/luci.git] / applications / luci-app-ttyd / htdocs / luci-static / resources / view / ttyd / config.js
1 'use strict';
2 'require view';
3 'require form';
4 'require tools.widgets as widgets';
5
6 return view.extend({
7         render: function() {
8                 var m, s, o;
9
10                 m = new form.Map('ttyd');
11
12                 s = m.section(form.TypedSection, 'ttyd', _('ttyd Instance'));
13                 s.anonymous   = true;
14                 s.addremove   = true;
15                 s.addbtntitle = _('Add instance');
16
17                 o = s.option(form.Flag, 'enable', _('Enable'));
18                 o.default = true;
19
20                 o = s.option(form.Value, 'port', _('Port'), _('Port to listen (default: 7681, use `0` for random port)'));
21                 o.datatype    = 'port';
22                 o.placeholder = 7681;
23
24                 o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)'));
25                 o.nocreate    = true;
26                 o.unspecified = true;
27
28                 o = s.option(form.Value, 'credential', _('Credential'), _('Credential for Basic Authentication'));
29                 o.placeholder = 'username:password';
30
31                 o = s.option(form.Value, 'uid', _('User ID'), _('User id to run with'));
32                 o.datatype = 'uinteger';
33
34                 o = s.option(form.Value, 'gid', _('Group ID'), _('Group id to run with'));
35                 o.datatype = 'uinteger';
36
37                 o = s.option(form.Value, 'signal', _('Signal'), _('Signal to send to the command when exit it (default: 1, SIGHUP)'));
38                 o.datatype = 'uinteger';
39
40                 s.option(form.Flag, 'url_arg', _('Allow URL args'), _('Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)'));
41
42                 s.option(form.Flag, 'readonly', _('Read-only'), _('Do not allow clients to write to the TTY'));
43
44                 o = s.option(form.DynamicList, 'client_option', _('Client option'), _('Send option to client'));
45                 o.placeholder = 'key=value';
46
47                 o = s.option(form.Value, 'terminal_type', _('Terminal type'), _('Terminal type to report (default: xterm-256color)'));
48                 o.placeholder = 'xterm-256color';
49
50                 s.option(form.Flag, 'check_origin', _('Check origin'), _('Do not allow websocket connection from different origin'));
51
52                 o = s.option(form.Value, 'max_clients', _('Max clients'), _('Maximum clients to support (default: 0, no limit)'));
53                 o.datatype = 'uinteger';
54                 o.placeholder = '0';
55
56                 s.option(form.Flag, 'once', _('Once'), _('Accept only one client and exit on disconnection'));
57
58                 o = s.option(form.Value, 'index', _('Index'), _('Custom index.html path'));
59
60                 s.option(form.Flag, 'ipv6', _('IPv6'), _('Enable IPv6 support'));
61
62                 s.option(form.Flag, 'ssl', _('SSL'), _('Enable SSL'));
63
64                 o = s.option(form.Value, 'ssl_cert', _('SSL cert'), _('SSL certificate file path'));
65                 o.depends('ssl', '1');
66
67                 o = s.option(form.Value, 'ssl_key', _('SSL key'), _('SSL key file path'));
68                 o.depends('ssl', '1');
69
70                 o = s.option(form.Value, 'ssl_ca', _('SSL ca'), _('SSL CA file path for client certificate verification'));
71                 o.depends('ssl', '1');
72
73                 o = s.option(form.Value, 'debug', _('Debug'), _('Set log level (default: 7)'));
74                 o.placeholder = '7';
75
76                 s.option(form.Value, 'command', _('Command'));
77
78                 return m.render();
79         }
80 });