GUACAMOLE-221: Retrieve protocol name and parameters from tunnel-based REST API endpoint.

If the protocol name and parameters are retrieved from Connection-
specific endpoints, then the protocol-specific context needed for
Guacamole instructions like "argv" and "required" will only be
available for Connections (not ConnectionGroups or ActiveConnections).
This commit is contained in:
Michael Jumper
2020-11-24 00:47:41 -08:00
parent 1b18c51c74
commit 7e1be61bed

View File

@@ -387,6 +387,15 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
}); });
}; };
// 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 // Update connection state as tunnel state changes
tunnel.onstatechange = function tunnelStateChanged(state) { tunnel.onstatechange = function tunnelStateChanged(state) {
$rootScope.$evalAsync(function updateTunnelState() { $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 using a connection, pull connection name and protocol information
if (clientIdentifier.type === ClientIdentifier.Types.CONNECTION) { if (clientIdentifier.type === ClientIdentifier.Types.CONNECTION) {
$q.all({ connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id)
connection : connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id), .then(function connectionRetrieved(connection) {
protocols : schemaService.getProtocols(clientIdentifier.dataSource) managedClient.name = managedClient.title = connection.name;
})
.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);
} }
@@ -640,14 +644,9 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
// Attempt to retrieve connection details only if the // Attempt to retrieve connection details only if the
// underlying connection is known // underlying connection is known
if (activeConnection.connectionIdentifier) { if (activeConnection.connectionIdentifier) {
$q.all({ connectionService.getConnection(clientIdentifier.dataSource, activeConnection.connectionIdentifier)
connection : connectionService.getConnection(clientIdentifier.dataSource, activeConnection.connectionIdentifier), .then(function connectionRetrieved(connection) {
protocols : schemaService.getProtocols(clientIdentifier.dataSource) managedClient.name = managedClient.title = connection.name;
})
.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);
} }