summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/route.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/route.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/route.js')
-rw-r--r--applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/route.js96
1 files changed, 96 insertions, 0 deletions
diff --git a/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/route.js b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/route.js
new file mode 100644
index 0000000000..cf2454c7d4
--- /dev/null
+++ b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/route.js
@@ -0,0 +1,96 @@
+'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'),
+ ]);
+ },
+
+ renderRoute: function(m) {
+ var s, o;
+
+ s = m.section(form.GridSection, 'route', _('Routes'),
+ _('Routes would be refereenced into Static and Virtual Routes of VRRP instances'));
+ s.anonymous = true;
+ s.addremove = true;
+ s.nodescriptions = true;
+
+ o = s.option(form.Value, 'name', _('Name'));
+ o.optional = false;
+ o.placeholder = 'name';
+
+ o = s.option(widgets.DeviceSelect, 'device', _('Device'),
+ _('Device to use for Routing'));
+ o.optional = true;
+ o.noaliases = true;
+
+ o = s.option(form.Value, 'address', _('Target/Destination'),
+ _('Target IP Address of the Route'));
+ o.optional = true;
+ o.datatype = 'ipaddr';
+ o.placeholder = '192.168.1.1';
+
+ o = s.option(form.Value, 'src_addr', _('Source Address'),
+ _('Source Address of the Route'));
+ o.optional = true;
+ o.datatype = 'ipaddr';
+ o.placeholder = '192.168.1.1';
+
+ o = s.option(form.Value, 'gateway', _('Gateway'),
+ _('Gateway to use for the Route'));
+ o.optional = true;
+ o.datatype = 'ipaddr';
+ o.placeholder = '192.168.1.1';
+
+ o = s.option(form.Value, 'table', _('Route Table'),
+ _('System Route Table'));
+ o.value('default', _('default'));
+ o.value('Main', _('Main'));
+ o.optional = true;
+
+ o = s.option(form.Flag, 'blackhole', _('Blackhole'));
+ o.optional = true;
+ o.placeholder = 'name';
+ },
+
+ renderStaticRoutes: function(m) {
+ var s, o;
+ var route;
+
+ route = uci.sections('keepalived', 'route');
+ if (route == '') {
+ ui.addNotification(null, E('p', _('Routes must be configured for Static Routes')));
+ }
+
+ s = m.section(form.GridSection, 'static_routes', _('Static Routes'),
+ _('Static Routes are not moved by vrrpd, they stay on the machine.') + '<br/>' +
+ _('If you already have routes 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, 'route', _('Route'),
+ _('List of Route Object'));
+ for (var i = 0; i < route.length; i++) {
+ o.value(route[i]['name']);
+ }
+ o.optional = true;
+ },
+
+ render: function() {
+ var m;
+
+ m = new form.Map('keepalived');
+
+ this.renderRoute(m);
+ this.renderStaticRoutes(m);
+
+ return m.render();
+ }
+});