diff --git a/src/views/apps.js b/src/views/apps.js index a09db534f..d9445af8c 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -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; }); });