1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
'use strict';
'require view';
'require ui';
'require form';
'require uci';
'require tools.widgets as widgets';
return view.extend({
load: function() {
return Promise.all([
uci.load('keepalived'),
]);
},
renderIPAddress: function(m) {
var s, o;
s = m.section(form.GridSection, 'ipaddress', _('IP Addresses'),
_('Addresses would be referenced into Static and Virtual IP Address of VRRP instances'));
s.anonymous = true;
s.addremove = true;
s.nodescriptions = true;
o = s.option(form.Value, 'name', _('Name'));
o.rmempty = false;
o.optional = false;
o.placeholder = 'name';
o = s.option(form.Value, 'address', _('Address'),
_('IP Address of the object'));
o.rmempty = false;
o.optional = false;
o.datatype = 'ipaddr';
o.placeholder = '192.168.1.1';
o = s.option(widgets.DeviceSelect, 'device', _('Device'),
_('Device to use to assign the Address'));
o.optional = true;
o.noaliases = true;
o = s.option(form.Value, 'label_suffix', _('Virtual Device Label'),
_('Creates virtual device with Label'));
o.datatype = 'maxlength(4)';
o.optional = true;
o = s.option(form.ListValue, 'scope', _('Scope'),
_('Scope of the Address'));
o.value('site', _('Site'));
o.value('link', _('Link'));
o.value('host', _('Host'));
o.value('nowhere', _('No Where'));
o.value('global', _('Global'));
o.optional = true;
},
renderStaticIPAddress: function(m) {
var s, o;
var ipaddress;
ipaddress = uci.sections('keepalived', 'ipaddress');
if (ipaddress == '') {
ui.addNotification(null, E('p', _('IP Addresses must be configured for Static IP List')));
}
s = m.section(form.GridSection, 'static_ipaddress', _('Static IP Addresses'),
_('Static Addresses are not moved by vrrpd, they stay on the machine.') + '<br/>' +
_('If your systems already have IPs and they can ping each other, you do not need this section'));
s.anonymous = true;
s.addremove = true;
s.nodescriptions = true;
o = s.option(form.DynamicList, 'address', _('IP Address'),
_('List of IP Addresses'));
for (var i = 0; i < ipaddress.length; i++) {
o.value(ipaddress[i]['name']);
}
o.optional = true;
},
render: function() {
var m;
m = new form.Map('keepalived');
this.renderIPAddress(m);
this.renderStaticIPAddress(m);
return m.render();
}
});
|