treewide: remove rendundant proto handler options
[project/luci.git] / protocols / luci-proto-ppp / htdocs / luci-static / resources / protocol / l2tp.js
1 'use strict';
2 'require uci';
3 'require form';
4 'require network';
5
6 network.registerPatternVirtual(/^l2tp-.+$/);
7
8 return network.registerProtocol('l2tp', {
9 getI18n: function() {
10 return _('L2TP');
11 },
12
13 getIfname: function() {
14 return this._ubus('l3_device') || 'l2tp-%s'.format(this.sid);
15 },
16
17 getOpkgPackage: function() {
18 return 'xl2tpd';
19 },
20
21 isFloating: function() {
22 return true;
23 },
24
25 isVirtual: function() {
26 return true;
27 },
28
29 getDevices: function() {
30 return null;
31 },
32
33 containsDevice: function(ifname) {
34 return (network.getIfnameOf(ifname) == this.getIfname());
35 },
36
37 renderFormOptions: function(s) {
38 var dev = this.getL3Device() || this.getDevice(), o;
39
40 o = s.taboption('general', form.Value, 'server', _('L2TP Server'));
41 o.datatype = 'or(host(1), hostport(1))';
42
43 s.taboption('general', form.Value, 'username', _('PAP/CHAP username'));
44
45 o = s.taboption('general', form.Value, 'password', _('PAP/CHAP password'));
46 o.password = true;
47
48 if (L.hasSystemFeature('ipv6')) {
49 o = s.taboption('advanced', form.ListValue, 'ipv6', _('Obtain IPv6-Address'), _('Enable IPv6 negotiation on the PPP link'));
50 o.value('auto', _('Automatic'));
51 o.value('0', _('Disabled'));
52 o.value('1', _('Manual'));
53 o.default = 'auto';
54 }
55
56 o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
57 o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
58 o.datatype = 'max(9200)';
59 }
60 });