GUAC-605: Handle tunnel state/error events. Handle client error events. Add remaining translations for state/error display.

This commit is contained in:
Michael Jumper
2014-11-12 20:03:34 -08:00
parent 3f55c93bc4
commit 79f8ee07da
2 changed files with 130 additions and 26 deletions

View File

@@ -20,22 +20,54 @@
* THE SOFTWARE.
*/
/*
* In order to open the guacamole menu, we need to hit ctrl-alt-shift. There are
* several possible keysysms for each key.
*/
var SHIFT_KEYS = {0xFFE1 : true, 0xFFE2: true},
ALT_KEYS = {0xFFE9 : true, 0xFFEA : true, 0xFE03: true},
CTRL_KEYS = {0xFFE3 : true, 0xFFE4: true},
MENU_KEYS = angular.extend({}, SHIFT_KEYS, ALT_KEYS, CTRL_KEYS);
/**
* The controller for the page used to connect to a connection or balancing group.
*/
angular.module('home').controller('clientController', ['$scope', '$routeParams', 'localStorageUtility', '$injector',
function clientController($scope, $routeParams, localStorageUtility, $injector) {
/*
* In order to open the guacamole menu, we need to hit ctrl-alt-shift. There are
* several possible keysysms for each key.
*/
var SHIFT_KEYS = {0xFFE1 : true, 0xFFE2: true},
ALT_KEYS = {0xFFE9 : true, 0xFFEA : true, 0xFE03: true},
CTRL_KEYS = {0xFFE3 : true, 0xFFE4: true},
MENU_KEYS = angular.extend({}, SHIFT_KEYS, ALT_KEYS, CTRL_KEYS);
/**
* All client error codes handled and passed off for translation. Any error
* code not present in this list will be represented by the "DEFAULT"
* translation.
*/
var CLIENT_ERRORS = {
0x0201: true,
0x0202: true,
0x0203: true,
0x0205: true,
0x0301: true,
0x0303: true,
0x0308: true,
0x031D: true
};
/**
* All tunnel error codes handled and passed off for translation. Any error
* code not present in this list will be represented by the "DEFAULT"
* translation.
*/
var TUNNEL_ERRORS = {
0x0201: true,
0x0202: true,
0x0203: true,
0x0204: true,
0x0205: true,
0x0301: true,
0x0303: true,
0x0308: true,
0x031D: true
};
// Get DAO for reading connections and groups
var connectionGroupDAO = $injector.get('connectionGroupDAO');
var connectionDAO = $injector.get('connectionDAO');
@@ -148,8 +180,8 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
delete keysCurrentlyPressed[keysym];
});
// Show status dialog when status changes
$scope.$on('guacClientStatusChange', function clientStatusChangeListener(event, client, status) {
// Show status dialog when client status changes
$scope.$on('guacClientStateChange', function clientStateChangeListener(event, client, status) {
// Hide previous status, if any
statusModal.deactivate();
@@ -157,12 +189,65 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
// Show new status if not yet connected
if (status !== "connected") {
statusModal.activate({
text: "client.status." + status
title: "client.status.connectingStatusTitle",
text: "client.status.clientStates." + status
});
}
});
// Show status dialog when client errors occur
$scope.$on('guacClientError', function clientErrorListener(event, client, status, reconnect) {
// Hide any existing status
statusModal.deactivate();
// Determine translation name of error
var errorName = (status in CLIENT_ERRORS) ? status.toString(16) : "DEFAULT";
// Show error status
statusModal.activate({
className: "error",
title: "client.error.connectionErrorTitle",
text: "client.error.clientErrors." + errorName
});
});
// Show status dialog when tunnel status changes
$scope.$on('guacTunnelStateChange', function tunnelStateChangeListener(event, client, status) {
// Hide previous status, if any
statusModal.deactivate();
// Show new status only if disconnected
if (status === "closed") {
statusModal.activate({
title: "client.status.closedStatusTitle",
text: "client.status.tunnelStates." + status
});
}
});
// Show status dialog when tunnel errors occur
$scope.$on('guacTunnelError', function tunnelErrorListener(event, client, status, reconnect) {
// Hide any existing status
statusModal.deactivate();
// Determine translation name of error
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16) : "DEFAULT";
// Show error status
statusModal.activate({
className: "error",
title: "client.error.connectionErrorTitle",
text: "client.error.tunnelErrors." + errorName
});
});
$scope.formattedScale = function formattedScale() {
return Math.round($scope.clientProperties.scale * 100);
};

View File

@@ -231,21 +231,40 @@
"reconnect" : "Reconnect",
"connectionErrorTitle" : "Connection Error",
"clientErrors" : {
"0x0201" : "This connection has been closed because the server is busy. Please wait a few minutes and try again.",
"0x0202" : "The Guacamole server has closed the connection because the remote desktop is taking too long to respond. Please try again or contact your system administrator.",
"0x0203" : "The remote desktop server encountered an error and has closed the connection. Please try again or contact your system administrator.",
"0x0205" : "This connection has been closed because it conflicts with another connection. Please try again later.",
"0x0301" : "Log in failed. Please reconnect and try again.",
"0x0303" : "You do not have permission to access this connection. If you require access, please ask your system administrator to add you the list of allowed users, or check your system settings.",
"0x0308" : "The Guacamole server has closed the connection because there has been no response from your browser for long enough that it appeared to be disconnected. This is commonly caused by network problems, such as spotty wireless signal, or simply very slow network speeds. Please check your network and try again.",
"0x031D" : "The Guacamole server is denying access to this connection because you have exhausted the limit for simultaneous connection use by an individual user. Please close one or more connections and try again.",
"201" : "This connection has been closed because the server is busy. Please wait a few minutes and try again.",
"202" : "The Guacamole server has closed the connection because the remote desktop is taking too long to respond. Please try again or contact your system administrator.",
"203" : "The remote desktop server encountered an error and has closed the connection. Please try again or contact your system administrator.",
"205" : "This connection has been closed because it conflicts with another connection. Please try again later.",
"301" : "Log in failed. Please reconnect and try again.",
"303" : "You do not have permission to access this connection. If you require access, please ask your system administrator to add you the list of allowed users, or check your system settings.",
"308" : "The Guacamole server has closed the connection because there has been no response from your browser for long enough that it appeared to be disconnected. This is commonly caused by network problems, such as spotty wireless signal, or simply very slow network speeds. Please check your network and try again.",
"31D" : "The Guacamole server is denying access to this connection because you have exhausted the limit for simultaneous connection use by an individual user. Please close one or more connections and try again.",
"DEFAULT" : "An internal error has occurred within the Guacamole server, and the connection has been terminated. If the problem persists, please notify your system administrator, or check your system logs."
},
"tunnelErrors" : {
"201" : "The Guacamole server has rejected this connection attempt because there are too many active connections. Please wait a few minutes and try again.",
"202" : "The connection has been closed because the server is taking too long to respond. This is usually caused by network problems, such as a spotty wireless signal, or slow network speeds. Please check your network connection and try again or contact your system administrator.",
"203" : "The server encountered an error and has closed the connection. Please try again or contact your system administrator.",
"204" : "The requested connection does not exist. Please check the connection name and try again.",
"205" : "This connection is currently in use, and concurrent access to this connection is not allowed. Please try again later.",
"301" : "You do not have permission to access this connection because you are not logged in. Please log in and try again.",
"303" : "You do not have permission to access this connection. If you require access, please ask your system administrator to add you the list of allowed users, or check your system settings.",
"308" : "The Guacamole server has closed the connection because there has been no response from your browser for long enough that it appeared to be disconnected. This is commonly caused by network problems, such as spotty wireless signal, or simply very slow network speeds. Please check your network and try again.",
"31D" : "The Guacamole server is denying access to this connection because you have exhausted the limit for simultaneous connection use by an individual user. Please close one or more connections and try again.",
"DEFAULT" : "An internal error has occurred within the Guacamole server, and the connection has been terminated. If the problem persists, please notify your system administrator, or check your system logs."
}
},
"status" : {
"idle" : "Idle.",
"connecting" : "Connecting to Guacamole...",
"waiting" : "Connected to Guacamole. Waiting for response..."
"connectingStatusTitle" : "Connecting",
"closedStatusTitle" : "Disconnected",
"clientStates" : {
"idle" : "Idle.",
"connecting" : "Connecting to Guacamole...",
"waiting" : "Connected to Guacamole. Waiting for response..."
},
"tunnelStates" : {
"closed" : "You have been disconnected. Reload the page to reconnect."
}
}
}
}