You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/05/04 18:47:45 UTC

[GitHub] [accumulo] milleruntime commented on a diff in pull request #2675: Clean up bulkImport js

milleruntime commented on code in PR #2675:
URL: https://github.com/apache/accumulo/pull/2675#discussion_r865160004


##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/bulkImport.js:
##########
@@ -16,99 +16,82 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+/* JSLint global definitions */
+/*global
+    $, document, sessionStorage, clearTableBody, EMPTY_ROW_THREE_CELLS, EMPTY_CELL, getBulkImports
+*/
 "use strict";
 
-/**
- * Creates bulk import initial table
- */
-$(document).ready(function() {
-  refreshBulkImport();
-});
-
-/**
- * Makes the REST calls, generates the tables with the new information
- */
-function refreshBulkImport() {
-  getBulkImports().then(function() {
-    refreshBulkImportTable();
-    refreshServerBulkTable();
-  });
-}
-
-/**
- * Used to redraw the page
- */
-function refresh() {
-  refreshBulkImport();
-}
-
 /**
  * Generates the manager bulk import status table
  */
 function refreshBulkImportTable() {
+    $("#bulkListTable tbody").html(EMPTY_ROW_THREE_CELLS);
 
-  clearTableBody('managerBulkImportStatus');
+    // Get the bulk import data from the session
+    var data = sessionStorage.bulkImports === undefined ?
+                [] : JSON.parse(sessionStorage.bulkImports);
 
-  /*
-   * Get the bulk import value obtained earlier, if it doesn't exists,
-   * create an empty array
-   */
-  var data = sessionStorage.bulkImports === undefined ?
-      [] : JSON.parse(sessionStorage.bulkImports);
-
-  /* If the data is empty, create an empty row, otherwise,
-   * create the rows for the table
-   */
-  if (data.length === 0 || data.bulkImport.length === 0) {
-    $('<tr/>', {
-      html: createEmptyRow(3, 'Empty')
-    }).appendTo('#managerBulkImportStatus tbody');
-  } else {
-    $.each(data.bulkImport, function(key, val) {
-      var items = [];
-      items.push(createFirstCell(val.filename, val.filename));
-      items.push(createRightCell(val.age, new Date(val.age)));
-      items.push(createRightCell(val.state, val.state));
-      $('<tr/>', {
-        html: items.join('')
-      }).appendTo('#managerBulkImportStatus tbody');
+    // If the data is empty, clear table, otherwise populate
+    if (data.length === 0 || data.bulkImport.length === 0) {
+        return;
+    }
+    console.log("Populate bulkListTable with " + sessionStorage.bulkImports);
+    $.each(data.bulkImport, function (key, val) {
+        console.log("Append row " + key + " " + JSON.stringify(val) + " to bulkListTable");
+        $("#bulkListTable tbody")
+            .append("<tr><td class='firstcell left'>" + val.filename + "</td>")
+            .append("<td class='center'>" + new Date(val.age) + "</td>")
+            .append("<td class='right'>" + val.state + "</td></tr>");
     });
-  }
-
 }
 
 /**
- * Generates the bulk import status table
+ * Generates the bulkPerServerTable table
  */
 function refreshServerBulkTable() {
+    // get the bulkImport data from sessionStorage
+    var data = sessionStorage.bulkImports === undefined ?
+                [] : JSON.parse(sessionStorage.bulkImports);
 
-  clearTableBody('bulkImportStatus');
-
-  /* Get the bulk import value obtained earlier, if it doesn't exists,
-   * create an empty array
-   */
-  var data = sessionStorage.bulkImports === undefined ?
-   [] : JSON.parse(sessionStorage.bulkImports);
+    // if data is empty, log an error because tha means no tablet servers were found

Review Comment:
   I don't think so. This could happen a lot if there are no bulk imports.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org