Merge pull request #1735 from sumpfralle/olsr-jsoninfo-parser-handle-empty-result
[oweals/luci.git] / protocols / luci-proto-ipv6 / htdocs / luci-static / resources / protocol / 464xlat.js
1 'use strict';
2 'require form';
3 'require network';
4 'require tools.widgets as widgets';
5
6 network.registerPatternVirtual(/^464-.+$/);
7 network.registerErrorCode('CLAT_CONFIG_FAILED', _('CLAT configuration failed'));
8
9 return network.registerProtocol('464xlat', {
10         getI18n: function() {
11                 return _('464XLAT (CLAT)');
12         },
13
14         getIfname: function() {
15                 return this._ubus('l3_device') || '464-%s'.format(this.sid);
16         },
17
18         getOpkgPackage: function() {
19                 return '464xlat';
20         },
21
22         isFloating: function() {
23                 return true;
24         },
25
26         isVirtual: function() {
27                 return true;
28         },
29
30         getDevices: function() {
31                 return null;
32         },
33
34         containsDevice: function(ifname) {
35                 return (network.getIfnameOf(ifname) == this.getIfname());
36         },
37
38         renderFormOptions: function(s) {
39                 var o;
40
41                 o = s.taboption('general', form.Value, 'ip6prefix', _('NAT64 Prefix'), _('Leave empty to autodetect'));
42                 o.datatype = 'cidr6';
43
44                 o = s.taboption('advanced', widgets.NetworkSelect, 'tunlink', _('Tunnel Link'));
45                 o.nocreate = true;
46                 o.exclude  = s.section;
47
48                 o = s.taboption('advanced', form.Flag, 'defaultroute', _('Default gateway'), _('If unchecked, no default route is configured'));
49                 o.default = o.enabled;
50
51                 o = s.taboption('advanced', form.Value, 'metric', _('Use gateway metric'));
52                 o.placeholder = '0';
53                 o.datatype    = 'uinteger';
54                 o.depends('defaultroute', '1');
55
56                 o = s.taboption('advanced', form.Value, 'mtu', _('Use MTU on tunnel interface'));
57                 o.placeholder = '1280';
58                 o.datatype    = 'max(9200)';
59         }
60 });