Avoid some flickering of apps ui while loading

This commit is contained in:
Johannes Zellner
2020-04-28 15:52:04 +02:00
parent 0757c20d59
commit 704977d5f6

View File

@@ -59,30 +59,31 @@ angular.module('Application').controller('AppsController', ['$scope', '$timeout'
};
Client.onReady(function () {
setTimeout(function () { $('#appSearch').focus(); }, 1);
// refresh the new list immediately when switching from another view (appstore)
Client.refreshInstalledApps(function () {
var refreshAppsTimer = $interval(Client.refreshInstalledApps.bind(Client, function () {}), 5000);
$scope.$on('$destroy', function () {
$interval.cancel(refreshAppsTimer);
});
});
if (!$scope.user.isAtLeastAdmin) return;
if (!$scope.user.isAtLeastAdmin) return;
Client.getDomains(function (error, result) {
if (error) Client.error(error);
// load local settings and apply tag filter
if (localStorage.selectedTags) {
if (!$scope.tags.length) localStorage.removeItem('selectedTags');
else $scope.selectedTags = localStorage.selectedTags.split(',');
}
$scope.domains = result;
$scope.filterDomains = [ALL_DOMAINS_DOMAIN].concat(result);
Client.getDomains(function (error, result) {
if (error) Client.error(error);
// load local settings and apply
if (localStorage.selectedTags) {
if (!$scope.tags.length) localStorage.removeItem('selectedTags');
else $scope.selectedTags = localStorage.selectedTags.split(',');
}
if (localStorage.selectedDomain) $scope.selectedDomain = $scope.filterDomains.find(function (d) { return d.domain === localStorage.selectedDomain; }) || ALL_DOMAINS_DOMAIN;
$scope.domains = result;
$scope.filterDomains = [ALL_DOMAINS_DOMAIN].concat(result);
setTimeout(function () { $('#appSearch').focus(); }, 1000);
});
if (localStorage.selectedDomain) $scope.selectedDomain = $scope.filterDomains.find(function (d) { return d.domain === localStorage.selectedDomain; }) || ALL_DOMAINS_DOMAIN;
});
});