mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 10:10:01 -03:30
Fixed issue with selected users based on user.id rathr than set index. Fixed dataLoad callback not being destroyed after controller routine exits.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
Alert, UserList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
|
||||
ReturnToCaller, ClearScope)
|
||||
ReturnToCaller, ClearScope, ProcessErrors)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@@ -98,17 +98,25 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
});
|
||||
|
||||
if (scope.selected.length > 0 ) {
|
||||
var user;
|
||||
for (var i=0; i < scope.selected.length; i++) {
|
||||
var user = scope.users[scope.selected[i]].username;
|
||||
Rest.post(scope.users[scope.selected[i]])
|
||||
.success( function(data, status, headers, config) {
|
||||
scope.queue.push({ result: 'success', data: data, status: status });
|
||||
scope.$emit('callFinished');
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
|
||||
scope.$emit('callFinished');
|
||||
});
|
||||
user = null;
|
||||
for (var j=0; j < scope.users.length; j++) {
|
||||
if (scope.users[j].id == scope.selected[i]) {
|
||||
user = scope.users[j];
|
||||
}
|
||||
}
|
||||
if (user !== null) {
|
||||
Rest.post(user)
|
||||
.success( function(data, status, headers, config) {
|
||||
scope.queue.push({ result: 'success', data: data, status: status });
|
||||
scope.$emit('callFinished');
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
|
||||
scope.$emit('callFinished');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -127,7 +135,7 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
|
||||
UsersList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'GenerateList',
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope' ];
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors' ];
|
||||
|
||||
|
||||
function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm,
|
||||
@@ -197,7 +205,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
var relatedSets = {};
|
||||
|
||||
// After the Organization is loaded, retrieve each related set
|
||||
scope.$on('dataLoaded', function() {
|
||||
scope.$on('userLoaded', function() {
|
||||
for (var set in relatedSets) {
|
||||
scope.search(relatedSets[set].iterator);
|
||||
}
|
||||
@@ -228,7 +236,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
|
||||
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
|
||||
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
|
||||
scope.$emit('dataLoaded');
|
||||
scope.$emit('userLoaded');
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, form,
|
||||
|
||||
Reference in New Issue
Block a user