From 53411640a001d296c3602dd6649c8f457b2971ff Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 12 Nov 2014 18:29:37 -0800 Subject: [PATCH] GUAC-605: Add status strings. Show dialog when status changes. --- .../app/client/controllers/clientController.js | 18 +++++++++++++++++- .../webapp/app/client/directives/guacClient.js | 5 +---- .../src/main/webapp/translations/en_US.json | 5 +++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 99b2903ad..0f0934f84 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -40,6 +40,7 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams', var connectionGroupDAO = $injector.get('connectionGroupDAO'); var connectionDAO = $injector.get('connectionDAO'); var ClientProperties = $injector.get('clientProperties'); + var statusModal = $injector.get('statusModal'); // Client settings and state $scope.clientProperties = new ClientProperties(); @@ -146,7 +147,22 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams', $scope.$on('guacKeyup', function keyupListener(event, keysym, keyboard) { delete keysCurrentlyPressed[keysym]; }); - + + // Show status dialog when status changes + $scope.$on('guacClientStatusChange', function clientStatusChangeListener(event, client, status) { + + // Hide previous status, if any + statusModal.deactivate(); + + // Show new status if not yet connected + if (status !== "connected") { + statusModal.activate({ + text: "client.status." + status + }); + } + + }); + $scope.formattedScale = function formattedScale() { return Math.round($scope.clientProperties.scale * 100); }; diff --git a/guacamole/src/main/webapp/app/client/directives/guacClient.js b/guacamole/src/main/webapp/app/client/directives/guacClient.js index d43197e5e..62d09ff14 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClient.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClient.js @@ -210,7 +210,7 @@ angular.module('client').directive('guacClient', [function guacClient() { // Connected case 3: - $scope.$emit('guacClientStatusChange', guac, null); + $scope.$emit('guacClientStatusChange', guac, "connected"); // Update server clipboard with current data var clipboard = localStorageUtility.get("clipboard"); @@ -366,9 +366,6 @@ angular.module('client').directive('guacClient', [function guacClient() { guac.getDisplay().showCursor(false); }; - // Hide any existing status notifications - $scope.$emit('guacClientStatusChange', guac, null); - var $display = $element.find('.display'); // Remove old client from UI, if any diff --git a/guacamole/src/main/webapp/translations/en_US.json b/guacamole/src/main/webapp/translations/en_US.json index cdba3b00c..bc80388d3 100644 --- a/guacamole/src/main/webapp/translations/en_US.json +++ b/guacamole/src/main/webapp/translations/en_US.json @@ -241,6 +241,11 @@ "0x031D" : "The Guacamole server is denying access to this connection because you have exhausted the limit for simultaneous connection use by an individual user. Please close one or more connections and try again.", "DEFAULT" : "An internal error has occurred within the Guacamole server, and the connection has been terminated. If the problem persists, please notify your system administrator, or check your system logs." } + }, + "status" : { + "idle" : "Idle.", + "connecting" : "Connecting to Guacamole...", + "waiting" : "Connected to Guacamole. Waiting for response..." } } }