Group apps by domain

This commit is contained in:
Johannes Zellner
2019-03-25 10:42:31 +01:00
parent ac86b7a954
commit 57a41cde9d
3 changed files with 90 additions and 97 deletions

View File

@@ -10,6 +10,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.domains = [];
$scope.usedDomains = [];
$scope.groups = [];
$scope.users = [];
$scope.backupConfig = {};
@@ -657,8 +658,20 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
});
}
function refreshInstalledApps() {
Client.refreshInstalledApps();
var tmp = [];
$scope.installedApps.forEach(function (app) {
if (!tmp.find(function (d) { return d.domain === app.domain; })) tmp.push({ domain: app.domain, apps: [] });
tmp.find(function (d) { return d.domain === app.domain; }).apps.push(app);
});
$scope.usedDomains = tmp;
}
Client.onReady(function () {
Client.refreshInstalledApps(); // refresh the new list immediately when switching from another view (appstore)
refreshInstalledApps(); // refresh the new list immediately when switching from another view (appstore)
$scope.spacesSuffix = $scope.user.username.replace(/\./g, '-');
@@ -669,7 +682,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
if ($scope.user.admin && !$scope.config.managed) getBackupConfig(); // FIXME: detect disabled backups some other way
}
var refreshAppsTimer = $interval(Client.refreshInstalledApps.bind(Client), 5000);
var refreshAppsTimer = $interval(refreshInstalledApps, 5000);
$scope.$on('$destroy', function () {
$interval.cancel(refreshAppsTimer);