function updateInFlightOperations(inFlightOperations) {
  var container = $('in-flight-operations-contents');

  // Reset the table. Remove children in reverse order. Otherwides each
  // existingNodes[i] changes as a side effect of removeChild.
  var existingNodes = container.childNodes;
  for (var i = existingNodes.length - 1; i >= 0; i--) {
    var node = existingNodes[i];
    if (node.className == 'in-flight-operation')
      container.removeChild(node);
  }

  // Add in-flight operations.
  for (var i = 0; i < inFlightOperations.length; i++) {
    var operation = inFlightOperations[i];
    var tr = document.createElement('tr');
    tr.className = 'in-flight-operation';
    tr.appendChild(createElementFromText('td', operation.id));
    tr.appendChild(createElementFromText('td', operation.type));
    tr.appendChild(createElementFromText('td', operation.file_path));
    tr.appendChild(createElementFromText('td', operation.state));
    var progress = operation.progress_current + '/' + operation.progress_total;
    if (operation.progress_total > 0) {
      var percent = operation.progress_current / operation.progress_total * 100;
      progress += ' (' + Math.round(percent) + '%)';
    }
    tr.appendChild(createElementFromText('td', progress));

    container.appendChild(tr);
  }
}
/**
 * Updates the summary about in-flight operations.
 * @param {Array} inFlightOperations List of dictionaries describing the status
 * of in-flight operations.
 */
Updates the summary about in-flight operations.
@param {Array} inFlightOperations List of dictionaries describing the status
of in-flight operations.
Updates the summary about in - flight operations . @param { Array } inFlightOperations List of dictionaries describing the status of in - flight operations .
function updateInFlightOperations(inFlightOperations) {
  var container = $('in-flight-operations-contents');
  var existingNodes = container.childNodes;
  for (var i = existingNodes.length - 1; i >= 0; i--) {
    var node = existingNodes[i];
    if (node.className == 'in-flight-operation')
      container.removeChild(node);
  }
  for (var i = 0; i < inFlightOperations.length; i++) {
    var operation = inFlightOperations[i];
    var tr = document.createElement('tr');
    tr.className = 'in-flight-operation';
    tr.appendChild(createElementFromText('td', operation.id));
    tr.appendChild(createElementFromText('td', operation.type));
    tr.appendChild(createElementFromText('td', operation.file_path));
    tr.appendChild(createElementFromText('td', operation.state));
    var progress = operation.progress_current + '/' + operation.progress_total;
    if (operation.progress_total > 0) {
      var percent = operation.progress_current / operation.progress_total * 100;
      progress += ' (' + Math.round(percent) + '%)';
    }
    tr.appendChild(createElementFromText('td', progress));
    container.appendChild(tr);
  }
}
function updateInFlightOperations ( inFlightOperations ) { var container = $ ( 'in-flight-operations-contents' ) ; var existingNodes = container . childNodes ; for ( var i = existingNodes . length - 1 ; i >= 0 ; i -- ) { var node = existingNodes [ i ] ; if ( node . className == 'in-flight-operation' ) container . removeChild ( node ) ; } for ( var i = 0 ; i < inFlightOperations . length ; i ++ ) { var operation = inFlightOperations [ i ] ; var tr = document . createElement ( 'tr' ) ; tr . className = 'in-flight-operation' ; tr . appendChild ( createElementFromText ( 'td' , operation . id ) ) ; tr . appendChild ( createElementFromText ( 'td' , operation . type ) ) ; tr . appendChild ( createElementFromText ( 'td' , operation . file_path ) ) ; tr . appendChild ( createElementFromText ( 'td' , operation . state ) ) ; var progress = operation . progress_current + '/' + operation . progress_total ; if ( operation . progress_total > 0 ) { var percent = operation . progress_current / operation . progress_total * 100 ; progress += ' (' + Math . round ( percent ) + '%)' ; } tr . appendChild ( createElementFromText ( 'td' , progress ) ) ; container . appendChild ( tr ) ; } }
Updates the summary about in-flight operations.
Updates the summary about in - flight operations .
// Reset the table. Remove children in reverse order. Otherwides each // existingNodes[i] changes as a side effect of removeChild. // Add in-flight operations.