Merge 1.3.0 changes back to master.

This commit is contained in:
Virtually Nick
2020-11-25 18:55:26 -05:00
12 changed files with 297 additions and 165 deletions

View File

@@ -386,7 +386,16 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
status.code);
});
};
// Pull protocol-specific information from tunnel once tunnel UUID is
// known
tunnel.onuuid = function tunnelAssignedUUID(uuid) {
tunnelService.getProtocol(uuid).then(function protocolRetrieved(protocol) {
managedClient.protocol = protocol.name;
managedClient.forms = protocol.connectionForms;
}, requestService.WARN);
};
// Update connection state as tunnel state changes
tunnel.onstatechange = function tunnelStateChanged(state) {
$rootScope.$evalAsync(function updateTunnelState() {
@@ -612,14 +621,9 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
// If using a connection, pull connection name and protocol information
if (clientIdentifier.type === ClientIdentifier.Types.CONNECTION) {
$q.all({
connection : connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id),
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;
connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id)
.then(function connectionRetrieved(connection) {
managedClient.name = managedClient.title = connection.name;
}, requestService.WARN);
}
@@ -640,14 +644,9 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
// 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;
connectionService.getConnection(clientIdentifier.dataSource, activeConnection.connectionIdentifier)
.then(function connectionRetrieved(connection) {
managedClient.name = managedClient.title = connection.name;
}, requestService.WARN);
}

View File

@@ -79,6 +79,36 @@ angular.module('rest').factory('tunnelService', ['$injector',
};
/**
* Makes a request to the REST API to retrieve the underlying protocol of
* the connection associated with a particular tunnel, returning a promise
* that provides a @link{Protocol} object if successful.
*
* @param {String} tunnel
* The UUID of the tunnel associated with the Guacamole connection
* whose underlying protocol is being retrieved.
*
* @returns {Promise.<Protocol>}
* A promise which will resolve with a @link{Protocol} object upon
* success.
*/
service.getProtocol = function getProtocol(tunnel) {
// Build HTTP parameters set
var httpParameters = {
token : authenticationService.getCurrentToken()
};
// Retrieve the protocol details of the specified tunnel
return requestService({
method : 'GET',
url : 'api/session/tunnels/' + encodeURIComponent(tunnel)
+ '/protocol',
params : httpParameters
});
};
/**
* Retrieves the set of sharing profiles that the current user can use to
* share the active connection of the given tunnel.