GUACAMOLE-567: Warn user when tunnel enters "UNSTABLE" state.

This commit is contained in:
Michael Jumper
2017-12-10 20:28:35 -08:00
parent e6f3665995
commit 1ed22401bb
6 changed files with 76 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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">

View File

@@ -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,

View File

@@ -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.

View File

@@ -137,6 +137,7 @@
"TEXT_CLIENT_STATUS_IDLE" : "Idle.",
"TEXT_CLIENT_STATUS_CONNECTING" : "Connecting to Guacamole...",
"TEXT_CLIENT_STATUS_DISCONNECTED" : "You have been disconnected.",
"TEXT_CLIENT_STATUS_UNSTABLE" : "The network connection to the Guacamole server appears unstable.",
"TEXT_CLIENT_STATUS_WAITING" : "Connected to Guacamole. Waiting for response...",
"TEXT_RECONNECT_COUNTDOWN" : "Reconnecting in {REMAINING} {REMAINING, plural, one{second} other{seconds}}...",
"TEXT_FILE_TRANSFER_PROGRESS" : "{PROGRESS} {UNIT, select, b{B} kb{KB} mb{MB} gb{GB} other{}}",