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
4 changed files with 16 additions and 3 deletions

View File

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

View File

@@ -78,6 +78,7 @@ export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state', 'generat
disassociate: true disassociate: true
}).success(function () { }).success(function () {
$scope.search(list.iterator); $scope.search(list.iterator);
$scope.$emit('ReloadOrgListView');
}) })
.error(function (data, status) { .error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', ProcessErrors($scope, data, status, null, { hdr: 'Error!',

View File

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

View File

@@ -8,12 +8,12 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
'$log', '$compile', 'Rest', 'PaginateInit', '$log', '$compile', 'Rest', 'PaginateInit',
'SearchInit', 'OrganizationList', 'Alert', 'Prompt', 'ClearScope', 'SearchInit', 'OrganizationList', 'Alert', 'Prompt', 'ClearScope',
'ProcessErrors', 'GetBasePath', 'Wait', 'ProcessErrors', 'GetBasePath', 'Wait',
'$state', 'generateList', '$state', 'generateList', 'Refresh',
function($stateParams, $scope, $rootScope, $location, function($stateParams, $scope, $rootScope, $location,
$log, $compile, Rest, PaginateInit, $log, $compile, Rest, PaginateInit,
SearchInit, OrganizationList, Alert, Prompt, ClearScope, SearchInit, OrganizationList, Alert, Prompt, ClearScope,
ProcessErrors, GetBasePath, Wait, ProcessErrors, GetBasePath, Wait,
$state, generateList) { $state, generateList, Refresh) {
ClearScope(); ClearScope();
@@ -70,10 +70,20 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
}; };
$scope.$on("ReloadOrgListView", function() { $scope.$on("ReloadOrgListView", function() {
var url = GetBasePath('organizations') + '?';
if ($state.$current.self.name === "organizations" || if ($state.$current.self.name === "organizations" ||
$state.$current.self.name === "organizations.add") { $state.$current.self.name === "organizations.add") {
$scope.activeCard = null; $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
});
}); });