mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-963: Update status dialog according to client state.
This commit is contained in:
@@ -27,8 +27,8 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
function clientController($scope, $routeParams, $injector) {
|
function clientController($scope, $routeParams, $injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ClientProperties = $injector.get('ClientProperties');
|
var ManagedClientState = $injector.get('ManagedClientState');
|
||||||
var ScrollState = $injector.get('ScrollState');
|
var ScrollState = $injector.get('ScrollState');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
@@ -391,83 +391,79 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
delete keysCurrentlyPressed[keysym];
|
delete keysCurrentlyPressed[keysym];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show status dialog when client status changes
|
// Show status dialog when connection status changes
|
||||||
$scope.$on('guacClientStateChange', function clientStateChangeListener(event, client, status) {
|
$scope.$watch('client.clientState.connectionState', function clientStateChanged(connectionState) {
|
||||||
|
|
||||||
// Show new status if not yet connected
|
// Hide status if no known state
|
||||||
if (status !== "connected") {
|
if (!connectionState) {
|
||||||
|
$scope.showStatus(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get any associated status code
|
||||||
|
var status = $scope.client.clientState.statusCode;
|
||||||
|
|
||||||
|
// Connecting
|
||||||
|
if (connectionState === ManagedClientState.ConnectionState.CONNECTING
|
||||||
|
|| connectionState === ManagedClientState.ConnectionState.WAITING) {
|
||||||
$scope.showStatus({
|
$scope.showStatus({
|
||||||
title: "CLIENT.DIALOG_HEADER_CONNECTING",
|
title: "CLIENT.DIALOG_HEADER_CONNECTING",
|
||||||
text: "CLIENT.TEXT_CLIENT_STATUS_" + status.toUpperCase()
|
text: "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide status upon connecting
|
// Client error
|
||||||
else
|
else if (connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR) {
|
||||||
$scope.showStatus(false);
|
|
||||||
|
|
||||||
});
|
// Determine translation name of error
|
||||||
|
var errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
||||||
|
|
||||||
// Show status dialog when client errors occur
|
// Determine whether the reconnect countdown applies
|
||||||
$scope.$on('guacClientError', function clientErrorListener(event, client, status) {
|
var countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
||||||
|
|
||||||
// Determine translation name of error
|
// Show error status
|
||||||
var errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
$scope.showStatus({
|
||||||
|
className: "error",
|
||||||
|
title: "CLIENT.DIALOG_HEADER_CONNECTION_ERROR",
|
||||||
|
text: "CLIENT.ERROR_CLIENT_" + errorName,
|
||||||
|
countdown: countdown,
|
||||||
|
actions: [ RECONNECT_ACTION ]
|
||||||
|
});
|
||||||
|
|
||||||
// Determine whether the reconnect countdown applies
|
}
|
||||||
var countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
|
||||||
|
|
||||||
// Override any existing status
|
// Tunnel error
|
||||||
$scope.showStatus(false);
|
else if (connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR) {
|
||||||
|
|
||||||
// Show error status
|
// Determine translation name of error
|
||||||
$scope.showStatus({
|
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
||||||
className: "error",
|
|
||||||
title: "CLIENT.DIALOG_HEADER_CONNECTION_ERROR",
|
|
||||||
text: "CLIENT.ERROR_CLIENT_" + errorName,
|
|
||||||
countdown: countdown,
|
|
||||||
actions: [ RECONNECT_ACTION ]
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
// Determine whether the reconnect countdown applies
|
||||||
|
var countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
||||||
|
|
||||||
// Show status dialog when tunnel status changes
|
// Show error status
|
||||||
$scope.$on('guacTunnelStateChange', function tunnelStateChangeListener(event, tunnel, status) {
|
$scope.showStatus({
|
||||||
|
className: "error",
|
||||||
|
title: "CLIENT.DIALOG_HEADER_CONNECTION_ERROR",
|
||||||
|
text: "CLIENT.ERROR_TUNNEL_" + errorName,
|
||||||
|
countdown: countdown,
|
||||||
|
actions: [ RECONNECT_ACTION ]
|
||||||
|
});
|
||||||
|
|
||||||
// Show new status only if disconnected
|
}
|
||||||
if (status === "closed") {
|
|
||||||
|
|
||||||
// Disconnect
|
|
||||||
$scope.id = null;
|
|
||||||
|
|
||||||
|
// Disconnected
|
||||||
|
else if (connectionState === ManagedClientState.ConnectionState.DISCONNECTED) {
|
||||||
$scope.showStatus({
|
$scope.showStatus({
|
||||||
title: "CLIENT.DIALOG_HEADER_DISCONNECTED",
|
title: "CLIENT.DIALOG_HEADER_DISCONNECTED",
|
||||||
text: "CLIENT.TEXT_TUNNEL_STATUS_" + status.toUpperCase()
|
text: "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase(),
|
||||||
|
actions: [ RECONNECT_ACTION ]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
// Hide status for all other states
|
||||||
|
else
|
||||||
// Show status dialog when tunnel errors occur
|
$scope.showStatus(false);
|
||||||
$scope.$on('guacTunnelError', function tunnelErrorListener(event, tunnel, status) {
|
|
||||||
|
|
||||||
// Determine translation name of error
|
|
||||||
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
|
||||||
|
|
||||||
// Determine whether the reconnect countdown applies
|
|
||||||
var countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
|
||||||
|
|
||||||
// Override any existing status
|
|
||||||
$scope.showStatus(false);
|
|
||||||
|
|
||||||
// Show error status
|
|
||||||
$scope.showStatus({
|
|
||||||
className: "error",
|
|
||||||
title: "CLIENT.DIALOG_HEADER_CONNECTION_ERROR",
|
|
||||||
text: "CLIENT.ERROR_TUNNEL_" + errorName,
|
|
||||||
countdown: countdown,
|
|
||||||
actions: [ RECONNECT_ACTION ]
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -710,4 +706,12 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clean up when view destroyed
|
||||||
|
$scope.$on('$destroy', function clientViewDestroyed() {
|
||||||
|
|
||||||
|
// Hide any status dialog
|
||||||
|
$scope.showStatus(false);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
@@ -288,7 +288,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
// Connected
|
// Connected
|
||||||
case 3:
|
case 3:
|
||||||
ManagedClientState.setConnectionState(managedClient.clientState,
|
ManagedClientState.setConnectionState(managedClient.clientState,
|
||||||
ManagedClientState.ConnectionState.DISCONNECTED);
|
ManagedClientState.ConnectionState.CONNECTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Connecting, disconnecting, and disconnected are all
|
// Connecting, disconnecting, and disconnected are all
|
||||||
|
@@ -82,13 +82,13 @@
|
|||||||
"SECTION_HEADER_DISPLAY" : "Display",
|
"SECTION_HEADER_DISPLAY" : "Display",
|
||||||
"SECTION_HEADER_MOUSE_MODE" : "Mouse emulation mode",
|
"SECTION_HEADER_MOUSE_MODE" : "Mouse emulation mode",
|
||||||
|
|
||||||
"TEXT_ZOOM_AUTO_FIT" : "Automatically fit to browser window",
|
"TEXT_ZOOM_AUTO_FIT" : "Automatically fit to browser window",
|
||||||
"TEXT_CLIENT_STATUS_IDLE" : "Idle.",
|
"TEXT_CLIENT_STATUS_IDLE" : "Idle.",
|
||||||
"TEXT_CLIENT_STATUS_CONNECTING" : "Connecting to Guacamole...",
|
"TEXT_CLIENT_STATUS_CONNECTING" : "Connecting to Guacamole...",
|
||||||
"TEXT_CLIENT_STATUS_WAITING" : "Connected to Guacamole. Waiting for response...",
|
"TEXT_CLIENT_STATUS_DISCONNECTED" : "You have been disconnected.",
|
||||||
"TEXT_TUNNEL_STATUS_CLOSED" : "You have been disconnected. Reload the page to reconnect.",
|
"TEXT_CLIENT_STATUS_WAITING" : "Connected to Guacamole. Waiting for response...",
|
||||||
"TEXT_RECONNECT_COUNTDOWN" : "Reconnecting in {REMAINING} {REMAINING, plural, one{second} other{seconds}}...",
|
"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{}}",
|
"TEXT_FILE_TRANSFER_PROGRESS" : "{PROGRESS} {UNIT, select, b{B} kb{KB} mb{MB} gb{GB} other{}}",
|
||||||
|
|
||||||
"URL_OSK_LAYOUT" : "layouts/en-us-qwerty.xml"
|
"URL_OSK_LAYOUT" : "layouts/en-us-qwerty.xml"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user