Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: chrome/browser/resources/chromeos/drive_internals.js

Issue 10828422: drive: Add information about in-flight operations to chrome:drive-internals (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase, add const Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/drive_internals.js
diff --git a/chrome/browser/resources/chromeos/drive_internals.js b/chrome/browser/resources/chromeos/drive_internals.js
index 8e07931593549732e6110687364e54006ccd43eb..a578dc5efd69d61068ff84480c2db0abef12c405 100644
--- a/chrome/browser/resources/chromeos/drive_internals.js
+++ b/chrome/browser/resources/chromeos/drive_internals.js
@@ -70,7 +70,7 @@ function updateCacheContents(cacheEntry) {
/**
* Updates the Local Storage summary.
- * @param {Object} localStorageSummary Dictionaty describing the status of local
+ * @param {Object} localStorageSummary Dictionary describing the status of local
* stogage.
*/
function updateLocalStorageUsage(localStorageSummary) {
@@ -79,6 +79,43 @@ function updateLocalStorageUsage(localStorageSummary) {
}
/**
+ * 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');
+
+ // Reset the table.
+ var existingNodes = container.childNodes;
+ for (var i = 0; i < existingNodes.length; 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.operation_id));
+ tr.appendChild(createElementFromText('td', operation.operation_type));
+ tr.appendChild(createElementFromText('td', operation.file_path));
+ tr.appendChild(createElementFromText('td', operation.transfer_state));
+ tr.appendChild(createElementFromText('td', operation.start_time));
+ var progress = operation.progress_current + '/' + operation.progress_total;
+ if (operation.progress_total > 0) {
+ progress += ' (' +
+ (operation.progress_current / operation.progress_total * 100) + '%)';
+ }
+ tr.appendChild(createElementFromText('td', progress));
+
+ container.appendChild(tr);
+ }
+}
+
+/**
* Creates an element named |elementName| containing the content |text|.
* @param {string} elementName Name of the new element to be created.
* @param {string} text Text to be contained in the new element.
@@ -92,4 +129,7 @@ function createElementFromText(elementName, text) {
document.addEventListener('DOMContentLoaded', function() {
chrome.send('pageLoaded');
+ window.setInterval(function() {
+ chrome.send('periodicUpdate');
+ }, 1000);
});
« no previous file with comments | « chrome/browser/resources/chromeos/drive_internals.html ('k') | chrome/browser/ui/webui/chromeos/drive_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698