This is an automated email from the ASF dual-hosted git repository. mmiller 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 5cbe96a320 Replace javascript code with jquery for server (#2650) 5cbe96a320 is described below commit 5cbe96a320dfe849ab50e18e77688138b0acc286 Author: Mike Miller <mmil...@apache.org> AuthorDate: Tue Apr 26 04:24:10 2022 -0400 Replace javascript code with jquery for server (#2650) --- .../apache/accumulo/monitor/resources/js/server.js | 46 +++++++--------------- .../apache/accumulo/monitor/templates/server.ftl | 15 ++++++- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server.js b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server.js index e09ae54321..091f6c066a 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server.js +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server.js @@ -39,39 +39,23 @@ function refresh() { } /** - * Generates the server details table + * Populates the server details table */ function refreshDetailTable() { - - clearTableBody('tServerDetail'); - - var data = sessionStorage.server === undefined ? - [] : JSON.parse(sessionStorage.server); - - var items = []; - - if (data.length === 0 || data.details === undefined) { - items.push(createEmptyRow(5, 'Empty')); - } else { - items.push(createFirstCell(data.details.hostedTablets, - bigNumberForQuantity(data.details.hostedTablets))); - - items.push(createRightCell(data.details.entries, - bigNumberForQuantity(data.details.entries))); - - items.push(createRightCell(data.details.minors, - bigNumberForQuantity(data.details.minors))); - - items.push(createRightCell(data.details.majors, - bigNumberForQuantity(data.details.majors))); - - items.push(createRightCell(data.details.splits, - bigNumberForQuantity(data.details.splits))); - } - - $('<tr/>', { - html: items.join('') - }).appendTo('#tServerDetail tbody'); + clearTableBody('tServerDetail'); + var data = sessionStorage.server === undefined ? + [] : JSON.parse(sessionStorage.server); + if (data.length === 0 || data.details === undefined) { + $("#tServerDetail > tbody > tr > td").each(function () { + $(this).text(0); + }); + } else { + $("#hostedTablets").text(bigNumberForQuantity(data.details.hostedTablets)); + $("#entries").text(bigNumberForQuantity(data.details.entries)); + $("#minors").text(bigNumberForQuantity(data.details.minors)); + $("#majors").text(bigNumberForQuantity(data.details.majors)); + $("#splits").text(bigNumberForQuantity(data.details.splits)); + } } /** diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/server.ftl b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/server.ftl index 5a77341fba..0c29b8ac9c 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/server.ftl +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/server.ftl @@ -24,6 +24,9 @@ * show the table(t), length selector(l) aligned to the left and pagination(p). */ $(document).ready(function() { + // Global constant for the page + serv = '${server}'; + // Create a table for tserver list tabletResults = $('#perTabletResults').DataTable({ "ajax": { @@ -72,9 +75,9 @@ { "data": "majorAvgES" } ] }); - serv = '${server}'; refreshServer(); }); + </script> <div class="row"> <div class="col-xs-12"> @@ -94,7 +97,15 @@ <th>Splitting </th> </tr> </thead> - <tbody></tbody> + <tbody> + <tr> + <td id="hostedTablets"></td> + <td id="entries"></td> + <td id="minors"></td> + <td id="majors"></td> + <td id="splits"></td> + </tr> + </tbody> </table> </div> </div>