diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 44f6ce7f6..41d6fd0ad 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -112,24 +112,6 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams 0x031D: true }; - /** - * All upload error codes handled and passed off for translation. Any error - * code not present in this list will be represented by the "DEFAULT" - * translation. - */ - var UPLOAD_ERRORS = { - 0x0100: true, - 0x0201: true, - 0x0202: true, - 0x0203: true, - 0x0204: true, - 0x0205: true, - 0x0301: true, - 0x0303: true, - 0x0308: true, - 0x031D: true - }; - /** * All error codes for which automatic reconnection is appropriate when a * tunnel error occurs. diff --git a/guacamole/src/main/webapp/app/client/directives/guacFileTransfer.js b/guacamole/src/main/webapp/app/client/directives/guacFileTransfer.js index 246eeda12..0c232035e 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacFileTransfer.js +++ b/guacamole/src/main/webapp/app/client/directives/guacFileTransfer.js @@ -46,6 +46,24 @@ angular.module('client').directive('guacFileTransfer', [function guacFileTransfe // Required types var ManagedFileTransferState = $injector.get('ManagedFileTransferState'); + /** + * All upload error codes handled and passed off for translation. + * Any error code not present in this list will be represented by + * the "DEFAULT" translation. + */ + var UPLOAD_ERRORS = { + 0x0100: true, + 0x0201: true, + 0x0202: true, + 0x0203: true, + 0x0204: true, + 0x0205: true, + 0x0301: true, + 0x0303: true, + 0x0308: true, + 0x031D: true + }; + /** * Returns the unit string that is most appropriate for the * number of bytes transferred thus far - either 'gb', 'mb', 'kb', @@ -182,6 +200,37 @@ angular.module('client').directive('guacFileTransfer', [function guacFileTransfe }; + /** + * Returns whether an error has occurred. If an error has occurred, + * the transfer is no longer active, and the text of the error can + * be read from getErrorText(). + * + * @returns {Boolean} + * true if an error has occurred during transfer, false + * otherwise. + */ + $scope.hasError = function hasError() { + return $scope.transfer.transferState.streamState === ManagedFileTransferState.StreamState.ERROR; + }; + + /** + * Returns the text of the current error as a translation string. + * + * @returns {String} + * The name of the translation string containing the text + * associated with the current error. + */ + $scope.getErrorText = function getErrorText() { + + // Determine translation name of error + var status = $scope.transfer.transferState.statusCode; + var errorName = (status in UPLOAD_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT"; + + // Return translation string + return 'CLIENT.ERROR_UPLOAD_' + errorName; + + }; + }] // end file transfer controller }; diff --git a/guacamole/src/main/webapp/app/client/styles/transfer.css b/guacamole/src/main/webapp/app/client/styles/transfer.css index 3bf953093..a927ce083 100644 --- a/guacamole/src/main/webapp/app/client/styles/transfer.css +++ b/guacamole/src/main/webapp/app/client/styles/transfer.css @@ -32,6 +32,8 @@ overflow: hidden; width: 100%; margin-bottom: 0.5em; + font-family: monospace; + font-weight: bold; } .transfer .text { @@ -108,3 +110,20 @@ color: blue; text-decoration: underline; } + +.error.transfer { + background: #FDD; +} + +.error.transfer .progress { + border-color: rgba(0, 0, 0, 0.125); +} + +.error.transfer .text, +.error.transfer .progress .bar { + display: none; +} + +.error-text { + margin-bottom: 0; +} diff --git a/guacamole/src/main/webapp/app/client/templates/guacFileTransfer.html b/guacamole/src/main/webapp/app/client/templates/guacFileTransfer.html index 4a3ab7da7..26cb1dee7 100644 --- a/guacamole/src/main/webapp/app/client/templates/guacFileTransfer.html +++ b/guacamole/src/main/webapp/app/client/templates/guacFileTransfer.html @@ -1,4 +1,4 @@ -
{{getErrorText() | translate}}
+