mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-360: When joining an active connection, retrieve name and protocol from underlying connection.
This commit is contained in:
@@ -40,6 +40,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
var $q = $injector.get('$q');
|
var $q = $injector.get('$q');
|
||||||
var $rootScope = $injector.get('$rootScope');
|
var $rootScope = $injector.get('$rootScope');
|
||||||
var $window = $injector.get('$window');
|
var $window = $injector.get('$window');
|
||||||
|
var activeConnectionService = $injector.get('activeConnectionService');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var connectionService = $injector.get('connectionService');
|
var connectionService = $injector.get('connectionService');
|
||||||
@@ -600,6 +601,29 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
}, requestService.WARN);
|
}, requestService.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If using an active connection, pull corresponding connection, then
|
||||||
|
// pull connection name and protocol information from that
|
||||||
|
else if (clientIdentifier.type === ClientIdentifier.Types.ACTIVE_CONNECTION) {
|
||||||
|
activeConnectionService.getActiveConnection(clientIdentifier.dataSource, clientIdentifier.id)
|
||||||
|
.then(function activeConnectionRetrieved(activeConnection) {
|
||||||
|
|
||||||
|
// Attempt to retrieve connection details only if the
|
||||||
|
// underlying connection is known
|
||||||
|
if (activeConnection.connectionIdentifier) {
|
||||||
|
$q.all({
|
||||||
|
connection : connectionService.getConnection(clientIdentifier.dataSource, activeConnection.connectionIdentifier),
|
||||||
|
protocols : schemaService.getProtocols(clientIdentifier.dataSource)
|
||||||
|
})
|
||||||
|
.then(function dataRetrieved(values) {
|
||||||
|
managedClient.name = managedClient.title = values.connection.name;
|
||||||
|
managedClient.protocol = values.connection.protocol;
|
||||||
|
managedClient.forms = values.protocols[values.connection.protocol].connectionForms;
|
||||||
|
}, requestService.WARN);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, requestService.WARN);
|
||||||
|
}
|
||||||
|
|
||||||
return managedClient;
|
return managedClient;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -29,6 +29,38 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
|||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a request to the REST API to get a single active connection,
|
||||||
|
* returning a promise that provides the corresponding
|
||||||
|
* @link{ActiveConnection} if successful.
|
||||||
|
*
|
||||||
|
* @param {String} dataSource
|
||||||
|
* The identifier of the data source to retrieve the active connection
|
||||||
|
* from.
|
||||||
|
*
|
||||||
|
* @param {String} id
|
||||||
|
* The identifier of the active connection.
|
||||||
|
*
|
||||||
|
* @returns {Promise.<ActiveConnection>}
|
||||||
|
* A promise which will resolve with a @link{ActiveConnection} upon
|
||||||
|
* success.
|
||||||
|
*/
|
||||||
|
service.getActiveConnection = function getActiveConnection(dataSource, id) {
|
||||||
|
|
||||||
|
// Build HTTP parameters set
|
||||||
|
var httpParameters = {
|
||||||
|
token : authenticationService.getCurrentToken()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Retrieve active connection
|
||||||
|
return requestService({
|
||||||
|
method : 'GET',
|
||||||
|
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/activeConnections/' + encodeURIComponent(id),
|
||||||
|
params : httpParameters
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a request to the REST API to get the list of active tunnels,
|
* Makes a request to the REST API to get the list of active tunnels,
|
||||||
* returning a promise that provides a map of @link{ActiveConnection}
|
* returning a promise that provides a map of @link{ActiveConnection}
|
||||||
|
Reference in New Issue
Block a user