summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js
diff options
context:
space:
mode:
authorJaymin Patel <jem.patel@gmail.com>2022-09-08 10:05:13 +0530
committerJaymin Patel <jem.patel@gmail.com>2022-10-23 16:19:33 +0530
commitd1a82d28868678716f16472f70b46557ba99f8df (patch)
tree488200d40fbc8a6b0515ad7e3adeb93fb622ed89 /applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js
parent3e9d9a9dbb045c24eb93643838f8e8e3b9074e4b (diff)
luci-app-keepalived: Add LuCI for keepalived
LuCI Support for Keepalived Signed-off-by: Jaymin Patel <jem.patel@gmail.com>
Diffstat (limited to 'applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js')
-rw-r--r--applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js90
1 files changed, 90 insertions, 0 deletions
diff --git a/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js
new file mode 100644
index 0000000000..0cdce65bef
--- /dev/null
+++ b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js
@@ -0,0 +1,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 you already have IPs on your machines and your machines can ping each other, you don\'t 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();
+ }
+});