commit/galaxy-central: guerler: Add logging information to upload box
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7642e520cbb6/ Changeset: 7642e520cbb6 User: guerler Date: 2013-10-14 19:52:41 Summary: Add logging information to upload box Affected #: 1 file diff -r 213edb63be133b214c006e5655fe0e6bee8303f3 -r 7642e520cbb6767b2aba379b1681447c186a00ee static/scripts/utils/galaxy.uploadbox.js --- a/static/scripts/utils/galaxy.uploadbox.js +++ b/static/scripts/utils/galaxy.uploadbox.js @@ -49,6 +49,9 @@ // xml request element var xhr = null; + // file reader + var reader = null; + // attach to element $.fn.uploadbox = function(options) { @@ -158,6 +161,9 @@ // process an upload, recursive function process() { + // log + console.log("Processing queue..." + queue_length + " (" + queue_running + " / " + queue_pause + ")"); + // validate if (queue_length == 0 || queue_pause) { @@ -167,6 +173,9 @@ return; } else queue_running = true; + + // log + console.log("Looking for file..."); // get an identifier from the queue var index = -1; @@ -181,6 +190,9 @@ // remove from queue remove(index) + + // log + console.log("Initializing ('" + file.name + "')."); // start var data = opts.initialize(index, file); @@ -189,7 +201,7 @@ try { // load file read - var reader = new FileReader(); + reader = new FileReader(); // identify maximum file size var filesize = file.size; @@ -202,6 +214,10 @@ // link load reader.onload = function(e) { + // file read succesfully + console.log("Preparing submission ('" + file.name + "')."); + + // sending file send(index, file, data) }; @@ -217,6 +233,9 @@ error(index, file, opts.error_default); }; + // reading file + console.log("Reading ('" + file.name + "')."); + // read data reader.readAsDataURL(file); } else { @@ -241,10 +260,17 @@ // prepare request xhr = new XMLHttpRequest(); - + xhr.open('POST', opts.url, true); + xhr.setRequestHeader('Accept', 'application/json'); + xhr.setRequestHeader('Cache-Control', 'no-cache'); + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + // captures state changes xhr.onreadystatechange = function() { + // status change + console.log("Status changed: " + xhr.readyState + "."); + // check for request completed, server connection closed if (xhr.readyState != xhr.DONE) return; @@ -284,13 +310,12 @@ xhr.upload.index = index; xhr.upload.file = file; xhr.upload.addEventListener('progress', progress, false); + + // send request + xhr.send(formData); - // open request - xhr.open('POST', opts.url, true); - xhr.setRequestHeader('Accept', 'application/json'); - xhr.setRequestHeader('Cache-Control', 'no-cache'); - xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - xhr.send(formData); + // sending file + console.log("Sending file ('" + file.name + "')."); } // success Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org