From 2f1aa875fd6d033d28aa6cc7c445939dbba663fe Mon Sep 17 00:00:00 2001 From: Dave Marion Date: Fri, 1 May 2026 15:11:46 +0000 Subject: [PATCH 1/2] Converted auto-refresh to a switch --- .../accumulo/monitor/resources/css/screen.css | 8 ----- .../monitor/resources/js/functions.js | 30 +++++++------------ .../accumulo/monitor/templates/navbar.ftl | 7 ++++- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/css/screen.css b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/css/screen.css index bcfdcb20812..3b13a246ea9 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/css/screen.css +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/css/screen.css @@ -421,14 +421,6 @@ pre.logevent { left: unset; } -.active { - color: #fff; - text-decoration: none; - background-color: #337ab7; - outline: 0; -} - - .btn-white-font { color: #fff; background-color: #0dcaf0; diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js index a449eb78d5c..c819a621642 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js @@ -37,6 +37,7 @@ const TABLET_SERVER_PROCESS_VIEW = 'tserversView'; var STATUS_REQUEST = null; const RUNNING_COMPACTIONS_BY_TABLE = 'runningCompactionsByTable'; const RUNNING_COMPACTIONS_BY_GROUP = 'runningCompactionsByGroup'; +const AUTO_REFRESH_KEY = 'auto-refresh'; // Override Length Menu options for dataTables if ($.fn && $.fn.dataTable) { @@ -53,25 +54,17 @@ if ($.fn && $.fn.dataTable) { * and creates listeners for auto refresh */ function setupAutoRefresh() { - // Sets auto refresh to true or false - if (!sessionStorage.autoRefresh) { - sessionStorage.autoRefresh = 'false'; - } - // Need this to set the initial value for the autorefresh on page load - if (sessionStorage.autoRefresh === 'false') { - $('.auto-refresh').parent().removeClass('active'); + + var autoRefreshSwitch = $('#autoRefreshSwitch'); + var savedValue = localStorage.getItem(AUTO_REFRESH_KEY); + if (savedValue === null || savedValue === 'false') { + autoRefreshSwitch.prop('checked', false); } else { - $('.auto-refresh').parent().addClass('active'); + autoRefreshSwitch.prop('checked', true); } // Initializes the auto refresh on click listener - $('.auto-refresh').on("click", function () { - if ($(this).parent().attr('class') === 'active') { - $(this).parent().removeClass('active'); - sessionStorage.autoRefresh = 'false'; - } else { - $(this).parent().addClass('active'); - sessionStorage.autoRefresh = 'true'; - } + $('#autoRefreshSwitch').on("change", function () { + localStorage.setItem(AUTO_REFRESH_KEY, $(this).is(':checked')); }); } @@ -86,12 +79,9 @@ function refresh() { * Global timer that checks for auto refresh status every 5 seconds */ TIMER = setInterval(function () { - if (sessionStorage.autoRefresh === 'true') { - $('.auto-refresh').parent().addClass('active'); + if (localStorage.getItem(AUTO_REFRESH_KEY) === 'true') { refresh(); refreshNavBar(); - } else { - $('.auto-refresh').parent().removeClass('active'); } }, 5000); diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl index 1cf41fcd895..ebec8306ebd 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl @@ -75,7 +75,12 @@ From b84f27b04a8ce774bd9003168cbecc5e64e2ff70 Mon Sep 17 00:00:00 2001 From: Dave Marion Date: Fri, 1 May 2026 12:58:55 -0400 Subject: [PATCH 2/2] Update server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl Co-authored-by: Dom G. --- .../org/apache/accumulo/monitor/templates/navbar.ftl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl index 5b1e9554fed..d2c2269991c 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl @@ -79,9 +79,11 @@