From 0cc640403aa57720445faecba6b02c5e23d3ad9c Mon Sep 17 00:00:00 2001 From: beeankha Date: Wed, 10 Apr 2019 15:28:44 -0400 Subject: [PATCH] Resolve initial login error --- awx/ui/client/src/app.js | 4 ++++ awx/ui/client/src/home/home.route.js | 10 ++++++---- awx/ui/client/src/shared/api-loader.js | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index cfa5ccddd1..65d08e16dd 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -411,6 +411,10 @@ angular // create a promise that will resolve state $AnsibleConfig is loaded $rootScope.loginConfig = $q.defer(); } + if (!$rootScope.basePathsLoaded) { + // create a promise that will resolve when base paths are loaded + $rootScope.basePathsLoaded = $q.defer(); + } $rootScope.licenseMissing = true; //the authorization controller redirects to the home page automatcially if there is no last path defined. in order to override // this, set the last path to /portal for instances where portal is visited for the first time. diff --git a/awx/ui/client/src/home/home.route.js b/awx/ui/client/src/home/home.route.js index ef8b88220c..ffc9d2681a 100644 --- a/awx/ui/client/src/home/home.route.js +++ b/awx/ui/client/src/home/home.route.js @@ -21,10 +21,12 @@ export default { label: N_("DASHBOARD") }, resolve: { - graphData: ['$q', 'jobStatusGraphData', - function($q, jobStatusGraphData) { - return $q.all({ - jobStatus: jobStatusGraphData.get("month", "all"), + graphData: ['$q', 'jobStatusGraphData', '$rootScope', + function($q, jobStatusGraphData, $rootScope) { + return $rootScope.basePathsLoaded.promise.then(function() { + return $q.all({ + jobStatus: jobStatusGraphData.get("month", "all"), + }); }); } ] diff --git a/awx/ui/client/src/shared/api-loader.js b/awx/ui/client/src/shared/api-loader.js index 56f8bb6d9a..fae88aeb77 100644 --- a/awx/ui/client/src/shared/api-loader.js +++ b/awx/ui/client/src/shared/api-loader.js @@ -36,11 +36,17 @@ angular.module('ApiLoader', ['Utilities']) data.base = base; $rootScope.defaultUrls = data; Store('api', data); + if($rootScope.basePathsLoaded){ + $rootScope.basePathsLoaded.resolve(); + } }) .catch(({data, status}) => { $rootScope.defaultUrls = { status: 'error' }; + if($rootScope.basePathsLoaded){ + $rootScope.basePathsLoaded.reject(); + } ProcessErrors(null, data, status, null, { hdr: 'Error', msg: 'Failed to read ' + base + '. GET status: ' + status