Fetch appstore listing as soon as possible

This commit is contained in:
Johannes Zellner
2021-09-23 00:33:40 +02:00
parent 74045b7de1
commit 195c5ab21a
2 changed files with 44 additions and 34 deletions
+24 -32
View File
@@ -386,31 +386,27 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran
};
function onSubscribed(callback) {
Client.getAppstoreApps(function (error) {
// start with all apps listing. this also sets $scope.apps accordingly
$scope.showCategory('');
// do this in background
Client.refreshConfig(); // refresh domain, user, group limit etc
fetchUsers();
fetchGroups();
// domains is required since we populate the dropdown with domains[0]
Client.getDomains(function (error, result) {
if (error) return callback(error);
// start with all apps listing. this also sets $scope.apps accordingly
$scope.showCategory('');
$scope.domains = result;
// do this in background
Client.refreshConfig(); // refresh domain, user, group limit etc
fetchUsers();
fetchGroups();
// show install app dialog immediately if an app id was passed in the query
// hashChangeListener calls $apply, so make sure we don't double digest here
setTimeout(hashChangeListener, 1);
// domains is required since we populate the dropdown with domains[0]
Client.getDomains(function (error, result) {
if (error) return callback(error);
setTimeout(function () { $('#appstoreSearch').focus(); }, 1);
$scope.domains = result;
// show install app dialog immediately if an app id was passed in the query
// hashChangeListener calls $apply, so make sure we don't double digest here
setTimeout(hashChangeListener, 1);
setTimeout(function () { $('#appstoreSearch').focus(); }, 1);
callback();
});
callback();
});
}
@@ -605,16 +601,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran
});
}
function getMemory(callback) {
Client.memory(function (error, memory) {
if (error) console.error(error);
$scope.memory = memory;
callback();
});
}
function init() {
$scope.ready = false;
@@ -637,9 +623,15 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran
});
}
// fetch early
Client.onReady(function () { Client.getAppstoreApps(function () {}); });
Client.onReady(init);
Client.onReady(function () {
getMemory(function () {
init();
Client.memory(function (error, memory) {
if (error) console.error(error);
$scope.memory = memory;
});
});