ctubbsii commented on code in PR #3389:
URL: https://github.com/apache/accumulo/pull/3389#discussion_r1190581869
##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/manager.js:
##########
@@ -25,29 +25,54 @@
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);
Review Comment:
```suggestion
$('#manager-banner-message').text(bannerMessage);
```
##########
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 class="alert alert-warning manager-banner-message"
role="alert"></div>
Review Comment:
This is a unique item, and should thus be an ID rather than a CLASS.
```suggestion
<div id="manager-banner-message" class="alert alert-warning"
role="alert"></div>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]