mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	GUACAMOLE-567: Warn user when tunnel enters "UNSTABLE" state.
This commit is contained in:
		| @@ -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) { | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
| } | ||||
| @@ -36,6 +36,11 @@ | ||||
|         <guac-file-transfer-manager client="client"></guac-file-transfer-manager> | ||||
|     </div> | ||||
|  | ||||
|     <!-- Connection stability warning --> | ||||
|     <div id="connection-warning" ng-show="isConnectionUnstable()"> | ||||
|         {{'CLIENT.TEXT_CLIENT_STATUS_UNSTABLE' | translate}} | ||||
|     </div> | ||||
|  | ||||
|     <!-- Menu --> | ||||
|     <div class="menu" ng-class="{open: menu.shown}" id="guac-menu"> | ||||
|         <div class="menu-content" ng-if="menu.shown"> | ||||
|   | ||||
| @@ -346,6 +346,18 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector', | ||||
|                             ManagedClientState.ConnectionState.CONNECTING); | ||||
|                         break; | ||||
|  | ||||
|                     // Connection is established | ||||
|                     case Guacamole.Tunnel.State.OPEN: | ||||
|                         ManagedClientState.setConnectionState(managedClient.clientState, | ||||
|                             ManagedClientState.ConnectionState.CONNECTED); | ||||
|                         break; | ||||
|  | ||||
|                     // Connection is established but misbehaving | ||||
|                     case Guacamole.Tunnel.State.UNSTABLE: | ||||
|                         ManagedClientState.setConnectionState(managedClient.clientState, | ||||
|                             ManagedClientState.ConnectionState.UNSTABLE); | ||||
|                         break; | ||||
|  | ||||
|                     // Connection has closed | ||||
|                     case Guacamole.Tunnel.State.CLOSED: | ||||
|                         ManagedClientState.setConnectionState(managedClient.clientState, | ||||
|   | ||||
| @@ -88,11 +88,20 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl | ||||
|         /** | ||||
|          * The Guacamole connection has been successfully established, and | ||||
|          * initial graphical data has been received. | ||||
|          *  | ||||
|          * | ||||
|          * @type String | ||||
|          */ | ||||
|         CONNECTED : "CONNECTED", | ||||
|  | ||||
|         /** | ||||
|          * The Guacamole connection has been successfully established, but the | ||||
|          * network connection seems unstable. The connection may perform poorly | ||||
|          * or disconnect. | ||||
|          *  | ||||
|          * @type String | ||||
|          */ | ||||
|         UNSTABLE : "UNSTABLE", | ||||
|  | ||||
|         /** | ||||
|          * The Guacamole connection has terminated successfully. No errors are | ||||
|          * indicated. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user