accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lstav <...@git.apache.org>
Subject [GitHub] accumulo pull request #242: ACCUMULO-2181/3005 REST API and new Monitor UI
Date Thu, 06 Apr 2017 13:21:49 GMT
Github user lstav commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/242#discussion_r110159175
  
    --- 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 : '&mdash;') + '</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 --
    
    There wasn't (I just tested it and it works the same), I'll make the changes necessary
on the files.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message