diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js b/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js index 3ae1e77e8..b4a63c61f 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js @@ -27,15 +27,15 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj function manageSessionsController($scope, $injector) { // Required types - var ActiveTunnelWrapper = $injector.get('ActiveTunnelWrapper'); - var ConnectionGroup = $injector.get('ConnectionGroup'); + var ActiveConnectionWrapper = $injector.get('ActiveConnectionWrapper'); + var ConnectionGroup = $injector.get('ConnectionGroup'); // Required services - var authenticationService = $injector.get('authenticationService'); - var connectionGroupService = $injector.get('connectionGroupService'); - var guacNotification = $injector.get('guacNotification'); - var permissionService = $injector.get('permissionService'); - var tunnelService = $injector.get('tunnelService'); + var activeConnectionService = $injector.get('activeConnectionService'); + var authenticationService = $injector.get('authenticationService'); + var connectionGroupService = $injector.get('connectionGroupService'); + var guacNotification = $injector.get('guacNotification'); + var permissionService = $injector.get('permissionService'); /** * The root connection group of the connection group hierarchy. @@ -53,10 +53,10 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj $scope.permissions = null; /** - * The ActiveTunnelWrappers of all active sessions accessible by the current - * user, or null if the tunnels have not yet been loaded. + * The ActiveConnectionWrappers of all active sessions accessible by the + * current user, or null if the active sessions have not yet been loaded. * - * @type ActiveTunnelWrapper[] + * @type ActiveConnectionWrapper[] */ $scope.wrappers = null; @@ -74,9 +74,9 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj $scope.connections = {}; /** - * Map of all currently-selected tunnel wrappers by UUID. + * Map of all currently-selected active connection wrappers by identifier. * - * @type Object. + * @type Object. */ var selectedWrappers = {}; @@ -122,12 +122,12 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj }); // Query active sessions - tunnelService.getActiveTunnels().success(function sessionsRetrieved(tunnels) { + activeConnectionService.getActiveConnections().success(function sessionsRetrieved(activeConnections) { - // Wrap all active tunnels for sake of display + // Wrap all active connections for sake of display $scope.wrappers = []; - for (var tunnelUUID in tunnels) { - $scope.wrappers.push(new ActiveTunnelWrapper(tunnels[tunnelUUID])); + for (var identifier in activeConnections) { + $scope.wrappers.push(new ActiveConnectionWrapper(activeConnections[identifier])); } }); @@ -192,12 +192,12 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj var deleteSessionsImmediately = function deleteSessionsImmediately() { // Perform deletion - tunnelService.deleteActiveTunnels(Object.keys(selectedWrappers)) - .success(function tunnelsDeleted() { + activeConnectionService.deleteActiveConnections(Object.keys(selectedWrappers)) + .success(function activeConnectionsDeleted() { - // Remove deleted tunnels from wrapper array - $scope.wrappers = $scope.wrappers.filter(function tunnelStillExists(wrapper) { - return !(wrapper.tunnel.uuid in selectedWrappers); + // Remove deleted connections from wrapper array + $scope.wrappers = $scope.wrappers.filter(function activeConnectionStillExists(wrapper) { + return !(wrapper.activeConnection.identifier in selectedWrappers); }); // Clear selection @@ -206,7 +206,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj }) // Notify of any errors - .error(function tunnelDeletionFailed(error) { + .error(function activeConnectionDeletionFailed(error) { guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_SESSION.DIALOG_HEADER_ERROR', @@ -239,7 +239,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj $scope.canDeleteSessions = function canDeleteSessions() { // We can delete sessions if at least one is selected - for (var tunnelUUID in selectedWrappers) + for (var identifier in selectedWrappers) return true; return false; @@ -247,20 +247,20 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj }; /** - * Called whenever a tunnel wrapper changes selected status. + * Called whenever an active connection wrapper changes selected status. * - * @param {ActiveTunnelWrapper} wrapper + * @param {ActiveConnectionWrapper} wrapper * The wrapper whose selected status has changed. */ $scope.wrapperSelectionChange = function wrapperSelectionChange(wrapper) { // Add wrapper to map if selected if (wrapper.checked) - selectedWrappers[wrapper.tunnel.uuid] = wrapper; + selectedWrappers[wrapper.activeConnection.identifier] = wrapper; // Otherwise, remove wrapper from map else - delete selectedWrappers[wrapper.tunnel.uuid]; + delete selectedWrappers[wrapper.activeConnection.identifier]; }; diff --git a/guacamole/src/main/webapp/app/manage/templates/manageSessions.html b/guacamole/src/main/webapp/app/manage/templates/manageSessions.html index 741d47ce4..9b5ad2721 100644 --- a/guacamole/src/main/webapp/app/manage/templates/manageSessions.html +++ b/guacamole/src/main/webapp/app/manage/templates/manageSessions.html @@ -52,10 +52,10 @@ THE SOFTWARE. - {{wrapper.tunnel.username}} - {{wrapper.tunnel.startDate | date:'short'}} - {{wrapper.tunnel.remoteHost}} - {{connections[wrapper.tunnel.identifier].name}} + {{wrapper.activeConnection.username}} + {{wrapper.activeConnection.startDate | date:'short'}} + {{wrapper.activeConnection.remoteHost}} + {{connections[wrapper.activeConnection.connectionIdentifier].name}} diff --git a/guacamole/src/main/webapp/app/manage/types/ActiveTunnelWrapper.js b/guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js similarity index 67% rename from guacamole/src/main/webapp/app/manage/types/ActiveTunnelWrapper.js rename to guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js index 88fe5e93b..b15a2929b 100644 --- a/guacamole/src/main/webapp/app/manage/types/ActiveTunnelWrapper.js +++ b/guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js @@ -21,30 +21,30 @@ */ /** - * A service for defining the ActiveTunnelWrapper class. + * A service for defining the ActiveConnectionWrapper class. */ -angular.module('manage').factory('ActiveTunnelWrapper', [ - function defineActiveTunnelWrapper() { +angular.module('manage').factory('ActiveConnectionWrapper', [ + function defineActiveConnectionWrapper() { /** - * Wrapper for ActiveTunnel which adds display-specific + * Wrapper for ActiveConnection which adds display-specific * properties, such as a checked option. * * @constructor - * @param {ActiveTunnel} activeTunnel - * The ActiveTunnel to wrap. + * @param {ActiveConnection} activeConnection + * The ActiveConnection to wrap. */ - var ActiveTunnelWrapper = function ActiveTunnelWrapper(activeTunnel) { + var ActiveConnectionWrapper = function ActiveConnectionWrapper(activeConnection) { /** - * The wrapped ActiveTunnel. + * The wrapped ActiveConnection. * - * @type ActiveTunnel + * @type ActiveConnection */ - this.tunnel = activeTunnel; + this.activeConnection = activeConnection; /** - * A flag indicating that the tunnel has been selected. + * A flag indicating that the active connection has been selected. * * @type Boolean */ @@ -52,6 +52,6 @@ angular.module('manage').factory('ActiveTunnelWrapper', [ }; - return ActiveTunnelWrapper; + return ActiveConnectionWrapper; }]); \ No newline at end of file diff --git a/guacamole/src/main/webapp/app/rest/services/tunnelService.js b/guacamole/src/main/webapp/app/rest/services/activeConnectionService.js similarity index 59% rename from guacamole/src/main/webapp/app/rest/services/tunnelService.js rename to guacamole/src/main/webapp/app/rest/services/activeConnectionService.js index 8ce18d867..f086e3a11 100644 --- a/guacamole/src/main/webapp/app/rest/services/tunnelService.js +++ b/guacamole/src/main/webapp/app/rest/services/activeConnectionService.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Glyptodon LLC + * Copyright (C) 2015 Glyptodon LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -21,23 +21,24 @@ */ /** - * Service for operating on tunnels via the REST API. + * Service for operating on active connections via the REST API. */ -angular.module('rest').factory('tunnelService', ['$http', 'authenticationService', - function tunnelService($http, authenticationService) { +angular.module('rest').factory('activeConnectionService', ['$http', 'authenticationService', + function activeConnectionService($http, authenticationService) { var service = {}; /** * Makes a request to the REST API to get the list of active tunnels, - * returning a promise that provides a map of @link{ActiveTunnel} + * returning a promise that provides a map of @link{ActiveConnection} * objects if successful. * - * @returns {Promise.>} - * A promise which will resolve with a map of @link{ActiveTunnel} - * objects, where each key is the UUID of the corresponding tunnel. + * @returns {Promise.>} + * A promise which will resolve with a map of @link{ActiveConnection} + * objects, where each key is the identifier of the corresponding + * active connection. */ - service.getActiveTunnels = function getActiveTunnels() { + service.getActiveConnections = function getActiveConnections() { // Build HTTP parameters set var httpParameters = { @@ -47,46 +48,46 @@ angular.module('rest').factory('tunnelService', ['$http', 'authenticationService // Retrieve tunnels return $http({ method : 'GET', - url : 'api/tunnels', + url : 'api/activeConnections', params : httpParameters }); }; /** - * Makes a request to the REST API to delete the tunnels having the given - * UUIDs, effectively disconnecting the tunnels, returning a promise that - * can be used for processing the results of the call. + * Makes a request to the REST API to delete the active connections having + * the given identifiers, effectively disconnecting them, returning a + * promise that can be used for processing the results of the call. * - * @param {String[]} uuids - * The UUIDs of the tunnels to delete. + * @param {String[]} identifiers + * The identifiers of the active connections to delete. * * @returns {Promise} * A promise for the HTTP call which will succeed if and only if the * delete operation is successful. */ - service.deleteActiveTunnels = function deleteActiveTunnels(uuids) { + service.deleteActiveConnections = function deleteActiveConnections(identifiers) { // Build HTTP parameters set var httpParameters = { token : authenticationService.getCurrentToken() }; - // Convert provided array of UUIDs to a patch - var tunnelPatch = []; - uuids.forEach(function addTunnelPatch(uuid) { - tunnelPatch.push({ + // Convert provided array of identifiers to a patch + var activeConnectionPatch = []; + identifiers.forEach(function addActiveConnectionPatch(identifier) { + activeConnectionPatch.push({ op : 'remove', - path : '/' + uuid + path : '/' + identifier }); }); - // Perform tunnel deletion via PATCH + // Perform active connection deletion via PATCH return $http({ method : 'PATCH', - url : 'api/tunnels', + url : 'api/activeConnections', params : httpParameters, - data : tunnelPatch + data : activeConnectionPatch }); }; diff --git a/guacamole/src/main/webapp/app/rest/types/ActiveTunnel.js b/guacamole/src/main/webapp/app/rest/types/ActiveConnection.js similarity index 69% rename from guacamole/src/main/webapp/app/rest/types/ActiveTunnel.js rename to guacamole/src/main/webapp/app/rest/types/ActiveConnection.js index 996105a64..b51e26245 100644 --- a/guacamole/src/main/webapp/app/rest/types/ActiveTunnel.js +++ b/guacamole/src/main/webapp/app/rest/types/ActiveConnection.js @@ -21,34 +21,44 @@ */ /** - * Service which defines the ActiveTunnel class. + * Service which defines the ActiveConnection class. */ -angular.module('rest').factory('ActiveTunnel', [function defineActiveTunnel() { +angular.module('rest').factory('ActiveConnection', [function defineActiveConnection() { /** * The object returned by REST API calls when representing the data - * associated with an active tunnel. Each tunnel denotes an active - * connection, uniquely identified by the tunnel UUID. + * associated with an active connection. Each active connection is + * effectively a pairing of a connection and the user currently using it, + * along with other information. * * @constructor - * @param {ActiveTunnel|Object} [template={}] + * @param {ActiveConnection|Object} [template={}] * The object whose properties should be copied within the new - * ActiveTunnel. + * ActiveConnection. */ - var ActiveTunnel = function ActiveTunnel(template) { + var ActiveConnection = function ActiveConnection(template) { // Use empty object by default template = template || {}; /** - * The identifier of the connection associated with this tunnel. - * + * The identifier which uniquely identifies this specific active + * connection. + * * @type String */ this.identifier = template.identifier; /** - * The time that the tunnel began, in seconds since + * The identifier of the connection associated with this active + * connection. + * + * @type String + */ + this.connectionIdentifier = template.connectionIdentifier; + + /** + * The time that the connection began, in seconds since * 1970-01-01 00:00:00 UTC. * * @type Number @@ -56,28 +66,21 @@ angular.module('rest').factory('ActiveTunnel', [function defineActiveTunnel() { this.startDate = template.startDate; /** - * The remote host that initiated the tunnel, if known. + * The remote host that initiated the connection, if known. * * @type String */ this.remoteHost = template.remoteHost; /** - * The username of the user associated with the tunnel. + * The username of the user associated with the connection. * * @type String */ this.username = template.username; - /** - * The UUID which uniquely identifies the tunnel. - * - * @type String - */ - this.uuid = template.uuid; - }; - return ActiveTunnel; + return ActiveConnection; }]); \ No newline at end of file