luci-app-keepalived: lint fixes
authorPaul Donald <newtwen+github@gmail.com>
Sun, 15 Feb 2026 05:38:26 +0000 (06:38 +0100)
committerPaul Donald <newtwen+github@gmail.com>
Mon, 16 Feb 2026 00:42:57 +0000 (01:42 +0100)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
13 files changed:
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/globals.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/ipaddress.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/notification.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/overview.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/peers.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/route.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/script.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/servers.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/track_interface.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/url.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/vrrp_instance.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/vrrp_sync_group.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/status/include/35_keepalived.js

index 60b895487d16c74b5b5260e0ce48c0e0083f64db..5ea6353c65fd1b43159a0b65f6114a55084130e4 100644 (file)
@@ -3,7 +3,7 @@
 'require form';
 
 return view.extend({
-       render: function() {
+       render() {
                let m, s, o;
 
                m = new form.Map('keepalived');
index 3efeb46206744f3a5a48c4ca9f0bbda910c74024..561b1db003c2fde2c06533363cae0abc9e5d29fc 100644 (file)
@@ -6,14 +6,14 @@
 'require tools.widgets as widgets';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        uci.load('keepalived'),
                ]);
        },
 
-       renderIPAddress: function(m) {
-               var s, o;
+       renderIPAddress(m) {
+               let s, o;
 
                s = m.section(form.GridSection, 'ipaddress', _('IP Addresses'),
                        _('Addresses would be referenced into Static and Virtual IP Address of VRRP instances'));
@@ -53,11 +53,9 @@ return view.extend({
                o.optional = true;
        },
 
-       renderStaticIPAddress: function(m) {
-               var s, o;
-               var ipaddress;
-
-               ipaddress = uci.sections('keepalived', 'ipaddress');
+       renderStaticIPAddress(m) {
+               let s, o;
+               let ipaddress = uci.sections('keepalived', 'ipaddress');
                if (ipaddress == '') {
                        ui.addNotification(null, E('p', _('IP Addresses must be configured for Static IP List')));
                }
@@ -72,14 +70,14 @@ return view.extend({
 
                o = s.option(form.DynamicList, 'address', _('IP Address'),
                        _('List of IP Addresses'));
-               for (var i = 0; i < ipaddress.length; i++) {
+               for (let i = 0; i < ipaddress.length; i++) {
                        o.value(ipaddress[i]['name']);
                }
                o.optional = true;
        },
 
-       render: function() {
-               var m;
+       render() {
+               let m;
 
                m = new form.Map('keepalived');
 
index c12a63be8e00e4abca44a4da345a48b00ff4dd78..3a9182220d2af15b2b5e87a9469ef84f1ed495a9 100644 (file)
@@ -6,12 +6,12 @@
 var isReadonlyView = !L.hasViewPermission() || null;
 
 return view.extend({
-       load: function() {
+       load() {
                return L.resolveDefault(fs.read('/etc/keepalived.user'), '');
        },
 
-       handleSave: function(ev) {
-               var value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n';
+       handleSave(ev) {
+               const value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n';
 
                return fs.write('/etc/keepalived.user', value).then(function(rc) {
                        document.querySelector('textarea').value = value;
@@ -21,7 +21,7 @@ return view.extend({
                });
        },
 
-       render: function(keepalived) {
+       render(keepalived) {
                return E([
                        E('h2', _('Keepalived.user')),
                        E('p', { 'class': 'cbi-section-descr' }, _('This is the /etc/keepalived.user file in which custom commands can be defined.')),
index 3de22132091930ebc16ce26e2aa4b67c7d171081..10da0c9ad83356274d79d847088f6a1b05c715f1 100644 (file)
@@ -12,14 +12,14 @@ const callKeepalivedStatus = rpc.declare({
 });
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        uci.load('keepalived'),
                ]);
        },
 
-       render: function() {
-               var table =
+       render() {
+               const table =
                        E('table', { 'class': 'table lases' }, [
                                E('tr', { 'class': 'tr table-titles' }, [
                                        E('th', { 'class': 'th' }, _('Name')),
@@ -35,14 +35,14 @@ return view.extend({
 
                poll.add(function() {
                        return callKeepalivedStatus().then(function(instancesInfo) {
-                               var targets = Array.isArray(instancesInfo.status) ? instancesInfo.status : [];
-                               var instances = uci.sections('keepalived', 'vrrp_instance');
+                               const targets = Array.isArray(instancesInfo.status) ? instancesInfo.status : [];
+                               const instances = uci.sections('keepalived', 'vrrp_instance');
 
                                cbi_update_table(table,
                                        targets.map(function(target) {
-                                               var state;
-                                               var state_initial;
-                                               var instance_state = target.data.state;
+                                               let state;
+                                               let state_initial;
+                                               const instance_state = target.data.state;
 
                                                if (instance_state === 2) {
                                                        state = 'MASTER';
@@ -59,7 +59,6 @@ return view.extend({
                                                if (instances != '') {
                                                        for (var i = 0; i < instances.length; i++) {
                                                                if (instances[i]['name'] == target.data.iname) {
-                                                                       state = state;
                                                                        state_initial = instances[i]['state'];
                                                                        break;
                                                                }
index be90ad92da6917997dc480aee6d0dfbb16d032a9..83111e3109da150cdd83607ccaf9b408ea8b2b26 100644 (file)
@@ -10,14 +10,13 @@ return view.extend({
                expect: { '': {} }
        }),
 
-       load: function() {
+       load() {
                return Promise.all([
                        this.callHostHints(),
                ]);
        },
 
-       render: function(data) {
-               var hosts = data[0];
+       render([hosts]) {
                let m, s, o;
 
                m = new form.Map('keepalived');
@@ -36,11 +35,11 @@ return view.extend({
                o.optional = false;
                o.rmempty = false;
                o.datatype = 'ipaddr';
-               for(var mac in hosts) {
+               for(let mac in hosts) {
                        if (hosts[mac]['ipaddrs'] == 'undefined') {
                                continue;
                        }
-                       for(var i = 0; i < hosts[mac]['ipaddrs'].length; i++) {
+                       for(let i = 0; i < hosts[mac]['ipaddrs'].length; i++) {
                                o.value(hosts[mac]['ipaddrs'][i]);
                        }
                }
index 2bb560483dd5c3e13a1a5ef1888fd7525bab1b37..4500d7beab3bef3c974dac820f9ef4f46fc3454f 100644 (file)
@@ -6,14 +6,14 @@
 'require tools.widgets as widgets';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        uci.load('keepalived'),
                ]);
        },
 
-       renderRoute: function(m) {
-               var s, o;
+       renderRoute(m) {
+               let s, o;
 
                s = m.section(form.GridSection, 'route', _('Routes'),
                        _('Routes would be referenced into Static and Virtual Routes of VRRP instances'));
@@ -59,9 +59,9 @@ return view.extend({
                o.placeholder = 'name';
        },
 
-       renderStaticRoutes: function(m) {
-               var s, o;
-               var route;
+       renderStaticRoutes(m) {
+               let s, o;
+               let route;
 
                route = uci.sections('keepalived', 'route');
                if (route == '') {
@@ -78,14 +78,14 @@ return view.extend({
 
                o = s.option(form.DynamicList, 'route', _('Route'),
                        _('List of Route Object'));
-               for (var i = 0; i < route.length; i++) {
+               for (let i = 0; i < route.length; i++) {
                        o.value(route[i]['name']);
                }
                o.optional = true;
        },
 
-       render: function() {
-               var m;
+       render() {
+               let m;
 
                m = new form.Map('keepalived');
 
index 6bc8156ee8e3f9274fb5d6a9d55261b6aa8d483a..d05bcb2728346885e622174893c84f44452e3d21 100644 (file)
@@ -5,15 +5,15 @@
 'require uci';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        uci.load('keepalived'),
                ]);
        },
 
-       renderTrackScript: function(m) {
-               var s, o;
-               var vrrp_scripts;
+       renderTrackScript(m) {
+               let s, o;
+               let vrrp_scripts;
 
                vrrp_scripts = uci.sections('keepalived', 'vrrp_script');
                if (vrrp_scripts == '') {
@@ -50,8 +50,8 @@ return view.extend({
                o.value('noreverse', _('No Reverse'));
        },
 
-       renderVRRPScript: function(m) {
-               var s, o;
+       renderVRRPScript(m) {
+               let s, o;
 
                s = m.section(form.GridSection, 'vrrp_script', _('VRRP Script'),
                        _('Adds a script to be executed periodically.') + ' ' +
@@ -94,8 +94,8 @@ return view.extend({
                o.datatype = 'uinteger';
        },
 
-       render: function() {
-               var m;
+       render() {
+               let m;
 
                m = new form.Map('keepalived');
 
index 80ead84216b80c309d83b3adbf9022ebc5eee1a7..8ee097119e63fc29558f900d067cac656c0323eb 100644 (file)
@@ -4,15 +4,15 @@
 'require uci';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        uci.load('keepalived'),
                ]);
        },
 
-       renderVirtualServer: function(m) {
-               var s, o;
-               var real_servers;
+       renderVirtualServer(m) {
+               let s, o;
+               let real_servers;
 
                s = m.section(form.GridSection, 'virtual_server', _('Virtual Server'),
                        _('A virtual server is a service configured to listen ' +
@@ -119,9 +119,9 @@ return view.extend({
                o.modalonly = true;
        },
 
-       renderRealServer: function(m) {
-               var s, o;
-               var urls;
+       renderRealServer(m) {
+               let s, o;
+               let urls;
 
                s = m.section(form.GridSection, 'real_server', _('Real Servers'),
                        _('Real Server to redirect all request'));
@@ -179,7 +179,7 @@ return view.extend({
                urls = uci.sections('keepalived', 'url');
                o = s.option(form.DynamicList, 'url', _('URLs'));
                if (urls != '') {
-                       for (var i = 0; i < urls.length; i++) {
+                       for (let i = 0; i < urls.length; i++) {
                                o.value(urls[i].name);
                        }
                }
@@ -193,8 +193,8 @@ return view.extend({
                o.datatype = 'uinteger';
        },
 
-       render: function() {
-               var m;
+       render() {
+               let m;
 
                m = new form.Map('keepalived');
 
index ac19dc55be4d0c8dc7995a371a9196321a0ea19d..f00797980ab415cf908222c8c48ed7b6c2250631 100644 (file)
@@ -5,7 +5,7 @@
 'require uci';
 
 return view.extend({
-       render: function() {
+       render() {
                let m, s, o;
 
                m = new form.Map('keepalived');
index 16cb4463677e0e559f29aa60eda40de107b01d7b..66918a68fb3b59b75b46b29d7cd40864b22691a2 100644 (file)
@@ -3,7 +3,7 @@
 'require form';
 
 return view.extend({
-       render: function() {
+       render() {
                let m, s, o;
 
                m = new form.Map('keepalived');
index afadeaac771c3426c22b17f20c996f65804c42ef..86e14927e8d4931d532b8f0fd5d3eeb9ae904313 100644 (file)
@@ -6,15 +6,15 @@
 'require tools.widgets as widgets';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        network.getDevices(),
                        uci.load('keepalived'),
                ]);
        },
 
-       renderGeneralTab: function(s) {
-               var o, ipaddress;
+       renderGeneralTab(s) {
+               let o, ipaddress;
 
                o = s.taboption('general',form.Value, 'name', _('Name'));
                o.rmempty = false;
@@ -72,7 +72,7 @@ return view.extend({
                        _('Addresses add|del on change to MASTER, to BACKUP.') + ' ' +
                        _('With the same entries on other machines, the opposite transition will be occurring.'));
                if (ipaddress != '') {
-                       for (var i = 0; i < ipaddress.length; i++) {
+                       for (let i = 0; i < ipaddress.length; i++) {
                                o.value(ipaddress[i]['name']);
                        }
                }
@@ -80,27 +80,27 @@ return view.extend({
                o.optional = false;
        },
 
-       renderPeerTab: function(s, netDevs) {
-               var o;
+       renderPeerTab(s, netDevs) {
+               let o;
 
                o = s.taboption('peer', form.ListValue, 'unicast_src_ip', _('Unicast Source IP'),
                        _('Default IP for binding vrrpd is the primary IP on interface'));
                o.datatype = 'ipaddr';
                o.optional = true;
                o.modalonly = true;
-               for (var i = 0; i < netDevs.length; i++) {
-                       var addrs = netDevs[i].getIPAddrs();
-                       for (var j = 0; j < addrs.length; j++) {
+               for (let i = 0; i < netDevs.length; i++) {
+                       let addrs = netDevs[i].getIPAddrs();
+                       for (let j = 0; j < addrs.length; j++) {
                                o.value(addrs[j].split('/')[0]);
                        }
                }
 
-               var peers = uci.sections('keepalived', 'peer');
+               let peers = uci.sections('keepalived', 'peer');
                o = s.taboption('peer', form.DynamicList, 'unicast_peer', _('Peer'),
                        _('Do not send VRRP adverts over VRRP multicast group.') + ' ' +
                        _('Instead it sends adverts to the following list of ip addresses using unicast design fashion'));
                if (peers != '') {
-                       for (var i = 0; i < peers.length; i++) {
+                       for (let i = 0; i < peers.length; i++) {
                                o.value(peers[i]['name']);
                        }
                }
@@ -124,8 +124,8 @@ return view.extend({
                o.depends({ 'auth_type' : 'PASS' });
        },
 
-       renderGARPTab: function(s) {
-               var o;
+       renderGARPTab(s) {
+               let o;
 
                o = s.taboption('garp', form.ListValue, 'garp_master_delay', _('GARP Delay'),
                        _('Gratuitous Master Delay in seconds'));
@@ -172,8 +172,8 @@ return view.extend({
                o.value('60');
        },
 
-       renderAdvancedTab: function(s) {
-               var o;
+       renderAdvancedTab(s) {
+               let o;
 
                o = s.taboption('advanced', form.Value, 'use_vmac', _('Use VMAC'),
                        _('Use VRRP Virtual MAC'));
@@ -234,9 +234,9 @@ return view.extend({
                o.modalonly = true;
        },
 
-       renderTrackingTab: function(s) {
-               var o;
-               var ipaddress, routes, interfaces, scripts;
+       renderTrackingTab(s) {
+               let o;
+               let ipaddress, routes, interfaces, scripts;
 
                ipaddress = uci.sections('keepalived', 'ipaddress');
                routes = uci.sections('keepalived', 'route');
@@ -249,7 +249,7 @@ return view.extend({
                        _('To decrease the number of packets sent in adverts, you can exclude most IPs from adverts.'));
                o.modalonly = true;
                if (ipaddress != '') {
-                       for (var i = 0; i < ipaddress.length; i++) {
+                       for (let i = 0; i < ipaddress.length; i++) {
                                o.value(ipaddress[i]['name']);
                        }
                }
@@ -258,7 +258,7 @@ return view.extend({
                        _('Routes add|del when changing to MASTER, to BACKUP'));
                o.modalonly = true;
                if (routes != '') {
-                       for (var i = 0; i < routes.length; i++) {
+                       for (let i = 0; i < routes.length; i++) {
                                o.value(routes[i]['name']);
                        }
                }
@@ -267,7 +267,7 @@ return view.extend({
                        _('Go to FAULT state if any of these go down'));
                o.modalonly = true;
                if (interfaces != '') {
-                       for (var i = 0; i < interfaces.length; i++) {
+                       for (let i = 0; i < interfaces.length; i++) {
                                o.value(interfaces[i]['name']);
                        }
                }
@@ -276,15 +276,14 @@ return view.extend({
                        _('Go to FAULT state if any of these go down, if unweighted'));
                o.modalonly = true;
                if (scripts != '') {
-                       for (var i = 0; i < scripts.length; i++) {
+                       for (let i = 0; i < scripts.length; i++) {
                                o.value(scripts[i]['name']);
                        }
                }
        },
 
-       render: function(data) {
-               var netDevs = data[0];
-               let m, s, o;
+       render([netDevs]) {
+               let m, s;
 
                m = new form.Map('keepalived');
 
@@ -294,11 +293,11 @@ return view.extend({
                s.addremove = true;
                s.nodescriptions = true;
 
-               o = s.tab('general', _('General'));
-               o = s.tab('peer', _('Peer'));
-               o = s.tab('tracking', _('Tracking'));
-               o = s.tab('garp', _('GARP'));
-               o = s.tab('advanced', _('Advanced'));
+               s.tab('general', _('General'));
+               s.tab('peer', _('Peer'));
+               s.tab('tracking', _('Tracking'));
+               s.tab('garp', _('GARP'));
+               s.tab('advanced', _('Advanced'));
 
                this.renderGeneralTab(s);
                this.renderPeerTab(s, netDevs);
index 648cb7109bbb30814209b5d96411ebe5f21ce5e1..d313d655ec07b4f90b1b636ab6ee87f45f45bcf4 100644 (file)
@@ -5,17 +5,15 @@
 'require uci';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        uci.load('keepalived'),
                ]);
        },
 
-       render: function(data) {
+       render(data) {
                let m, s, o;
-               var instances;
-
-               instances = uci.sections('keepalived', 'vrrp_instance');
+               let instances = uci.sections('keepalived', 'vrrp_instance');
                if (instances == '' || instances.length < 1) {
                        ui.addNotification(null, E('p', _('Instances must be configured for VRRP Groups')));
                }
@@ -37,7 +35,7 @@ return view.extend({
                o = s.option(form.DynamicList, 'group', _('Instance Group'));
                o.rmempty = false;
                o.optional = false;
-               for (var i = 0; i < instances.length; i++) {
+               for (let i = 0; i < instances.length; i++) {
                        o.value(instances[i]['name']);
                }
 
index c0495bc4d51a523f217e743dfe6bdf82f7569fc8..af09e0a32ffd349e96523244d0e4d8120c921ef6 100644 (file)
@@ -12,18 +12,18 @@ const callKeepalivedStatus = rpc.declare({
 return baseclass.extend({
        title: _('Keepalived Instances'),
 
-       load: function() {
+       load() {
                return Promise.all([
                        callKeepalivedStatus(),
                        uci.load('keepalived'),
                ]);
        },
 
-       render: function(data) {
-               var targets = (data[0].status) ? data[0].status : [];
-               var instances = uci.sections('keepalived', 'vrrp_instance');
+       render(data) {
+               const targets = (data[0].status) ? data[0].status : [];
+               const instances = uci.sections('keepalived', 'vrrp_instance');
 
-               var table =
+               const table =
                        E('table', { 'class': 'table lases' }, [
                                E('tr', { 'class': 'tr table-titles' }, [
                                        E('th', { 'class': 'th' }, _('Name')),
@@ -39,9 +39,9 @@ return baseclass.extend({
 
                cbi_update_table(table,
                        targets.map(function(target) {
-                               var state;
-                               var state_initial;
-                               var instance_state = target.data.state;
+                               let state;
+                               let state_initial;
+                               const instance_state = target.data.state;
 
                                if (instance_state === 2) {
                                        state = 'MASTER';
@@ -56,9 +56,8 @@ return baseclass.extend({
                                }
 
                                if (instances != '') {
-                                       for (var i = 0; i < instances.length; i++) {
+                                       for (let i = 0; i < instances.length; i++) {
                                                if (instances[i]['name'] == target.data.iname) {
-                                                       state = state;
                                                        state_initial = instances[i]['state'];
                                                        break;
                                                }