Github user joshelser commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/242#discussion_r110076627
--- Diff: server/monitor/src/main/resources/resources/bulkImport.js ---
@@ -0,0 +1,213 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/**
+ * Creates bulk import initial table
+ */
+$(document).ready(function() {
+ createBulkImportHeader();
+ createServerBulkHeader();
+ refreshBulkImport();
+});
+
+/**
+ * Makes the REST calls, generates the tables with the new information
+ */
+function refreshBulkImport() {
+ $.ajaxSetup({
+ async: false
+ });
+ getBulkImports();
+ $.ajaxSetup({
+ async: true
+ });
+ refreshBulkImportTable();
+ refreshServerBulkTable();
+}
+
+/**
+ * Used to redraw the page
+ */
+function refresh() {
+ refreshBulkImport();
+}
+
+/**
+ * Generates the master bulk import status table
+ */
+function refreshBulkImportTable() {
+
+ clearTable('masterBulkImportStatus');
+
+ /*
+ * 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);
+ var items = [];
+
+ /* If the data is empty, create an empty row, otherwise,
+ * create the rows for the table
+ */
+ if (data.length === 0 || data.bulkImport.length === 0) {
+ items.push('<td class="center" colspan="3"><i>Empty</i></td>');
+ } else {
+ $.each(data.bulkImport, function(key, val) {
+ items.push('<td class="firstcell left" data-value="' + val.filename +
+ '">' + val.filename + '</td>');
+
+ items.push('<td class="right" data-value="' + val.age + '">' +
val.age +
+ '</td>');
+
+ items.push('<td class="right" data-value="' + val.state + '">' +
+ val.state + '</td>');
+ });
+ }
+
+ $('<tr/>', {
+ html: items.join('')
+ }).appendTo('#masterBulkImportStatus');
+}
+
+/**
+ * Generates the bulk import status table
+ */
+function refreshServerBulkTable() {
+
+ clearTable('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);
+ var items = [];
+
+ /* If the data is empty, create an empty row, otherwise
+ * create the rows for the table
+ */
+ if (data.length === 0 || data.tabletServerBulkImport.length === 0) {
+ items.push('<td class="center" colspan="3"><i>Empty</i></td>');
+ } else {
+ $.each(data.tabletServerBulkImport, function(key, val) {
+ items.push('<td class="firstcell left" data-value="' + val.server +
+ '"><a href="/tservers?s=' + val.server + '">' + val.server +
+ '</a></td>');
+
+ items.push('<td class="right" data-value="' + val.importSize + '">' +
+ val.importSize + '</td>');
+
+ items.push('<td class="right" data-value="' + val.oldestAge + '">' +
+ (val.oldestAge > 0 ? val.oldestAge : '—') + '</td>');
+ });
+ }
+
+ $('<tr/>', {
+ html: items.join('')
+ }).appendTo('#bulkImportStatus');
+}
+
+/**
+ * Sorts the bulkImportStatus table on the selected column
+ *
+ * @param {string} table Table ID to sort
+ * @param {number} n Column number to sort by
+ */
+function sortTable(table, n) {
+ var tableIDs = ['bulkImportStatus', 'masterBulkImportStatus'];
+
+ if (sessionStorage.tableColumnSort !== undefined &&
+ sessionStorage.tableColumnSort == n &&
+ sessionStorage.direction !== undefined) {
+ direction = sessionStorage.direction === 'asc' ? 'desc' : 'asc';
+ } else {
+ direction = sessionStorage.direction === undefined ?
+ 'asc' : sessionStorage.direction;
+ }
+ sessionStorage.tableColumn = tableIDs[table];
+ sessionStorage.tableColumnSort = n;
+ sortTables(tableIDs[table], direction, n);
+}
+
+/**
+ * Create tooltip for table column information
+ */
+$(function() {
+ $(document).tooltip();
--- End diff --
is there a reason this isn't in the `$(document).onReady`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---