diff options
author | Paul Donald <newtwen+github@gmail.com> | 2024-10-07 22:18:04 +0200 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-10-07 22:30:23 +0200 |
commit | 3aa60877ea4bc47b86c3ee11448db7503a20ae01 (patch) | |
tree | fb55393ce71aedee0ca458e05574936b9ff7eba0 /applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe | |
parent | 25a4d075558af1effcb1539e6d6920a6ff198821 (diff) |
luci-app-rp-pppoe-server: convert to JS
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe')
2 files changed, 201 insertions, 0 deletions
diff --git a/applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe/rp-pppoe-relay.js b/applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe/rp-pppoe-relay.js new file mode 100644 index 0000000000..981a6822d9 --- /dev/null +++ b/applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe/rp-pppoe-relay.js @@ -0,0 +1,72 @@ +'use strict'; +'require form'; +'require network'; +'require tools.widgets as widgets'; +'require view'; + +return view.extend({ + load: function() { + return Promise.all([ + network.getNetworks(), + ]); + }, + + render: function (loaded_promises) { + var m, s, o; + const networks = loaded_promises[0]; + + m = new form.Map('pppoe', _('Roaring Penguin PPPoE Relay'), + _('PPPoE Relay Configuration')); + + s = m.section(form.TypedSection, 'pppoe_relay', _('Relay Configuration')); + s.anonymous = true; + s.addremove = true; + + o = s.option(form.Flag, 'enabled', _('Enabled')); + + o = s.option(widgets.DeviceSelect, 'server_interface', _('Server Interface'), _('Interface on which to listen. Only PPPoE servers may be connected to this interface.')); + o.multiple = true; + o.optional = true; + o.nocreate = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(widgets.DeviceSelect, 'client_interface', _('Client Interface'), _('Interface from which to relay. Only PPPoE clients may be connected to this interface.')); + o.multiple = true; + o.optional = true; + o.nocreate = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + 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.')); + o.multiple = true; + o.optional = true; + o.nocreate = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Flag, 'use_non_uci_config', _('Use Non-UCI Config'), '<code>/etc/default/pppoe-relay</code>'); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'maxsessions', _('Maximum Sessions')); + o.datatype = 'range(1,65534)'; + o.placeholder = 5000; + o.value('', _('Default: 5000')); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'timeout', _('Timeout')); + o.optional = true; + o.datatype = 'uinteger'; + o.placeholder = 600; + o.value('0', _('No timeout')); + o.value('', _('Default: 600')); + o.rmempty = true; + o.depends({ enabled: '1' }); + + return m.render(); + } +}); diff --git a/applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe/rp-pppoe-server.js b/applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe/rp-pppoe-server.js new file mode 100644 index 0000000000..5f246b5eac --- /dev/null +++ b/applications/luci-app-rp-pppoe-server/htdocs/luci-static/resources/view/pppoe/rp-pppoe-server.js @@ -0,0 +1,129 @@ +'use strict'; +'require form'; +'require network'; +'require tools.widgets as widgets'; +'require view'; + +return view.extend({ + load: function() { + return Promise.all([ + network.getNetworks(), + ]); + }, + + render: function (loaded_promises) { + var m, s, o; + const networks = loaded_promises[0]; + + m = new form.Map('pppoe', _('Roaring Penguin PPPoE Server'), + _('PPPoE Server Configuration')); + + s = m.section(form.TypedSection, 'pppoe_server', _('Server Configuration')); + s.anonymous = true; + s.addremove = true; + + o = s.option(form.Flag, 'enabled', _('Enabled')); + + o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Interface on which to listen.')); + o.optional = true; + o.nocreate = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'localip', _('IP of listening side'), _('If specified as <code>0.0.0.0</code> the selection of local IP address is delegated to <code>pppd</code>')); + o.datatype = 'ipaddr'; + o.placeholder = '10.0.0.1'; + o.value('10.0.0.1'); + o.value('0.0.0.0'); + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'firstremoteip', _('First remote IP'), _('If specified as <code>0.0.0.0</code> remote IP allocation will be delegated to <code>pppd</code>')); + o.datatype = 'ipaddr'; + o.placeholder = '10.67.15.1'; + o.value('10.67.15.1'); + o.value('0.0.0.0'); + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'ac_name', _('Access Concentrator Name')); + o.rmempty = true; + o.value('', _('Default: hostname')); + o.depends({ enabled: '1' }); + + o = s.option(form.DynamicList, 'service_name', _('Service Name'), _('Each one causes the named service to be advertised in a Service-Name tag in the PADO frame. The first one specifies the default service, and is used if the PPPoE client requests a Service-Name of length zero.')); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'maxsessions', _('Maximum Sessions'), _('Maximum concurrent sessions')); + o.datatype = 'range(1,65534)'; + o.placeholder = 64; + o.value('', _('Default: 64')); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'maxsessionsperpeer', _('Maximum sessions per peer')); + o.optional = true + o.datatype = 'range(0,65534)'; + o.placeholder = 0; + o.value('0', _('No limit')); + o.value('10'); + o.value('100'); + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Flag, 'use_non_uci_config', _('Use Non-UCI Config'), '<code>/etc/default/pppoe-server</code>'); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'optionsfile', _('Options file')); + o.placeholder = '/etc/ppp/pppoe-server-options'; + o.value('/etc/ppp/options'); + o.value('/etc/ppp/pppoe-server-options'); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Flag, 'randomsessions', _('Random session selection'), _('Tells the PPPoE server to randomly permute session numbers.')); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Flag, 'unit', _('Unit'), _('Invokes <code>pppd</code> with the unit flag')); + o.optional = true; + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'offset', _('Offset'), _('PPP Offset'), _('Instead of numbering PPPoE sessions starting at 1, numbering starts at %s'.format('<code>offset</code>+1'))); + o.optional = true; + o.datatype = 'uinteger'; + o.placeholder = 0; + o.value('0'); + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'timeout', _('Timeout'), _('Causes <code>pppoe</code> to exit if no session traffic is detected for %s seconds.'.format('<code>timeout</code>'))); + // no default timeout is assumed + o.optional = true; + o.datatype = 'uinteger'; + o.value('0', _('No timeout')); + o.value('60'); + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Value, 'mss', _('MSS'), _('Max Segment Size')); + o.optional = true; + o.datatype = 'uinteger'; + o.placeholder = 1468; + o.value('1412'); + o.value('1468'); + o.rmempty = true; + o.depends({ enabled: '1' }); + + o = s.option(form.Flag, 'sync', _('Synchronous PPP encapsulation'), _('Reduces CPU usage, but may cause a race condition on slow CPUs')); + o.depends({ enabled: '1' }); + + return m.render(); + } +}); |