From 7b77a92a2d214428ae36bf9b8137c039853dddbb Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Tue, 18 Aug 2020 15:39:32 +0300 Subject: [PATCH] fix(endpoints): load endpoints and tags together (#4230) --- app/portainer/views/home/homeController.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/portainer/views/home/homeController.js b/app/portainer/views/home/homeController.js index d7492a2ef..a3fe0ddcc 100644 --- a/app/portainer/views/home/homeController.js +++ b/app/portainer/views/home/homeController.js @@ -97,20 +97,18 @@ angular $scope.motd = data; }); - getPaginatedEndpoints(0, 100).then((data) => { - const totalCount = data.totalCount; + try { + const [{ totalCount, endpoints }, tags] = await Promise.all([getPaginatedEndpoints(0, 100), TagService.tags()]); + $scope.tags = tags; + $scope.totalCount = totalCount; if (totalCount > 100) { $scope.endpoints = []; } else { - $scope.endpoints = data.endpoints; + $scope.endpoints = endpoints; } - }); - - try { - $scope.tags = await TagService.tags(); - } catch (e) { - Notifications.error('Failed loading tags', e); + } catch (err) { + Notifications.error('Failed loading page data', err); } }