mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Merge pull request #425 from jaredevantabor/login_cofig
LoadConfig fix to load config.js first and then local_settings.json
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,7 +12,7 @@ awx/public/media
|
|||||||
awx/public/static
|
awx/public/static
|
||||||
awx/ui/tests/test-results.xml
|
awx/ui/tests/test-results.xml
|
||||||
awx/ui/static/js/awx.min.js
|
awx/ui/static/js/awx.min.js
|
||||||
awx/ui/static/js/local_config.js
|
awx/ui/static/js/local_settings.json
|
||||||
awx/ui/static/css/awx.min.css
|
awx/ui/static/css/awx.min.css
|
||||||
awx/main/fixtures
|
awx/main/fixtures
|
||||||
awx/*.log
|
awx/*.log
|
||||||
|
|||||||
@@ -22,42 +22,51 @@
|
|||||||
export default
|
export default
|
||||||
angular.module('LoadConfigHelper', ['Utilities'])
|
angular.module('LoadConfigHelper', ['Utilities'])
|
||||||
|
|
||||||
.factory('LoadConfig', ['$log', '$rootScope', '$http', '$location', 'ProcessErrors', 'Store', function($log, $rootScope, $http, $location, ProcessErrors, Store) {
|
.factory('LoadConfig', ['$log', '$rootScope', '$http', '$location',
|
||||||
|
'ProcessErrors', 'Store',
|
||||||
|
function($log, $rootScope, $http, $location, ProcessErrors, Store) {
|
||||||
return function() {
|
return function() {
|
||||||
|
|
||||||
if ($rootScope.removeLoadConfig) {
|
if ($rootScope.removeLoadConfig) {
|
||||||
$rootScope.removeLoadConfig();
|
$rootScope.removeLoadConfig();
|
||||||
}
|
}
|
||||||
$rootScope.removeLoadConfig = $rootScope.$on('LoadConfig', function() {
|
$rootScope.removeLoadConfig = $rootScope.$on('LoadConfig', function() {
|
||||||
// local_config.js not found, so we'll load config.js
|
$rootScope.enteredPath = $location.path();
|
||||||
$log.info('attempting to load config.js');
|
// Load js/local_settings.json
|
||||||
$http({ method:'GET', url: $basePath + 'config.js' })
|
$http({ method:'GET', url: $basePath + 'local_settings.json' })
|
||||||
.success(function(data) {
|
.then(function(response) {
|
||||||
$log.info('loaded config.js');
|
$log.info('loaded local_settings.json');
|
||||||
$AnsibleConfig = eval(data);
|
if(angular.isObject(response.data)){
|
||||||
Store('AnsibleConfig', $AnsibleConfig);
|
$AnsibleConfig = _.extend($AnsibleConfig, response.data);
|
||||||
|
Store('AnsibleConfig', $AnsibleConfig);
|
||||||
|
$rootScope.$emit('ConfigReady');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$log.info('local_settings.json is not a valid object');
|
||||||
|
$rootScope.$emit('ConfigReady');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function(response) {
|
||||||
|
//local_settings.json not found
|
||||||
|
$log.info('local_settings.json not found');
|
||||||
$rootScope.$emit('ConfigReady');
|
$rootScope.$emit('ConfigReady');
|
||||||
})
|
|
||||||
.error(function(data, status) {
|
|
||||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
|
||||||
msg: 'Failed to load ' + $basePath + '/config.js. GET status: ' + status
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.enteredPath = $location.path();
|
|
||||||
// Load js/local_config.js
|
// load config.js
|
||||||
$http({ method:'GET', url: $basePath + '/local_config.js' })
|
$log.info('attempting to load config.js');
|
||||||
|
$http({ method:'GET', url: $basePath + 'config.js' })
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
$log.info('loaded local_config.js');
|
$log.info('loaded config.js');
|
||||||
$AnsibleConfig = eval(data);
|
$AnsibleConfig = eval(data);
|
||||||
Store('AnsibleConfig', $AnsibleConfig);
|
Store('AnsibleConfig', $AnsibleConfig);
|
||||||
$rootScope.$emit('ConfigReady');
|
|
||||||
})
|
|
||||||
.error(function() {
|
|
||||||
//local_config.js not found
|
|
||||||
$log.info('local_config.js not found');
|
|
||||||
$rootScope.$emit('LoadConfig');
|
$rootScope.$emit('LoadConfig');
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Failed to load ' + $basePath + '/config.js. GET status: ' + status
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export default
|
|||||||
controller: authenticationController,
|
controller: authenticationController,
|
||||||
templateUrl: templateUrl('login/loginModal'),
|
templateUrl: templateUrl('login/loginModal'),
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
console.log('here you mfers');
|
|
||||||
// Display the login dialog
|
// Display the login dialog
|
||||||
$('#login-modal').modal({
|
$('#login-modal').modal({
|
||||||
show: true,
|
show: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user