mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
resolve config with a promise on the login route
This commit is contained in:
parent
688d933df7
commit
e05988ff5d
@ -834,9 +834,9 @@ var tower = angular.module('Tower', [
|
||||
}]);
|
||||
}])
|
||||
|
||||
.run(['$compile', '$cookieStore', '$rootScope', '$log', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer', 'ClearScope', 'HideStream', 'Socket',
|
||||
.run(['$q', '$compile', '$cookieStore', '$rootScope', '$log', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer', 'ClearScope', 'HideStream', 'Socket',
|
||||
'LoadConfig', 'Store', 'ShowSocketHelp', 'AboutAnsibleHelp', 'pendoService',
|
||||
function ($compile, $cookieStore, $rootScope, $log, CheckLicense, $location, Authorization, LoadBasePaths, Timer, ClearScope, HideStream, Socket,
|
||||
function ($q, $compile, $cookieStore, $rootScope, $log, CheckLicense, $location, Authorization, LoadBasePaths, Timer, ClearScope, HideStream, Socket,
|
||||
LoadConfig, Store, ShowSocketHelp, AboutAnsibleHelp, pendoService) {
|
||||
|
||||
|
||||
@ -1063,8 +1063,8 @@ var tower = angular.module('Tower', [
|
||||
|
||||
|
||||
if (!$AnsibleConfig) {
|
||||
// there may be time lag when loading the config file, so temporarily use what's in local storage
|
||||
$AnsibleConfig = Store('AnsibleConfig');
|
||||
// create a promise that will resolve when $AnsibleConfig is loaded
|
||||
$rootScope.loginConfig = $q.defer();
|
||||
}
|
||||
|
||||
//the authorization controller redirects to the home page automatcially if there is no last path defined. in order to override
|
||||
|
||||
@ -39,16 +39,19 @@ angular.module('LoadConfigHelper', ['Utilities'])
|
||||
if(angular.isObject(response.data)){
|
||||
$AnsibleConfig = _.extend($AnsibleConfig, response.data);
|
||||
Store('AnsibleConfig', $AnsibleConfig);
|
||||
$rootScope.loginConfig.resolve('config loaded');
|
||||
$rootScope.$emit('ConfigReady');
|
||||
}
|
||||
else {
|
||||
$log.info('local_settings.json is not a valid object');
|
||||
$rootScope.loginConfig.resolve('config loaded');
|
||||
$rootScope.$emit('ConfigReady');
|
||||
}
|
||||
|
||||
}, function() {
|
||||
//local_settings.json not found
|
||||
$log.info('local_settings.json not found');
|
||||
$rootScope.loginConfig.resolve('config loaded');
|
||||
$rootScope.$emit('ConfigReady');
|
||||
});
|
||||
});
|
||||
|
||||
@ -111,10 +111,12 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
|
||||
});
|
||||
|
||||
|
||||
scope.customLogo = ($AnsibleConfig.custom_logo) ? "custom_console_logo.png" : "tower_console_logo.png";
|
||||
$rootScope.loginConfig.promise.then(function () {
|
||||
scope.customLogo = ($AnsibleConfig.custom_logo) ? "custom_console_logo.png" : "tower_console_logo.png";
|
||||
|
||||
scope.customLoginInfo = $AnsibleConfig.custom_login_info;
|
||||
scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
|
||||
scope.customLoginInfo = $AnsibleConfig.custom_login_info;
|
||||
scope.customLoginInfoPresent = ($AnsibleConfig.customLoginInfo) ? true : false;
|
||||
});
|
||||
|
||||
// Reset the login form
|
||||
//scope.loginForm.login_username.$setPristine();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user