kevinrr888 commented on code in PR #5894:
URL: https://github.com/apache/accumulo/pull/5894#discussion_r2543047094


##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/manager.js:
##########
@@ -23,56 +23,29 @@
 */
 "use strict";
 
-var managerStatusTable, recoveryListTable;
+var managerStatusTable, recoveryListTable, managerStatus;
 
 function refreshManagerBanners() {
-  getStatus().then(function () {
-    const managerStatus = JSON.parse(sessionStorage.status).managerStatus;
-
-    // If manager status is error
-    if (managerStatus === 'ERROR') {
-      // show the manager error banner and hide table
-      $('#managerRunningBanner').show();
-      $('#managerStatus_wrapper').hide();
-    } else {
-      // 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();
-  });
-
+  // If manager status is error
+  if (managerStatus === 'ERROR') {
+    // show the manager error banner and hide manager table
+    $('#managerRunningBanner').show();
+    $('#managerStatusTable').hide();
+  } else {
+    // otherwise, hide the error banner and show manager table
+    $('#managerRunningBanner').hide();
+    $('#managerStatusTable').show();
+  }
 }
 
 /**
  * Populates tables with the new information
  */
 function refreshManagerTables() {
-  ajaxReloadTable(managerStatusTable);
   refreshManagerBanners();
+  if (managerStatus !== 'ERROR') {
+    ajaxReloadTable(managerStatusTable);
+  }
   ajaxReloadTable(recoveryListTable);
 }

Review Comment:
   Ah I see. Yeah good find. I fixed this in 
a630f14a47f4d866ecec540a620af60a727de9cd
   
   While I was looking into this, also noticed that there was a small window 
where the manager could be online but the rest-v2/manager endpoint was not yet 
available. This would result in a DataTables alert on the page, which is a bit 
disruptive. After waiting a second and refreshing (or just waiting for another 
auto-refresh to run), everything would be fine, but I thought this alert might 
be confusing/disruptive. Changed to instead log an error and have no table 
data. I will highlight what I changed to handle this.



-- 
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]

Reply via email to