DomGarguilo commented on code in PR #5894:
URL: https://github.com/apache/accumulo/pull/5894#discussion_r2440353936
##########
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:
I think I did a bad job of explaining the two issues I saw. You fixed the
status update one. But the other issue still exists.
If the manager page is loaded while the manager is down, the datatable will
never be initialized even if the manager comes back up. I think to fix this we
can refactor the creation of the `managerStatusTable` into a new method and
conditionally call that on page load (when the status of the manager is not
ERROR. And also call it in the `refreshManagerTables()` when the
`managerStatusTable` is undefined (which means has never been initialized in
the main run method) AND the status is not ERROR. That way, if we load the
manager page while the manager is down, once the manager comes back up, the
auto refresh should properly initialize the datatable.
--
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]