mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Merge pull request #260 from glyptodon/fix-location-chooser
GUAC-1334: Fix the horribly-broken location chooser
This commit is contained in:
@@ -62,7 +62,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
*
|
*
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
var dataSource = $routeParams.dataSource;
|
$scope.selectedDataSource = $routeParams.dataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of the original connection from which this connection is
|
* The identifier of the original connection from which this connection is
|
||||||
@@ -186,14 +186,14 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Pull connection attribute schema
|
// Pull connection attribute schema
|
||||||
schemaService.getConnectionAttributes(dataSource)
|
schemaService.getConnectionAttributes($scope.selectedDataSource)
|
||||||
.success(function attributesReceived(attributes) {
|
.success(function attributesReceived(attributes) {
|
||||||
$scope.attributes = attributes;
|
$scope.attributes = attributes;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pull connection group hierarchy
|
// Pull connection group hierarchy
|
||||||
connectionGroupService.getConnectionGroupTree(
|
connectionGroupService.getConnectionGroupTree(
|
||||||
dataSource,
|
$scope.selectedDataSource,
|
||||||
ConnectionGroup.ROOT_IDENTIFIER,
|
ConnectionGroup.ROOT_IDENTIFIER,
|
||||||
[PermissionSet.ObjectPermissionType.ADMINISTER]
|
[PermissionSet.ObjectPermissionType.ADMINISTER]
|
||||||
)
|
)
|
||||||
@@ -202,7 +202,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Query the user's permissions for the current connection
|
// Query the user's permissions for the current connection
|
||||||
permissionService.getPermissions(dataSource, authenticationService.getCurrentUsername())
|
permissionService.getPermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
||||||
.success(function permissionsReceived(permissions) {
|
.success(function permissionsReceived(permissions) {
|
||||||
|
|
||||||
$scope.permissions = permissions;
|
$scope.permissions = permissions;
|
||||||
@@ -232,7 +232,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Get protocol metadata
|
// Get protocol metadata
|
||||||
schemaService.getProtocols(dataSource)
|
schemaService.getProtocols($scope.selectedDataSource)
|
||||||
.success(function protocolsReceived(protocols) {
|
.success(function protocolsReceived(protocols) {
|
||||||
$scope.protocols = protocols;
|
$scope.protocols = protocols;
|
||||||
});
|
});
|
||||||
@@ -246,13 +246,13 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
if (identifier) {
|
if (identifier) {
|
||||||
|
|
||||||
// Pull data from existing connection
|
// Pull data from existing connection
|
||||||
connectionService.getConnection(dataSource, identifier)
|
connectionService.getConnection($scope.selectedDataSource, identifier)
|
||||||
.success(function connectionRetrieved(connection) {
|
.success(function connectionRetrieved(connection) {
|
||||||
$scope.connection = connection;
|
$scope.connection = connection;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pull connection history
|
// Pull connection history
|
||||||
connectionService.getConnectionHistory(dataSource, identifier)
|
connectionService.getConnectionHistory($scope.selectedDataSource, identifier)
|
||||||
.success(function historyReceived(historyEntries) {
|
.success(function historyReceived(historyEntries) {
|
||||||
|
|
||||||
// Wrap all history entries for sake of display
|
// Wrap all history entries for sake of display
|
||||||
@@ -264,7 +264,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Pull connection parameters
|
// Pull connection parameters
|
||||||
connectionService.getConnectionParameters(dataSource, identifier)
|
connectionService.getConnectionParameters($scope.selectedDataSource, identifier)
|
||||||
.success(function parametersReceived(parameters) {
|
.success(function parametersReceived(parameters) {
|
||||||
$scope.parameters = parameters;
|
$scope.parameters = parameters;
|
||||||
});
|
});
|
||||||
@@ -274,7 +274,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
else if (cloneSourceIdentifier) {
|
else if (cloneSourceIdentifier) {
|
||||||
|
|
||||||
// Pull data from cloned connection
|
// Pull data from cloned connection
|
||||||
connectionService.getConnection(dataSource, cloneSourceIdentifier)
|
connectionService.getConnection($scope.selectedDataSource, cloneSourceIdentifier)
|
||||||
.success(function connectionRetrieved(connection) {
|
.success(function connectionRetrieved(connection) {
|
||||||
$scope.connection = connection;
|
$scope.connection = connection;
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
$scope.historyEntryWrappers = [];
|
$scope.historyEntryWrappers = [];
|
||||||
|
|
||||||
// Pull connection parameters from cloned connection
|
// Pull connection parameters from cloned connection
|
||||||
connectionService.getConnectionParameters(dataSource, cloneSourceIdentifier)
|
connectionService.getConnectionParameters($scope.selectedDataSource, cloneSourceIdentifier)
|
||||||
.success(function parametersReceived(parameters) {
|
.success(function parametersReceived(parameters) {
|
||||||
$scope.parameters = parameters;
|
$scope.parameters = parameters;
|
||||||
});
|
});
|
||||||
@@ -350,7 +350,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
* Cancels all pending edits, returning to the management page.
|
* Cancels all pending edits, returning to the management page.
|
||||||
*/
|
*/
|
||||||
$scope.cancel = function cancel() {
|
$scope.cancel = function cancel() {
|
||||||
$location.path('/settings/' + encodeURIComponent(dataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -358,7 +358,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
* which is prepopulated with the data from the connection currently being edited.
|
* which is prepopulated with the data from the connection currently being edited.
|
||||||
*/
|
*/
|
||||||
$scope.cloneConnection = function cloneConnection() {
|
$scope.cloneConnection = function cloneConnection() {
|
||||||
$location.path('/manage/' + encodeURIComponent(dataSource) + '/connections').search('clone', identifier);
|
$location.path('/manage/' + encodeURIComponent($scope.selectedDataSource) + '/connections').search('clone', identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -370,9 +370,9 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
$scope.connection.parameters = $scope.parameters;
|
$scope.connection.parameters = $scope.parameters;
|
||||||
|
|
||||||
// Save the connection
|
// Save the connection
|
||||||
connectionService.saveConnection(dataSource, $scope.connection)
|
connectionService.saveConnection($scope.selectedDataSource, $scope.connection)
|
||||||
.success(function savedConnection() {
|
.success(function savedConnection() {
|
||||||
$location.path('/settings/' + encodeURIComponent(dataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
})
|
||||||
|
|
||||||
// Notify of any errors
|
// Notify of any errors
|
||||||
@@ -420,9 +420,9 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
var deleteConnectionImmediately = function deleteConnectionImmediately() {
|
var deleteConnectionImmediately = function deleteConnectionImmediately() {
|
||||||
|
|
||||||
// Delete the connection
|
// Delete the connection
|
||||||
connectionService.deleteConnection(dataSource, $scope.connection)
|
connectionService.deleteConnection($scope.selectedDataSource, $scope.connection)
|
||||||
.success(function deletedConnection() {
|
.success(function deletedConnection() {
|
||||||
$location.path('/settings/' + encodeURIComponent(dataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
})
|
||||||
|
|
||||||
// Notify of any errors
|
// Notify of any errors
|
||||||
|
@@ -57,7 +57,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
*
|
*
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
var dataSource = $routeParams.dataSource;
|
$scope.selectedDataSource = $routeParams.dataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of the connection group being edited. If a new connection
|
* The identifier of the connection group being edited. If a new connection
|
||||||
@@ -131,13 +131,13 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Pull connection group attribute schema
|
// Pull connection group attribute schema
|
||||||
schemaService.getConnectionGroupAttributes(dataSource)
|
schemaService.getConnectionGroupAttributes($scope.selectedDataSource)
|
||||||
.success(function attributesReceived(attributes) {
|
.success(function attributesReceived(attributes) {
|
||||||
$scope.attributes = attributes;
|
$scope.attributes = attributes;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Query the user's permissions for the current connection group
|
// Query the user's permissions for the current connection group
|
||||||
permissionService.getPermissions(dataSource, authenticationService.getCurrentUsername())
|
permissionService.getPermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
||||||
.success(function permissionsReceived(permissions) {
|
.success(function permissionsReceived(permissions) {
|
||||||
|
|
||||||
$scope.permissions = permissions;
|
$scope.permissions = permissions;
|
||||||
@@ -160,7 +160,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
|
|
||||||
// Pull connection group hierarchy
|
// Pull connection group hierarchy
|
||||||
connectionGroupService.getConnectionGroupTree(
|
connectionGroupService.getConnectionGroupTree(
|
||||||
dataSource,
|
$scope.selectedDataSource,
|
||||||
ConnectionGroup.ROOT_IDENTIFIER,
|
ConnectionGroup.ROOT_IDENTIFIER,
|
||||||
[PermissionSet.ObjectPermissionType.ADMINISTER]
|
[PermissionSet.ObjectPermissionType.ADMINISTER]
|
||||||
)
|
)
|
||||||
@@ -170,7 +170,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
|
|
||||||
// If we are editing an existing connection group, pull its data
|
// If we are editing an existing connection group, pull its data
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
connectionGroupService.getConnectionGroup(dataSource, identifier)
|
connectionGroupService.getConnectionGroup($scope.selectedDataSource, identifier)
|
||||||
.success(function connectionGroupReceived(connectionGroup) {
|
.success(function connectionGroupReceived(connectionGroup) {
|
||||||
$scope.connectionGroup = connectionGroup;
|
$scope.connectionGroup = connectionGroup;
|
||||||
});
|
});
|
||||||
@@ -201,7 +201,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
* Cancels all pending edits, returning to the management page.
|
* Cancels all pending edits, returning to the management page.
|
||||||
*/
|
*/
|
||||||
$scope.cancel = function cancel() {
|
$scope.cancel = function cancel() {
|
||||||
$location.path('/settings/' + encodeURIComponent(dataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -211,9 +211,9 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
$scope.saveConnectionGroup = function saveConnectionGroup() {
|
$scope.saveConnectionGroup = function saveConnectionGroup() {
|
||||||
|
|
||||||
// Save the connection
|
// Save the connection
|
||||||
connectionGroupService.saveConnectionGroup(dataSource, $scope.connectionGroup)
|
connectionGroupService.saveConnectionGroup($scope.selectedDataSource, $scope.connectionGroup)
|
||||||
.success(function savedConnectionGroup() {
|
.success(function savedConnectionGroup() {
|
||||||
$location.path('/settings/' + encodeURIComponent(dataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
})
|
||||||
|
|
||||||
// Notify of any errors
|
// Notify of any errors
|
||||||
@@ -261,9 +261,9 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
var deleteConnectionGroupImmediately = function deleteConnectionGroupImmediately() {
|
var deleteConnectionGroupImmediately = function deleteConnectionGroupImmediately() {
|
||||||
|
|
||||||
// Delete the connection group
|
// Delete the connection group
|
||||||
connectionGroupService.deleteConnectionGroup(dataSource, $scope.connectionGroup)
|
connectionGroupService.deleteConnectionGroup($scope.selectedDataSource, $scope.connectionGroup)
|
||||||
.success(function deletedConnectionGroup() {
|
.success(function deletedConnectionGroup() {
|
||||||
$location.path('/settings/' + encodeURIComponent(dataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
})
|
||||||
|
|
||||||
// Notify of any errors
|
// Notify of any errors
|
||||||
|
@@ -33,6 +33,14 @@ angular.module('manage').directive('locationChooser', [function locationChooser(
|
|||||||
|
|
||||||
scope: {
|
scope: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the data source from which the given root
|
||||||
|
* connection group was retrieved.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
dataSource : '=',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root connection group of the connection group hierarchy to
|
* The root connection group of the connection group hierarchy to
|
||||||
* display.
|
* display.
|
||||||
@@ -105,6 +113,19 @@ angular.module('manage').directive('locationChooser', [function locationChooser(
|
|||||||
$scope.menuOpen = !$scope.menuOpen;
|
$scope.menuOpen = !$scope.menuOpen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Update the root group map when data source or root group change
|
||||||
|
$scope.$watchGroup(['dataSource', 'rootGroup'], function updateRootGroups() {
|
||||||
|
|
||||||
|
// Abort if the root group is not set
|
||||||
|
if (!$scope.dataSource || !$scope.rootGroup)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// Wrap root group in map
|
||||||
|
$scope.rootGroups = {};
|
||||||
|
$scope.rootGroups[$scope.dataSource] = $scope.rootGroup;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Expose selection function to group list template
|
// Expose selection function to group list template
|
||||||
$scope.groupListContext = {
|
$scope.groupListContext = {
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
<guac-group-list
|
<guac-group-list
|
||||||
context="groupListContext"
|
context="groupListContext"
|
||||||
show-root-group="true"
|
show-root-group="true"
|
||||||
connection-group="rootGroup"
|
connection-groups="rootGroups"
|
||||||
connection-group-template="'app/manage/templates/locationChooserConnectionGroup.html'"/>
|
connection-group-template="'app/manage/templates/locationChooserConnectionGroup.html'"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -42,7 +42,9 @@ THE SOFTWARE.
|
|||||||
<th>{{'MANAGE_CONNECTION.FIELD_HEADER_LOCATION' | translate}}</th>
|
<th>{{'MANAGE_CONNECTION.FIELD_HEADER_LOCATION' | translate}}</th>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<location-chooser value="connection.parentIdentifier" root-group="rootGroup"></location-chooser>
|
<location-chooser
|
||||||
|
data-data-source="selectedDataSource" root-group="rootGroup"
|
||||||
|
value="connection.parentIdentifier"></location-chooser>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@@ -42,7 +42,9 @@ THE SOFTWARE.
|
|||||||
<th>{{'MANAGE_CONNECTION_GROUP.FIELD_HEADER_LOCATION' | translate}}</th>
|
<th>{{'MANAGE_CONNECTION_GROUP.FIELD_HEADER_LOCATION' | translate}}</th>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<location-chooser value="connectionGroup.parentIdentifier" root-group="rootGroup"/>
|
<location-chooser
|
||||||
|
data-data-source="selectedDataSource" root-group="rootGroup"
|
||||||
|
value="connectionGroup.parentIdentifier"></location-chooser>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user