From 6c562f3a08e17d56f52cd784ca2304a6042de558 Mon Sep 17 00:00:00 2001 From: Christian Korber Date: Wed, 12 Feb 2025 12:05:00 +0100 Subject: [PATCH] luci-app-keepalived: split state into separate columns 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 --- .../luci-static/resources/view/keepalived/overview.js | 8 ++++++-- .../resources/view/status/include/35_keepalived.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/overview.js b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/overview.js index f241cc3d05..3de2213209 100644 --- a/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/overview.js +++ b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/keepalived/overview.js @@ -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) diff --git a/applications/luci-app-keepalived/htdocs/luci-static/resources/view/status/include/35_keepalived.js b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/status/include/35_keepalived.js index f4b83e76d7..c0495bc4d5 100644 --- a/applications/luci-app-keepalived/htdocs/luci-static/resources/view/status/include/35_keepalived.js +++ b/applications/luci-app-keepalived/htdocs/luci-static/resources/view/status/include/35_keepalived.js @@ -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) -- 2.30.2