This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 1fbac624e4 Show manager goal state in monitor (#3389) 1fbac624e4 is described below commit 1fbac624e42f36aa5691aada6c697b80eaad9d05 Author: Dom G <domgargu...@apache.org> AuthorDate: Thu May 11 23:32:35 2023 -0400 Show manager goal state in monitor (#3389) Add a dialog box to the manager page in the monitor to report when the manager is running in `SAFE_MODE` or when the goal state does not match the current state. Co-authored-by: Christopher Tubbs <ctubb...@apache.org> --- .../accumulo/monitor/resources/js/manager.js | 39 ++++++++++++++++++---- .../apache/accumulo/monitor/templates/manager.ftl | 5 ++- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/manager.js b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/manager.js index a5786dc412..716140c4f1 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/manager.js +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/manager.js @@ -25,21 +25,46 @@ var managerStatusTable, recoveryListTable; -function refreshManagerBanner() { +function refreshManagerBanners() { getStatus().then(function () { - var managerStatus = JSON.parse(sessionStorage.status).managerStatus; + const managerStatus = JSON.parse(sessionStorage.status).managerStatus; // If manager status is error if (managerStatus === 'ERROR') { - // show banner and hide table - $('#managerBanner').show(); + // show the manager error banner and hide table + $('#managerRunningBanner').show(); $('#managerStatus_wrapper').hide(); } else { - // otherwise, hide banner and show table - $('#managerBanner').hide(); + // otherwise, hide the error banner and show manager table + $('#managerRunningBanner').hide(); $('#managerStatus_wrapper').show(); } }); + + getManager().then(function () { + const managerData = JSON.parse(sessionStorage.manager); + const managerState = managerData.managerState; + const managerGoalState = managerData.managerGoalState; + + const isStateGoalSame = managerState === managerGoalState; + + // if the manager state is normal and the goal state is the same as the current state, + // or of the manager is not running, hide the state banner and return early + if ((managerState === 'NORMAL' && isStateGoalSame) || managerState === null) { + $('#managerStateBanner').hide(); + return; + } + + // update the manager state banner message and show it + let bannerMessage = 'Manager state: ' + managerState; + if (!isStateGoalSame) { + // only show the goal state if it differs from the manager's current state + bannerMessage += '. Manager goal state: ' + managerGoalState; + } + $('#manager-banner-message').text(bannerMessage); + $('#managerStateBanner').show(); + }); + } /** @@ -47,7 +72,7 @@ function refreshManagerBanner() { */ function refreshManagerTables() { ajaxReloadTable(managerStatusTable); - refreshManagerBanner(); + refreshManagerBanners(); ajaxReloadTable(recoveryListTable); } diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/manager.ftl b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/manager.ftl index ac2d76a9b3..a26b3b4616 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/manager.ftl +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/manager.ftl @@ -23,9 +23,12 @@ <h3>Manager Server Overview</h3> </div> </div> - <div id="managerBanner" style="display: none;"> + <div id="managerRunningBanner" style="display: none;"> <div class="alert alert-danger" role="alert">Manager Server Not Running</div> </div> + <div id="managerStateBanner" style="display: none;"> + <div id="manager-banner-message" class="alert alert-warning" role="alert"></div> + </div> <table id="managerStatus" class="table caption-top table-bordered table-striped table-condensed"> <caption><span class="table-caption">${title}</span><br /></caption> <thead>