Display errors in red.

This commit is contained in:
Michael Jumper
2013-10-15 12:57:56 -07:00
parent 76049fbc38
commit 47dcada639
3 changed files with 47 additions and 2 deletions

View File

@@ -1100,9 +1100,9 @@ GuacUI.Client.attach = function(guac) {
var offset = 0;
// Invalidate stream on all errors
stream.onerror = function() {
stream.onerror = function(text, code) {
valid = false;
// TODO: Update notification with error status
upload.showError(text);
};
// Continue upload when acknowledged
@@ -1133,6 +1133,12 @@ GuacUI.Client.attach = function(guac) {
};
// Close dialog and abort when close is clicked
upload.onclose = function() {
GuacUI.Client.notification_area.removeChild(upload.getElement());
// TODO: Abort transfer
};
};
reader.readAsArrayBuffer(file);

View File

@@ -750,6 +750,22 @@ GuacUI.Download = function(filename) {
progress.textContent = text;
};
/**
* Updates the content of the dialog to reflect an error condition
* represented by the given text.
*
* @param {String} text A human-readable description of the error.
*/
this.showError = function(text) {
element.removeChild(progress);
GuacUI.addClass(element, "error");
var status = GuacUI.createChildElement(element, "div", "status");
status.textContent = text;
};
/**
* Removes the progress indicator and replaces it with a download button.
*/
@@ -845,6 +861,22 @@ GuacUI.Upload = function(filename) {
progress.textContent = text;
};
/**
* Updates the content of the dialog to reflect an error condition
* represented by the given text.
*
* @param {String} text A human-readable description of the error.
*/
this.showError = function(text) {
element.removeChild(progress);
GuacUI.addClass(element, "error");
var status = GuacUI.createChildElement(element, "div", "status");
status.textContent = text;
};
/**
* Returns the element representing this notification.
*/

View File

@@ -369,6 +369,13 @@ p.hint {
text-overflow: ellipsis;
}
.upload.notification .status,
.download.notification .status {
color: red;
font-size: 1em;
padding: 1em;
}
.download.notification .progress,
.upload.notification .progress,
.download.notification .download,