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

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


The following commit(s) were added to refs/heads/2.1 by this push:
     new a6f24d7f83 Make scan and compaction columns numerically sortable 
(#3612)
a6f24d7f83 is described below

commit a6f24d7f83b99bea528022260bd3f6c550dd450d
Author: AlbertWhitlock <[email protected]>
AuthorDate: Wed Aug 2 05:29:00 2023 -0400

    Make scan and compaction columns numerically sortable (#3612)
    
    Make scan and compactions sortable numerically on the monitor by:
    
    * Adding running and queued fields to the REST endpoints so the values are 
available to the JavaScript
    * Adding datatables rules for sorting the combo columns using the data from 
the running/queued fields
---
 .../monitor/rest/tables/TableInformation.java      | 12 +++---
 .../rest/tservers/TabletServerInformation.java     | 12 +++---
 .../apache/accumulo/monitor/resources/js/table.js  | 46 ++++++++++++++++++++++
 .../accumulo/monitor/resources/js/tservers.js      | 46 ++++++++++++++++++++++
 .../apache/accumulo/monitor/templates/tables.ftl   | 30 +++++++++++++-
 5 files changed, 133 insertions(+), 13 deletions(-)

diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
index dc26afbda3..4599a62612 100644
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
+++ 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
@@ -60,12 +60,12 @@ public class TableInformation {
   // running scans with queued in parenthesis
   public String scansCombo;
 
-  private int queuedMajorCompactions;
-  private int runningMajorCompactions;
-  private int queuedMinorCompactions;
-  private int runningMinorCompactions;
-  private int queuedScans;
-  private int runningScans;
+  public int queuedMajorCompactions;
+  public int runningMajorCompactions;
+  public int queuedMinorCompactions;
+  public int runningMinorCompactions;
+  public int queuedScans;
+  public int runningScans;
 
   public double entriesRead;
   public double entriesReturned;
diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java
 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java
index d9c67412a6..90006518d1 100644
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java
+++ 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java
@@ -64,17 +64,17 @@ public class TabletServerInformation {
   // New variables
 
   public String ip;
-  private Integer scansRunning;
-  private Integer scansQueued;
+  public Integer scansRunning;
+  public Integer scansQueued;
   // combo string with running value and number queued in parenthesis
   public String minorCombo;
   public String majorCombo;
   public String scansCombo;
-  private Integer minorRunning;
-  private Integer minorQueued;
+  public Integer minorRunning;
+  public Integer minorQueued;
 
-  private Integer majorRunning;
-  private Integer majorQueued;
+  public Integer majorRunning;
+  public Integer majorQueued;
 
   private CompactionsList scansCompacting; // if scans is removed, change 
scansCompacting to scans
   private CompactionsList major;
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/table.js
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/table.js
index d7b91e7293..569138a53c 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/table.js
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/table.js
@@ -80,6 +80,28 @@ function initTableServerTable(tableID) {
           }
           return data;
         }
+      },
+      // ensure these 3 columns are sorted by the 2 numeric values that 
comprise the combined string
+      // instead of sorting them lexicographically by the string itself.
+      // Specifically: 'targets' column will use the values in the 'orderData' 
columns
+
+      // scan column will be sorted by number of running, then by number of 
queued
+      {
+        "targets": [7],
+        "type": "numeric",
+        "orderData": [13, 14]
+      },
+      // minor compaction column will be sorted by number of running, then by 
number of queued
+      {
+        "targets": [8],
+        "type": "numeric",
+        "orderData": [15, 16]
+      },
+      // major compaction column will be sorted by number of running, then by 
number of queued
+      {
+        "targets": [9],
+        "type": "numeric",
+        "orderData": [17, 18]
       }
     ],
     "columns": [{
@@ -133,6 +155,30 @@ function initTableServerTable(tableID) {
       },
       {
         "data": "osload"
+      },
+      {
+        "data": "scansRunning",
+        "visible": false
+      },
+      {
+        "data": "scansQueued",
+        "visible": false
+      },
+      {
+        "data": "minorRunning",
+        "visible": false
+      },
+      {
+        "data": "minorQueued",
+        "visible": false
+      },
+      {
+        "data": "majorRunning",
+        "visible": false
+      },
+      {
+        "data": "majorQueued",
+        "visible": false
       }
     ]
   });
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/tservers.js
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/tservers.js
index c0aea46012..a06fa66090 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/tservers.js
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/tservers.js
@@ -166,6 +166,28 @@ $(document).ready(function () {
           }
           return data;
         }
