rp-pppoe-relay.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. 'use strict';
  2. 'require form';
  3. 'require network';
  4. 'require tools.widgets as widgets';
  5. 'require view';
  6. return view.extend({
  7. load: function() {
  8. return Promise.all([
  9. network.getNetworks(),
  10. ]);
  11. },
  12. render: function (loaded_promises) {
  13. var m, s, o;
  14. const networks = loaded_promises[0];
  15. m = new form.Map('pppoe', _('Roaring Penguin PPPoE Relay'),
  16. _('PPPoE Relay Configuration'));
  17. s = m.section(form.TypedSection, 'pppoe_relay', _('Relay Configuration'));
  18. s.anonymous = true;
  19. s.addremove = true;
  20. o = s.option(form.Flag, 'enabled', _('Enabled'));
  21. o = s.option(widgets.DeviceSelect, 'server_interface', _('Server Interface'), _('Interface on which to listen. Only PPPoE servers may be connected to this interface.'));
  22. o.multiple = true;
  23. o.optional = true;
  24. o.nocreate = true;
  25. o.rmempty = true;
  26. o.depends({ enabled: '1' });
  27. o = s.option(widgets.DeviceSelect, 'client_interface', _('Client Interface'), _('Interface from which to relay. Only PPPoE clients may be connected to this interface.'));
  28. o.multiple = true;
  29. o.optional = true;
  30. o.nocreate = true;
  31. o.rmempty = true;
  32. o.depends({ enabled: '1' });
  33. o = s.option(widgets.DeviceSelect, 'both_interface', _('Both Interface'), _('Interface upon which to listen and to relay. Both PPPoE clients and servers may be connected to this interface.'));
  34. o.multiple = true;
  35. o.optional = true;
  36. o.nocreate = true;
  37. o.rmempty = true;
  38. o.depends({ enabled: '1' });
  39. o = s.option(form.Flag, 'use_non_uci_config', _('Use Non-UCI Config'), '<code>/etc/default/pppoe-relay</code>');
  40. o.optional = true;
  41. o.rmempty = true;
  42. o.depends({ enabled: '1' });
  43. o = s.option(form.Value, 'maxsessions', _('Maximum Sessions'));
  44. o.datatype = 'range(1,65534)';
  45. o.placeholder = 5000;
  46. o.value('', _('Default: 5000'));
  47. o.optional = true;
  48. o.rmempty = true;
  49. o.depends({ enabled: '1' });
  50. o = s.option(form.Value, 'timeout', _('Timeout'));
  51. o.optional = true;
  52. o.datatype = 'uinteger';
  53. o.placeholder = 600;
  54. o.value('0', _('No timeout'));
  55. o.value('', _('Default: 600'));
  56. o.rmempty = true;
  57. o.depends({ enabled: '1' });
  58. return m.render();
  59. }
  60. });