Resolve initial login error

This commit is contained in:
beeankha
2019-04-10 15:28:44 -04:00
committed by mabashian
parent 85898fd708
commit 0cc640403a
3 changed files with 16 additions and 4 deletions

View File

@@ -411,6 +411,10 @@ angular
// create a promise that will resolve state $AnsibleConfig is loaded // create a promise that will resolve state $AnsibleConfig is loaded
$rootScope.loginConfig = $q.defer(); $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; $rootScope.licenseMissing = true;
//the authorization controller redirects to the home page automatcially if there is no last path defined. in order to override //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. // this, set the last path to /portal for instances where portal is visited for the first time.

View File

@@ -21,10 +21,12 @@ export default {
label: N_("DASHBOARD") label: N_("DASHBOARD")
}, },
resolve: { resolve: {
graphData: ['$q', 'jobStatusGraphData', graphData: ['$q', 'jobStatusGraphData', '$rootScope',
function($q, jobStatusGraphData) { function($q, jobStatusGraphData, $rootScope) {
return $q.all({ return $rootScope.basePathsLoaded.promise.then(function() {
jobStatus: jobStatusGraphData.get("month", "all"), return $q.all({
jobStatus: jobStatusGraphData.get("month", "all"),
});
}); });
} }
] ]

View File

@@ -36,11 +36,17 @@ angular.module('ApiLoader', ['Utilities'])
data.base = base; data.base = base;
$rootScope.defaultUrls = data; $rootScope.defaultUrls = data;
Store('api', data); Store('api', data);
if($rootScope.basePathsLoaded){
$rootScope.basePathsLoaded.resolve();
}
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
$rootScope.defaultUrls = { $rootScope.defaultUrls = {
status: 'error' status: 'error'
}; };
if($rootScope.basePathsLoaded){
$rootScope.basePathsLoaded.reject();
}
ProcessErrors(null, data, status, null, { ProcessErrors(null, data, status, null, {
hdr: 'Error', hdr: 'Error',
msg: 'Failed to read ' + base + '. GET status: ' + status msg: 'Failed to read ' + base + '. GET status: ' + status