summaryrefslogtreecommitdiffstats
path: root/applications/luci-app-nut/htdocs/luci-static/resources/view/nut/nut_cgi.js
blob: 1a16e3829d4db902eca5115c177e5ace9b691ecf (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
37
38
39
40
41
42
43
44
45
46
47
'use strict';
'require form';
'require view';

return view.extend({
	load: function() {

	},

	render: function() {
		let m, s, o;

		m = new form.Map('nut_cgi', _('NUT CGI'),
			_('Network UPS Tools CGI Configuration') + '<br />' +
			'%s'.format('<a href="/nut">%s</a>'.format(_('Go to NUT CGI'))));

		s = m.section(form.TypedSection, 'host', _('Host'));
		s.addremove = true;
		s.anonymous = true;

		o = s.option(form.Value, 'upsname', _('UPS name'), _('As configured by NUT'));
		o.optional = false;

		o = s.option(form.Value, 'hostname', _('Hostname or IP address'));
		o.optional = false;
		o.datatype = 'or(host,ipaddr)';

		o = s.option(form.Value, 'port', _('Port'));
		o.datatype = 'port';
		o.optional = true;
		o.placeholder = 3493;

		o = s.option(form.Value, 'displayname', _('Display name'));
		o.optional = false;

		s = m.section(form.TypedSection, 'upsset', _('Control UPS via CGI'));
		s.addremove = false;
		s.anonymous = true;
		s.optional = false;

		o = s.option(form.Flag, 'enable', _('Enable'));
		o.optional = false;
		o.default = false;

		return m.render();
	}
});