From d7dfd08add13888b93ab37172cc3cd3d44f59e69 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 2 Apr 2019 11:14:23 -0700 Subject: [PATCH] GUACAMOLE-723: Display warning icon when background connection disconnects due to an error. --- .../app/client/directives/guacClientPanel.js | 28 ++++++++++++++++++ .../app/client/styles/other-connections.css | 25 ++++++++++++++++ .../app/client/templates/guacClientPanel.html | 3 +- .../src/main/webapp/images/warning-white.png | Bin 0 -> 4506 bytes 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 guacamole/src/main/webapp/images/warning-white.png diff --git a/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js b/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js index 737fce9c4..5cd30ec01 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js @@ -24,8 +24,12 @@ */ angular.module('client').directive('guacClientPanel', ['$injector', function guacClientPanel($injector) { + // Required services var sessionStorageFactory = $injector.get('sessionStorageFactory'); + // Required types + var ManagedClientState = $injector.get('ManagedClientState'); + /** * Getter/setter for the boolean flag controlling whether the client panel * is currently hidden. This flag is maintained in session-local storage to @@ -81,6 +85,30 @@ angular.module('client').directive('guacClientPanel', ['$injector', function gua return !_.isEmpty($scope.clients); }; + /** + * Returns whether the given client has disconnected due to an + * error. + * + * @param {ManagedClient} client + * The client to test. + * + * @returns {Boolean} + * true if the given client has disconnected due to an error, + * false otherwise. + */ + $scope.hasError = function hasError(client) { + + // Test whether the client has encountered an error + switch (client.clientState.connectionState) { + case ManagedClientState.ConnectionState.CONNECTION_ERROR: + case ManagedClientState.ConnectionState.TUNNEL_ERROR: + return true; + } + + return false; + + }; + /** * Toggles whether the client panel is currently hidden. */ diff --git a/guacamole/src/main/webapp/app/client/styles/other-connections.css b/guacamole/src/main/webapp/app/client/styles/other-connections.css index 41069ded4..d726b540f 100644 --- a/guacamole/src/main/webapp/app/client/styles/other-connections.css +++ b/guacamole/src/main/webapp/app/client/styles/other-connections.css @@ -100,6 +100,31 @@ } +#other-connections .client-panel-connection::before { + + display: block; + content: ' '; + + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + + background: url('images/warning-white.png'); + background-size: 48px; + background-position: center; + background-repeat: no-repeat; + + opacity: 0; + transition: opacity 0.25s; + +} + +#other-connections .client-panel-connection.error::before { + opacity: 0.75; +} + #other-connections .client-panel.hidden .client-panel-connection-list { /* Hide scrollbar when panel is hidden (will be visible through panel * show/hide button otherwise) */ diff --git a/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html b/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html index 00dfddef9..a09033510 100644 --- a/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html +++ b/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html @@ -6,7 +6,8 @@