This is an automated email from the ASF dual-hosted git repository.

domgarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new e1f82919d9 Use icons for ScanServer Monitor low mem and idle display 
(#6220)
e1f82919d9 is described below

commit e1f82919d9e6f8c1837296ee50d3a16e8e5e2d9d
Author: Dom G. <[email protected]>
AuthorDate: Tue Mar 17 13:33:06 2026 -0400

    Use icons for ScanServer Monitor low mem and idle display (#6220)
    
    * Use icons for ScanServer Monitor low mem and idle display
    
    * Refactor boolean stat -> icon mapping function
---
 .../accumulo/monitor/resources/js/functions.js     | 44 ++++++++++++++++++++++
 .../accumulo/monitor/resources/js/sservers.js      |  8 ++--
 .../apache/accumulo/monitor/templates/sservers.ftl |  4 +-
 3 files changed, 51 insertions(+), 5 deletions(-)

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 8a1c39ea43..331f0844db 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
@@ -165,6 +165,50 @@ function levelFormat(level) {
   return level;
 }
 
+/**
+ * Maps the given activity state to an icon.
+ *
+ * @param {number|null|undefined} data Raw value, 1 for idle and 0 for active
+ * @param {string} type DataTables render type
+ * @return {string|number|null|undefined} HTML for display cells, raw data 
otherwise
+ */
+function renderActivityState(data, type) {
+  if (type !== 'display') {
+    return data;
+  }
+  if (data === null || data === undefined) {
+    return '&mdash;';
+  }
+  if (Number(data) === 1) {
+    return '<i class="bi bi-moon-stars-fill text-muted" title="Idle" 
aria-hidden="true"></i>' +
+      '<span class="visually-hidden">Idle</span>';
+  }
+  return '<i class="bi bi-activity text-primary" title="Active" 
aria-hidden="true"></i>' +
+    '<span class="visually-hidden">Active</span>';
+}
+
+/**
+ * Maps the given memory state to an icon.
+ *
+ * @param {number|null|undefined} data Raw value, 1 for low memory and 0 for 
normal memory
+ * @param {string} type DataTables render type
+ * @return {string|number|null|undefined} HTML for display cells, raw data 
otherwise
+ */
+function renderMemoryState(data, type) {
+  if (type !== 'display') {
+    return data;
+  }
+  if (data === null || data === undefined) {
+    return '&mdash;';
+  }
+  if (Number(data) === 1) {
+    return '<i class="bi bi-exclamation-triangle-fill text-warning" title="Low 
memory detected" aria-hidden="true"></i>' +
+      '<span class="visually-hidden">Low memory detected</span>';
+  }
+  return '<i class="bi bi-check-circle-fill text-success" title="Memory 
normal" aria-hidden="true"></i>' +
+    '<span class="visually-hidden">Memory normal</span>';
+}
+
 /**
  * Converts the time to short number and adds unit
  *
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/sservers.js
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/sservers.js
index 2ba580d472..011ce89c5b 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/sservers.js
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/sservers.js
@@ -19,7 +19,7 @@
 /* JSLint global definitions */
 /*global
     $, sessionStorage, timeDuration, bigNumberForQuantity, bigNumberForSize, 
ajaxReloadTable,
-    getSserversView
+    getSserversView, renderActivityState, renderMemoryState
 */
 "use strict";
 
@@ -170,10 +170,12 @@ $(function () {
         "data": "zombieThreads"
       },
       {
-        "data": "serverIdle"
+        "data": "serverIdle",
+        "render": renderActivityState
       },
       {
-        "data": "lowMemoryDetected"
+        "data": "lowMemoryDetected",
+        "render": renderMemoryState
       },
       {
         "data": "scansPausedForMemory"
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/sservers.ftl
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/sservers.ftl
index c7ba3bfc69..16210181a3 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/sservers.ftl
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/sservers.ftl
@@ -45,8 +45,8 @@
               <th title="Count of scans where a busy timeout happened." 
class="big-num">Busy Timeouts</th>
               <th title="Count of scan reservation conflicts." 
class="big-num">Reservation Conflicts</th>
               <th title="Number of scan threads with no associated client 
session." class="big-num">Zombie Threads</th>
-              <th title="Server idle flag (1=true, 0=false)." 
class="big-num">Idle</th>
-              <th title="Low memory detected flag (1=true, 0=false)." 
class="big-num">Low Mem</th>
+              <th title="The current activity state of the scan server." 
class="big-num">Activity State</th>
+              <th title="The current memory state of the scan server." 
class="big-num">Memory State</th>
               <th title="Count of scans paused due to low memory." 
class="big-num">Paused Mem</th>
               <th title="Count of scans returned early due to low memory." 
class="big-num">Early Mem</th>
             </tr>

Reply via email to