Fetch groups in appstore.js

This commit is contained in:
Johannes Zellner
2016-02-26 11:24:01 +01:00
parent 74da8f5af8
commit c630de1003

View File

@@ -6,6 +6,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.users = [];
$scope.groups = [];
$scope.category = '';
$scope.cachedCategory = ''; // used to cache the selected category while searching
$scope.searchString = '';
@@ -338,6 +339,17 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
});
}
function fetchGroups() {
Client.getGroups(function (error, groups) {
if (error) {
console.error(error);
return $timeout(fetchUsers, 5000);
}
$scope.groups = groups;
});
}
(function refresh() {
$scope.ready = false;
@@ -352,7 +364,10 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
// show install app dialog immediately if an app id was passed in the query
hashChangeListener();
if ($scope.user.admin) fetchUsers();
if ($scope.user.admin) {
fetchUsers();
fetchGroups();
}
$scope.ready = true;
});