accumulo-dev mailing list archives

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

    https://github.com/apache/accumulo/pull/242#discussion_r110473929
  
    --- Diff: server/monitor/src/main/resources/resources/problems.js ---
    @@ -0,0 +1,232 @@
    +/*
    +* 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.
    +*/
    +
    +/**
    + * Makes the REST calls, generates the tables with the new information
    + */
    +function refreshProblems() {
    +  $.ajaxSetup({
    +    async: false
    +  });
    +  getProblems();
    +  $.ajaxSetup({
    +    async: true
    +  });
    +  refreshProblemSummaryTable();
    +  refreshProblemDetailsTable();
    +}
    +
    +/**
    + * Used to redraw the page
    + */
    +function refresh() {
    +  refreshProblems();
    +}
    +
    +/**
    + * Makes REST POST call to clear the problem summary table
    + *
    + * @param {string} tableID Table ID to clear
    + */
    +function clearTableProblemsTable(tableID) {
    +  clearTableProblems(tableID);
    +  refreshProblems();
    +  refreshNavBar();
    +}
    +
    +/**
    + * Makes REST POST call to clear the problem details table
    + *
    + * @param {string} table Table ID to clear
    + * @param {string} resource Resource of problem
    + * @param {string} type Type of problem
    + */
    +function clearDetailsProblemsTable(table, resource, type) {
    +  clearDetailsProblems(table, resource, type);
    +  refreshProblems();
    +  refreshNavBar();
    +}
    +
    +/**
    + * Generates the problem summary table
    + */
    +function refreshProblemSummaryTable() {
    +  clearTable('problemSummary');
    +  var data = sessionStorage.problemSummary === undefined ?
    +      [] : JSON.parse(sessionStorage.problemSummary);
    +
    +  if (data.length === 0 || Object.keys(data.problemSummary).length === 0) {
    +    var items = [];
    +    items.push('<td class="center" colspan="5"><i>Empty</i></td>');
    +    $('<tr/>', {
    +      html: items.join('')
    +    }).appendTo('#problemSummary');
    +  } else {
    +    $.each(data.problemSummary, function(key, val) {
    +      var items = [];
    +      items.push('<td class="firstcell left"><a href="/problems?table=' +
    +          val.tableID.split('+').join('%2B') + '">' + val.tableName +
    +          '</a></td>');
    +
    +      items.push('<td class="right">' + bigNumberForQuantity(val.fileRead) +
    +          '</td>');
    +
    +      items.push('<td class="right">' + bigNumberForQuantity(val.fileWrite) +
    +          '</td>');
    +
    +      items.push('<td class="right">' + bigNumberForQuantity(val.tableLoad) +
    +          '</td>');
    +      items.push('<td><a href="javascript:clearTableProblemsTable(\'' +
    +          val.tableID + '\');">clear ALL ' + val.tableName +
    +          ' problems</a></td>');
    +
    +      $('<tr/>', {
    +        html: items.join('')
    +      }).appendTo('#problemSummary');
    +    });
    +  }
    +}
    +
    +/**
    + * Generates the problem details table
    + */
    +function refreshProblemDetailsTable() {
    +  clearTable('problemDetails');
    +  var data = sessionStorage.problemDetails === undefined ?
    +      [] : JSON.parse(sessionStorage.problemDetails);
    +
    +  if (data.length === 0 || Object.keys(data.problemDetails).length === 0) {
    +    var items = [];
    +    items.push('<td class="center" colspan="7"><i>Empty</i></td>');
    +    $('<tr/>', {
    +      html: items.join('')
    +    }).appendTo('#problemDetails');
    +  } else {
    +    $.each(data.problemDetails, function(key, val) {
    +      var items = [];
    +      // Filters the details problems for the selected tableID
    +      if (tableID === val.tableID || tableID === '') {
    +        items.push('<td class="firstcell left" data-value="' + val.tableName +
    +            '"><a href="/tables/' + val.tableID + '">' + val.tableName +
    +            '</a></td>');
    +
    +        items.push('<td class="right" data-value="' + val.type + '">' +
    +            val.type + '</td>');
    +
    +        items.push('<td class="right" data-value="' + val.server + '">' +
    +            val.server + '</td>');
    +
    +        var date = new Date(val.time);
    +        items.push('<td class="right" data-value="' + val.time + '">' +
    +            date.toLocaleString() + '</td>');
    +
    +        items.push('<td class="right" data-value="' + val.resource + '">' +
    +            val.resource + '</td>');
    +
    +        items.push('<td class="right" data-value="' + val.exception + '">' +
    +            val.exception + '</td>');
    +
    +        items.push('<td><a href="javascript:clearDetailsProblemsTable(\'' +
    +            val.tableID + '\', \'' + val.resource + '\', \'' + val.type +
    +            '\')">clear this problem</a></td>');
    --- End diff --
    
    Another spot where a simple function that returns a table cell will help a lot


---
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