Fix groups code to use listing API

the listing API now returns the members
This commit is contained in:
Girish Ramakrishnan
2020-08-10 13:59:44 -07:00
parent d4312507e2
commit 59cd6f6e93

View File

@@ -18,7 +18,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
];
$scope.ready = false;
$scope.users = [];
$scope.users = []; // users of current page
$scope.allUsersById = [];
$scope.groups = [];
$scope.groupsById = { };
@@ -37,7 +37,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
{ id: 'owner', name: 'Superadmin', disabled: true }
];
$scope.allUsers = [];
$scope.allUsers = []; // all the users and not just current page, have to load this for group assignment
$scope.userSearchString = '';
$scope.currentPage = 1;
@@ -674,27 +674,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
});
}
function getGroups(callback) {
var groups = [];
Client.getGroups(function (error, results) {
if (error) return console.error(error);
async.eachLimit(results, 20, function (result, iteratorDone) {
Client.getGroup(result.id, function (error, group) {
if (error) return iteratorDone(error);
groups.push(group);
iteratorDone();
});
}, function (error) {
callback(error, groups);
});
});
}
function refreshUsers(showBusy) {
function refreshUsers(showBusy) { // loads users on current page only
if (showBusy) $scope.userRefreshBusy = true;
getUsers(function (error, result) {
@@ -708,7 +688,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
}
function refresh() {
getGroups(function (error, result) {
Client.getGroups(function (error, result) {
if (error) return console.error('Unable to get group listing.', error);
angular.copy(result, $scope.groups);
@@ -746,7 +726,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
refreshUsers();
};
function refreshAllUsers() {
function refreshAllUsers() { // this loads all users on Cloudron, not just current page
Client.getUsers(function (error, results) {
if (error) return console.error(error);