From 1ed22401bbc2b1b076f49190530dbcf61bd4809f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 10 Dec 2017 20:28:35 -0800 Subject: [PATCH] GUACAMOLE-567: Warn user when tunnel enters "UNSTABLE" state. --- .../client/controllers/clientController.js | 12 +++++++ .../app/client/styles/connection-warning.css | 36 +++++++++++++++++++ .../webapp/app/client/templates/client.html | 5 +++ .../webapp/app/client/types/ManagedClient.js | 12 +++++++ .../app/client/types/ManagedClientState.js | 11 +++++- .../src/main/webapp/translations/en.json | 1 + 6 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 guacamole/src/main/webapp/app/client/styles/connection-warning.css diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index af1d72609..ffbe3c539 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -626,6 +626,18 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }; + /** + * Returns whether the current connection has been flagged as unstable due + * to an apparent network disruption. + * + * @returns {Boolean} + * true if the current connection has been flagged as unstable, false + * otherwise. + */ + $scope.isConnectionUnstable = function isConnectionUnstable() { + return $scope.client && $scope.client.clientState.connectionState === ManagedClientState.ConnectionState.UNSTABLE; + }; + // Show status dialog when connection status changes $scope.$watch('client.clientState.connectionState', function clientStateChanged(connectionState) { diff --git a/guacamole/src/main/webapp/app/client/styles/connection-warning.css b/guacamole/src/main/webapp/app/client/styles/connection-warning.css new file mode 100644 index 000000000..eec3e0745 --- /dev/null +++ b/guacamole/src/main/webapp/app/client/styles/connection-warning.css @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#connection-warning { + + position: absolute; + right: 0.25em; + top: 0.25em; + z-index: 20; + + max-width: 100%; + max-height: 3in; + + border: 1px solid rgba(0,0,0,0.5); + box-shadow: 1px 1px 2px rgba(0,0,0,0.25); + background: #FFE; + padding: 0.5em; + font-size: .8em; + +} diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html index 054cbcf67..ad85f234e 100644 --- a/guacamole/src/main/webapp/app/client/templates/client.html +++ b/guacamole/src/main/webapp/app/client/templates/client.html @@ -36,6 +36,11 @@ + +
+ {{'CLIENT.TEXT_CLIENT_STATUS_UNSTABLE' | translate}} +
+