From 986ea4b206ef6322cad629cecb4ec86dc7642d8a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 16 Aug 2016 21:47:26 -0700 Subject: [PATCH] GUACAMOLE-36: Migrate guacLogin and guacNotification to TranslatableMessage. --- .../app/client/controllers/clientController.js | 16 ++++++++++++---- .../app/index/controllers/indexController.js | 4 ++-- .../main/webapp/app/login/directives/login.js | 10 ++++++---- .../main/webapp/app/login/templates/login.html | 6 ++++-- .../controllers/manageConnectionController.js | 8 +++++--- .../manageConnectionGroupController.js | 8 +++++--- .../manageSharingProfileController.js | 8 +++++--- .../manage/controllers/manageUserController.js | 15 ++++++++++----- .../notification/services/guacNotification.js | 4 +++- .../notification/templates/guacNotification.html | 4 +++- .../app/notification/types/Notification.js | 2 +- .../directives/guacSettingsPreferences.js | 14 ++++++++++---- .../settings/directives/guacSettingsSessions.js | 6 ++++-- 13 files changed, 70 insertions(+), 35 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index b522568b7..9827de1e6 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -578,7 +578,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams || connectionState === ManagedClientState.ConnectionState.WAITING) { guacNotification.showStatus({ title: "CLIENT.DIALOG_HEADER_CONNECTING", - text: "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase() + text: { + key : "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase() + } }); } @@ -595,7 +597,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams notifyConnectionClosed({ className : "error", title : "CLIENT.DIALOG_HEADER_CONNECTION_ERROR", - text : "CLIENT.ERROR_CLIENT_" + errorName, + text : { + key : "CLIENT.ERROR_CLIENT_" + errorName + }, countdown : countdown, actions : actions }); @@ -615,7 +619,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams notifyConnectionClosed({ className : "error", title : "CLIENT.DIALOG_HEADER_CONNECTION_ERROR", - text : "CLIENT.ERROR_TUNNEL_" + errorName, + text : { + key : "CLIENT.ERROR_TUNNEL_" + errorName + }, countdown : countdown, actions : actions }); @@ -626,7 +632,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams else if (connectionState === ManagedClientState.ConnectionState.DISCONNECTED) { notifyConnectionClosed({ title : "CLIENT.DIALOG_HEADER_DISCONNECTED", - text : "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase(), + text : { + key : "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase() + }, actions : actions }); } diff --git a/guacamole/src/main/webapp/app/index/controllers/indexController.js b/guacamole/src/main/webapp/app/index/controllers/indexController.js index 25e6b6190..e17ecee1f 100644 --- a/guacamole/src/main/webapp/app/index/controllers/indexController.js +++ b/guacamole/src/main/webapp/app/index/controllers/indexController.js @@ -38,7 +38,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector', * The message to display to the user as instructions for the login * process. * - * @type String + * @type TranslatableMessage */ $scope.loginHelpText = null; @@ -160,7 +160,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector', $scope.$on('guacInsufficientCredentials', function loginInsufficient(event, parameters, error) { $scope.page.title = 'APP.NAME'; $scope.page.bodyClassName = ''; - $scope.loginHelpText = error.message; + $scope.loginHelpText = error.translatableMessage; $scope.acceptedCredentials = parameters; $scope.expectedCredentials = error.expected; }); diff --git a/guacamole/src/main/webapp/app/login/directives/login.js b/guacamole/src/main/webapp/app/login/directives/login.js index aa03af255..cc820b81e 100644 --- a/guacamole/src/main/webapp/app/login/directives/login.js +++ b/guacamole/src/main/webapp/app/login/directives/login.js @@ -36,7 +36,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() { * An optional instructional message to display within the login * dialog. * - * @type String + * @type TranslatableMessage */ helpText : '=', @@ -72,7 +72,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() { /** * A description of the error that occurred during login, if any. * - * @type String + * @type TranslatableMessage */ $scope.loginError = null; @@ -160,11 +160,13 @@ angular.module('login').directive('guacLogin', [function guacLogin() { // Flag generic error for invalid login if (error.type === Error.Type.INVALID_CREDENTIALS) - $scope.loginError = 'LOGIN.ERROR_INVALID_LOGIN'; + $scope.loginError = { + 'key' : 'LOGIN.ERROR_INVALID_LOGIN' + }; // Display error if anything else goes wrong else - $scope.loginError = error.message; + $scope.loginError = error.translatableMessage; // Clear all visible password fields angular.forEach($scope.remainingFields, function clearEnteredValueIfPassword(field) { diff --git a/guacamole/src/main/webapp/app/login/templates/login.html b/guacamole/src/main/webapp/app/login/templates/login.html index b9d9335f4..26a3f1889 100644 --- a/guacamole/src/main/webapp/app/login/templates/login.html +++ b/guacamole/src/main/webapp/app/login/templates/login.html @@ -1,7 +1,8 @@
- + -

{{helpText | translate}}

+