luci-app-keepalived: split state into separate columns
authorChristian Korber <ck@dev.tdt.de>
Wed, 12 Feb 2025 11:05:00 +0000 (12:05 +0100)
committerChristian Korber <ck@dev.tdt.de>
Wed, 12 Feb 2025 11:05:06 +0000 (12:05 +0100)
This commit distinguishes between active state (how it is at the moment)
and how the keepalived was configured initially (Initial State).
These states are separated in two columns.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/overview.js
applications/luci-app-keepalived/htdocs/luci-static/resources/view/status/include/35_keepalived.js

index f241cc3d055d1a12782d81b6864dc3fcc18c02d3..3de22132091930ebc16ce26e2aa4b67c7d171081 100644 (file)
@@ -24,7 +24,8 @@ return view.extend({
                                E('tr', { 'class': 'tr table-titles' }, [
                                        E('th', { 'class': 'th' }, _('Name')),
                                        E('th', { 'class': 'th' }, _('Interface')),
-                                       E('th', { 'class': 'th' }, _('Active State/State')),
+                                       E('th', { 'class': 'th' }, _('Active State')),
+                                       E('th', { 'class': 'th' }, _('Initial State')),
                                        E('th', { 'class': 'th' }, _('Probes Sent')),
                                        E('th', { 'class': 'th' }, _('Probes Received')),
                                        E('th', { 'class': 'th' }, _('Last Transition')),
@@ -40,6 +41,7 @@ return view.extend({
                                cbi_update_table(table,
                                        targets.map(function(target) {
                                                var state;
+                                               var state_initial;
                                                var instance_state = target.data.state;
 
                                                if (instance_state === 2) {
@@ -57,7 +59,8 @@ return view.extend({
                                                if (instances != '') {
                                                        for (var i = 0; i < instances.length; i++) {
                                                                if (instances[i]['name'] == target.data.iname) {
-                                                                       state = state + '/' + instances[i]['state'];
+                                                                       state = state;
+                                                                       state_initial = instances[i]['state'];
                                                                        break;
                                                                }
                                                        }
@@ -66,6 +69,7 @@ return view.extend({
                                                        target.data.iname,
                                                        target.data.ifp_ifname,
                                                        state,
+                                                       state_initial,
                                                        target.stats.advert_sent,
                                                        target.stats.advert_rcvd,
                                                        new Date(target.data.last_transition * 1000)
index f4b83e76d776bbb6397faad93220dd442691aebc..c0495bc4d51a523f217e743dfe6bdf82f7569fc8 100644 (file)
@@ -28,7 +28,8 @@ return baseclass.extend({
                                E('tr', { 'class': 'tr table-titles' }, [
                                        E('th', { 'class': 'th' }, _('Name')),
                                        E('th', { 'class': 'th' }, _('Interface')),
-                                       E('th', { 'class': 'th' }, _('Active State/State')),
+                                       E('th', { 'class': 'th' }, _('Active State')),
+                                       E('th', { 'class': 'th' }, _('Initial State')),
                                        E('th', { 'class': 'th' }, _('Probes Sent')),
                                        E('th', { 'class': 'th' }, _('Probes Received')),
                                        E('th', { 'class': 'th' }, _('Last Transition')),
@@ -39,6 +40,7 @@ return baseclass.extend({
                cbi_update_table(table,
                        targets.map(function(target) {
                                var state;
+                               var state_initial;
                                var instance_state = target.data.state;
 
                                if (instance_state === 2) {
@@ -56,7 +58,8 @@ return baseclass.extend({
                                if (instances != '') {
                                        for (var i = 0; i < instances.length; i++) {
                                                if (instances[i]['name'] == target.data.iname) {
-                                                       state = state + '/' + instances[i]['state'];
+                                                       state = state;
+                                                       state_initial = instances[i]['state'];
                                                        break;
                                                }
                                        }
@@ -65,6 +68,7 @@ return baseclass.extend({
                                        target.data.iname,
                                        target.data.ifp_ifname,
                                        state,
+                                       state_initial,
                                        target.stats.advert_sent,
                                        target.stats.advert_rcvd,
                                        new Date(target.data.last_transition * 1000)