+      },
+      // ensure these 3 columns are sorted by the 2 numeric values that 
comprise the combined string
+      // instead of sorting them lexicographically by the string itself.
+      // Specifically: 'targets' column will use the values in the 'orderData' 
columns
+
+      // scan column will be sorted by number of running, then by number of 
queued
+      {
+        "targets": [8],
+        "type": "numeric",
+        "orderData": [14, 15]
+      },
+      // minor compaction column will be sorted by number of running, then by 
number of queued
+      {
+        "targets": [9],
+        "type": "numeric",
+        "orderData": [16, 17]
+      },
+      // major compaction column will be sorted by number of running, then by 
number of queued
+      {
+        "targets": [10],
+        "type": "numeric",
+        "orderData": [18, 19]
       }
     ],
     "columns": [{
@@ -216,6 +238,30 @@ $(document).ready(function () {
       },
       {
         "data": "osload"
+      },
+      {
+        "data": "scansRunning",
+        "visible": false
+      },
+      {
+        "data": "scansQueued",
+        "visible": false
+      },
+      {
+        "data": "minorRunning",
+        "visible": false
+      },
+      {
+        "data": "minorQueued",
+        "visible": false
+      },
+      {
+        "data": "majorRunning",
+        "visible": false
+      },
+      {
+        "data": "majorQueued",
+        "visible": false
       }
     ],
     "rowCallback": function (row, data, index) {
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/tables.ftl
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/tables.ftl
index 23f0dc7fd1..da1351aacc 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/tables.ftl
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/tables.ftl
@@ -49,6 +49,28 @@
                   if (type === 'display') data = timeDuration(data);
                   return data;
                 }
+              },
+              // ensure these 3 columns are sorted by the 2 numeric values 
that comprise the combined string
+              // instead of sorting them lexicographically by the string 
itself.
+              // Specifically: 'targets' column will use the values in the 
'orderData' columns
+
+              // scan column will be sorted by number of running, then by 
number of queued
+              {
+                "targets": [10],
+                "type": "numeric",
+                "orderData": [13, 14]
+              },
+              // minor compaction column will be sorted by number of running, 
then by number of queued
+              {
+                "targets": [11],
+                "type": "numeric",
+                "orderData": [15, 16]
+              },
+              // major compaction column will be sorted by number of running, 
then by number of queued
+              {
+                "targets": [12],
+                "type": "numeric",
+                "orderData": [17, 18]
               }
             ],
             "columns": [
@@ -73,7 +95,13 @@
               { "data": "holdTime", "orderSequence": ["desc", "asc"] },
               { "data": "scansCombo", "orderSequence": ["desc", "asc"] },
               { "data": "minorCombo", "orderSequence": ["desc", "asc"] },
-              { "data": "majorCombo", "orderSequence": ["desc", "asc"] }
+              { "data": "majorCombo", "orderSequence": ["desc", "asc"] },
+              { "data": "runningScans", "orderSequence": ["desc", "asc"], 
"visible": false },
+              { "data": "queuedScans", "orderSequence": ["desc", "asc"], 
"visible": false},
+              { "data": "runningMinorCompactions", "orderSequence": ["desc", 
"asc"], "visible": false },
+              { "data": "queuedMinorCompactions", "orderSequence": ["desc", 
"asc"], "visible": false },
+              { "data": "runningMajorCompactions", "orderSequence": ["desc", 
"asc"], "visible": false },
+              { "data": "queuedMajorCompactions", "orderSequence": ["desc", 
"asc"], "visible": false }
             ]
           });
         });

Reply via email to