mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-09 22:51:22 +00:00
Merge 1.1.0 changes to master.
This commit is contained in:
@@ -36,21 +36,22 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
||||
var ManagedShareLink = $injector.get('ManagedShareLink');
|
||||
|
||||
// Required services
|
||||
var $document = $injector.get('$document');
|
||||
var $q = $injector.get('$q');
|
||||
var $rootScope = $injector.get('$rootScope');
|
||||
var $window = $injector.get('$window');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
var connectionGroupService = $injector.get('connectionGroupService');
|
||||
var connectionService = $injector.get('connectionService');
|
||||
var preferenceService = $injector.get('preferenceService');
|
||||
var requestService = $injector.get('requestService');
|
||||
var schemaService = $injector.get('schemaService');
|
||||
var tunnelService = $injector.get('tunnelService');
|
||||
var guacAudio = $injector.get('guacAudio');
|
||||
var guacHistory = $injector.get('guacHistory');
|
||||
var guacImage = $injector.get('guacImage');
|
||||
var guacVideo = $injector.get('guacVideo');
|
||||
var $document = $injector.get('$document');
|
||||
var $q = $injector.get('$q');
|
||||
var $rootScope = $injector.get('$rootScope');
|
||||
var $window = $injector.get('$window');
|
||||
var activeConnectionService = $injector.get('activeConnectionService');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
var connectionGroupService = $injector.get('connectionGroupService');
|
||||
var connectionService = $injector.get('connectionService');
|
||||
var preferenceService = $injector.get('preferenceService');
|
||||
var requestService = $injector.get('requestService');
|
||||
var schemaService = $injector.get('schemaService');
|
||||
var tunnelService = $injector.get('tunnelService');
|
||||
var guacAudio = $injector.get('guacAudio');
|
||||
var guacHistory = $injector.get('guacHistory');
|
||||
var guacImage = $injector.get('guacImage');
|
||||
var guacVideo = $injector.get('guacVideo');
|
||||
|
||||
/**
|
||||
* The minimum amount of time to wait between updates to the client
|
||||
@@ -610,6 +611,29 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
||||
}, 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;
|
||||
|
||||
};
|
||||
|
@@ -89,7 +89,14 @@ angular.module('client').factory('ClientIdentifier', ['$injector',
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
CONNECTION_GROUP : 'g'
|
||||
CONNECTION_GROUP : 'g',
|
||||
|
||||
/**
|
||||
* The type string for an active Guacamole connection.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
ACTIVE_CONNECTION : 'a'
|
||||
|
||||
};
|
||||
|
||||
|
@@ -29,6 +29,38 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
||||
|
||||
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,
|
||||
* returning a promise that provides a map of @link{ActiveConnection}
|
||||
|
@@ -76,6 +76,14 @@ angular.module('rest').factory('ActiveConnection', [function defineActiveConnect
|
||||
*/
|
||||
this.username = template.username;
|
||||
|
||||
/**
|
||||
* Whether this active connection may be connected to, just as a
|
||||
* normal connection.
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
this.connectable = template.connectable;
|
||||
|
||||
};
|
||||
|
||||
return ActiveConnection;
|
||||
|
@@ -35,6 +35,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
||||
|
||||
// Required types
|
||||
var ActiveConnectionWrapper = $injector.get('ActiveConnectionWrapper');
|
||||
var ClientIdentifier = $injector.get('ClientIdentifier');
|
||||
var ConnectionGroup = $injector.get('ConnectionGroup');
|
||||
var SortOrder = $injector.get('SortOrder');
|
||||
|
||||
@@ -336,7 +337,37 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
||||
'actions' : [ DELETE_ACTION, CANCEL_ACTION]
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the relative URL of the client page which accesses the
|
||||
* given active connection. If the active connection is not
|
||||
* connectable, null is returned.
|
||||
*
|
||||
* @param {String} dataSource
|
||||
* The unique identifier of the data source containing the
|
||||
* active connection.
|
||||
*
|
||||
* @param {String} activeConnection
|
||||
* The active connection to determine the relative URL of.
|
||||
*
|
||||
* @returns {String}
|
||||
* The relative URL of the client page which accesses the given
|
||||
* active connection, or null if the active connection is not
|
||||
* connectable.
|
||||
*/
|
||||
$scope.getClientURL = function getClientURL(dataSource, activeConnection) {
|
||||
|
||||
if (!activeConnection.connectable)
|
||||
return null;
|
||||
|
||||
return '#/client/' + encodeURIComponent(ClientIdentifier.toString({
|
||||
dataSource : dataSource,
|
||||
type : ClientIdentifier.Types.ACTIVE_CONNECTION,
|
||||
id : activeConnection.identifier
|
||||
}));
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether the selected sessions can be deleted.
|
||||
*
|
||||
|
@@ -40,7 +40,9 @@
|
||||
<td><guac-user-item username="wrapper.activeConnection.username"></guac-user-item></td>
|
||||
<td>{{wrapper.startDate}}</td>
|
||||
<td>{{wrapper.activeConnection.remoteHost}}</td>
|
||||
<td>{{wrapper.name}}</td>
|
||||
<td><a ng-href="{{
|
||||
getClientURL(wrapper.dataSource, wrapper.activeConnection)
|
||||
}}">{{wrapper.name}}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user