Add progress bar.

This commit is contained in:
Michael Jumper
2013-10-15 15:49:09 -07:00
parent 47dcada639
commit 5ba188abf4
3 changed files with 47 additions and 7 deletions

View File

@@ -1088,7 +1088,7 @@ GuacUI.Client.attach = function(guac) {
// Add upload notification
var upload = new GuacUI.Upload(file.name);
upload.updateProgress(getSizeString(0));
upload.updateProgress(getSizeString(0), 0);
GuacUI.Client.notification_area.appendChild(upload.getElement());
@@ -1129,7 +1129,7 @@ GuacUI.Client.attach = function(guac) {
// Otherwise, update progress
else
upload.updateProgress(getSizeString(offset));
upload.updateProgress(getSizeString(offset), offset / bytes.length * 100);
};

View File

@@ -852,13 +852,27 @@ GuacUI.Upload = function(filename) {
*/
var progress = GuacUI.createChildElement(element, "div", "progress");
/**
* The actual moving bar within the progress bar.
* @private
*/
var bar = GuacUI.createChildElement(progress, "div", "bar");
/**
* The textual readout of progress.
* @private
*/
var progress_status = GuacUI.createChildElement(progress, "div");
/**
* Updates the content of the progress indicator with the given text.
*
* @param {String} text The text to assign to the progress indicator.
* @param {Number} percent The overall percent complete.
*/
this.updateProgress = function(text) {
progress.textContent = text;
this.updateProgress = function(text, percent) {
progress_status.textContent = text;
bar.style.width = percent + "%";
};
/**