Merge pull request #3281 from ssilvert/delte-multiple-users-updated
KEYCLOAK-3633: Unable to delete multiple users without re-entering search
This commit is contained in:
commit
90b5ad5bb3
3 changed files with 25 additions and 11 deletions
|
@ -240,14 +240,15 @@ module.controller('UserOfflineSessionsCtrl', function($scope, $location, realm,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
module.controller('UserListCtrl', function($scope, realm, User, UserImpersonation, BruteForce, Notifications, $route, Dialog) {
|
module.controller('UserListCtrl', function($scope, realm, User, UserSearchState, UserImpersonation, BruteForce, Notifications, $route, Dialog) {
|
||||||
$scope.realm = realm;
|
|
||||||
$scope.page = 0;
|
|
||||||
|
|
||||||
$scope.query = {
|
$scope.init = function() {
|
||||||
realm: realm.realm,
|
$scope.realm = realm;
|
||||||
max : 20,
|
|
||||||
first : 0
|
UserSearchState.query.realm = realm.realm;
|
||||||
|
$scope.query = UserSearchState.query;
|
||||||
|
|
||||||
|
if (!UserSearchState.isFirstSearch) $scope.searchQuery();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.impersonate = function(userId) {
|
$scope.impersonate = function(userId) {
|
||||||
|
@ -292,6 +293,7 @@ module.controller('UserListCtrl', function($scope, realm, User, UserImpersonatio
|
||||||
$scope.users = User.query($scope.query, function() {
|
$scope.users = User.query($scope.query, function() {
|
||||||
$scope.searchLoaded = true;
|
$scope.searchLoaded = true;
|
||||||
$scope.lastSearch = $scope.query.search;
|
$scope.lastSearch = $scope.query.search;
|
||||||
|
UserSearchState.isFirstSearch = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,6 +304,11 @@ module.controller('UserListCtrl', function($scope, realm, User, UserImpersonatio
|
||||||
userId : user.id
|
userId : user.id
|
||||||
}, function() {
|
}, function() {
|
||||||
$route.reload();
|
$route.reload();
|
||||||
|
|
||||||
|
if ($scope.users.length === 1 && $scope.query.first > 0) {
|
||||||
|
$scope.previousPage();
|
||||||
|
}
|
||||||
|
|
||||||
Notifications.success("The user has been deleted.");
|
Notifications.success("The user has been deleted.");
|
||||||
}, function() {
|
}, function() {
|
||||||
Notifications.error("User couldn't be deleted");
|
Notifications.error("User couldn't be deleted");
|
||||||
|
|
|
@ -346,6 +346,14 @@ module.factory('User', function($resource) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
module.service('UserSearchState', function() {
|
||||||
|
this.isFirstSearch = true;
|
||||||
|
this.query = {
|
||||||
|
max : 20,
|
||||||
|
first : 0
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
module.factory('UserFederationInstances', function($resource) {
|
module.factory('UserFederationInstances', function($resource) {
|
||||||
return $resource(authUrl + '/admin/realms/:realm/user-federation/instances/:instance', {
|
return $resource(authUrl + '/admin/realms/:realm/user-federation/instances/:instance', {
|
||||||
realm : '@realm',
|
realm : '@realm',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
|
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2" ng-init="init()">
|
||||||
<h1>{{:: 'users' | translate}}</h1>
|
<h1>{{:: 'users' | translate}}</h1>
|
||||||
|
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
<th class="w-15">{{:: 'first-name' | translate}}</th>
|
<th class="w-15">{{:: 'first-name' | translate}}</th>
|
||||||
<th colspan="{{access.impersonation == true ? '3' : '2'}}">{{:: 'actions' | translate}}</th>
|
<th colspan="{{access.impersonation == true ? '3' : '2'}}">{{:: 'actions' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tr>
|
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot data-ng-show="users && (users.length >= query.max || query.first > 0)">
|
<tfoot data-ng-show="users && (users.length >= query.max || query.first > 0)">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in a new issue