GUAC-605: Simplify status modal API.

This commit is contained in:
Michael Jumper
2014-11-16 15:06:19 -08:00
parent 5581fcc382
commit 0bd1fdc16f
3 changed files with 57 additions and 25 deletions

View File

@@ -178,17 +178,18 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
// Show status dialog when client status changes
$scope.$on('guacClientStateChange', function clientStateChangeListener(event, client, status) {
// Hide previous status, if any
statusModal.deactivate();
// Show new status if not yet connected
if (status !== "connected") {
statusModal.activate({
statusModal.showStatus({
title: "client.status.connectingStatusTitle",
text: "client.status.clientStates." + status
});
}
// Hide status upon connecting
else
statusModal.showStatus(false);
});
// Show status dialog when client errors occur
@@ -197,14 +198,11 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
// Disconnect
$scope.id = null;
// 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({
statusModal.showStatus({
className: "error",
title: "client.error.connectionErrorTitle",
text: "client.error.clientErrors." + errorName,
@@ -216,12 +214,9 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
// Show status dialog when tunnel status changes
$scope.$on('guacTunnelStateChange', function tunnelStateChangeListener(event, tunnel, status) {
// Hide previous status, if any
statusModal.deactivate();
// Show new status only if disconnected
if (status === "closed") {
statusModal.activate({
statusModal.showStatus({
title: "client.status.closedStatusTitle",
text: "client.status.tunnelStates." + status
});
@@ -235,14 +230,11 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
// Disconnect
$scope.id = null;
// 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({
statusModal.showStatus({
className: "error",
title: "client.error.connectionErrorTitle",
text: "client.error.tunnelErrors." + errorName,