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
$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.

View File

@@ -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"),
});
});
}
]

View File

@@ -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