1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Merge pull request #2660 from leigh-johnson/2591

Update org card counts on user/admin association/disassociation
This commit is contained in:
Leigh Johnson 2016-06-27 16:31:14 -04:00 committed by GitHub
commit b126d0a529
4 changed files with 16 additions and 3 deletions

View File

@ -67,6 +67,7 @@ export default ['$scope', '$rootScope', 'ProcessErrors', 'UserList', 'generateLi
Wait('stop');
$scope.$parent.search('user');
$scope.closeModal();
$scope.$parent.$emit('ReloadOrgListView');
}, function (error) {
Wait('stop');
$rootScope.$broadcast("refreshList", listToClose);

View File

@ -40,7 +40,7 @@ export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state', 'generat
list.listTitle = listTitle;
list.basePath = url;
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
$scope.orgRelatedUrls = data.related;
generator.inject(list, { mode: 'edit', scope: $scope, cancelButton: true });
@ -78,6 +78,7 @@ export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state', 'generat
disassociate: true
}).success(function () {
$scope.search(list.iterator);
$scope.$emit('ReloadOrgListView');
})
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',

View File

@ -77,6 +77,7 @@
disassociate: true
}).success(function () {
$scope.search(list.iterator);
$scope.$emit('ReloadOrgListView');
})
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',

View File

@ -8,12 +8,12 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
'$log', '$compile', 'Rest', 'PaginateInit',
'SearchInit', 'OrganizationList', 'Alert', 'Prompt', 'ClearScope',
'ProcessErrors', 'GetBasePath', 'Wait',
'$state', 'generateList',
'$state', 'generateList', 'Refresh',
function($stateParams, $scope, $rootScope, $location,
$log, $compile, Rest, PaginateInit,
SearchInit, OrganizationList, Alert, Prompt, ClearScope,
ProcessErrors, GetBasePath, Wait,
$state, generateList) {
$state, generateList, Refresh) {
ClearScope();
@ -70,10 +70,20 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
};
$scope.$on("ReloadOrgListView", function() {
var url = GetBasePath('organizations') + '?';
if ($state.$current.self.name === "organizations" ||
$state.$current.self.name === "organizations.add") {
$scope.activeCard = null;
}
if ($scope[list.iterator + 'SearchFilters']){
url = url + _.reduce($scope[list.iterator+'SearchFilters'], (result, filter) => result + '&' + filter.url, '');
}
Refresh({
scope: $scope,
set: list.name,
iterator: list.iterator,
url: url
});
});