You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/05/28 03:07:56 UTC
[4/6] guacamole-client git commit: GUACAMOLE-567: Warn user when
tunnel enters "UNSTABLE" state.
GUACAMOLE-567: Warn user when tunnel enters "UNSTABLE" state.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/1ed22401
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/1ed22401
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/1ed22401
Branch: refs/heads/master
Commit: 1ed22401bbc2b1b076f49190530dbcf61bd4809f
Parents: e6f3665
Author: Michael Jumper <mj...@apache.org>
Authored: Sun Dec 10 20:28:35 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun May 27 17:09:24 2018 -0700
----------------------------------------------------------------------
.../app/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 +++++-
guacamole/src/main/webapp/translations/en.json | 1 +
6 files changed, 76 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/controllers/clientController.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js
index af1d726..ffbe3c5 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) {
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/styles/connection-warning.css
----------------------------------------------------------------------
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 0000000..eec3e07
--- /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;
+
+}
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/templates/client.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html
index 054cbcf..ad85f23 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 @@
<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">
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/types/ManagedClient.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/types/ManagedClient.js b/guacamole/src/main/webapp/app/client/types/ManagedClient.js
index e998445..09c96a9 100644
--- a/guacamole/src/main/webapp/app/client/types/ManagedClient.js
+++ b/guacamole/src/main/webapp/app/client/types/ManagedClient.js
@@ -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,
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/types/ManagedClientState.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/types/ManagedClientState.js b/guacamole/src/main/webapp/app/client/types/ManagedClientState.js
index d77013f..1a26b0d 100644
--- a/guacamole/src/main/webapp/app/client/types/ManagedClientState.js
+++ b/guacamole/src/main/webapp/app/client/types/ManagedClientState.js
@@ -88,12 +88,21 @@ 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.
*
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/translations/en.json
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json
index ca8acb8..cd57e39 100644
--- a/guacamole/src/main/webapp/translations/en.json
+++ b/guacamole/src/main/webapp/translations/en.json
@@ -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{}}",