nut_cgi.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. 'use strict';
  2. 'require form';
  3. 'require view';
  4. return view.extend({
  5. load: function() {
  6. },
  7. render: function() {
  8. var m, s, o;
  9. m = new form.Map('nut_cgi', _('NUT CGI'),
  10. _('Network UPS Tools CGI Configuration') + '<br />' +
  11. '%s'.format('<a href="/nut">%s</a>'.format(_('Go to NUT CGI'))));
  12. s = m.section(form.TypedSection, 'host', _('Host'));
  13. s.addremove = true;
  14. s.anonymous = true;
  15. o = s.option(form.Value, 'upsname', _('UPS name'), _('As configured by NUT'));
  16. o.optional = false;
  17. o = s.option(form.Value, 'hostname', _('Hostname or IP address'));
  18. o.optional = false;
  19. o.datatype = 'or(host,ipaddr)';
  20. o = s.option(form.Value, 'port', _('Port'));
  21. o.datatype = 'port';
  22. o.optional = true;
  23. o.placeholder = 3493;
  24. o = s.option(form.Value, 'displayname', _('Display name'));
  25. o.optional = false;
  26. s = m.section(form.TypedSection, 'upsset', _('Control UPS via CGI'));
  27. s.addremove = false;
  28. s.anonymous = true;
  29. s.optional = false;
  30. o = s.option(form.Flag, 'enable', _('Enable'));
  31. o.optional = false;
  32. o.default = false;
  33. return m.render();
  34. }
  35. });