diff --git a/.gitignore b/.gitignore index aa37a6f1d1..e47a9df7cb 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ awx/public/media awx/public/static awx/ui/tests/test-results.xml 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/main/fixtures awx/*.log diff --git a/awx/ui/client/src/helpers/LoadConfig.js b/awx/ui/client/src/helpers/LoadConfig.js index 7f946378a6..05c4a82233 100644 --- a/awx/ui/client/src/helpers/LoadConfig.js +++ b/awx/ui/client/src/helpers/LoadConfig.js @@ -3,7 +3,7 @@ * * All Rights Reserved *************************************************/ - + /** * @ngdoc function * @name helpers.function:LoadConfig @@ -22,42 +22,51 @@ export default 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() { if ($rootScope.removeLoadConfig) { $rootScope.removeLoadConfig(); } $rootScope.removeLoadConfig = $rootScope.$on('LoadConfig', function() { - // local_config.js not found, so we'll load config.js - $log.info('attempting to load config.js'); - $http({ method:'GET', url: $basePath + 'config.js' }) - .success(function(data) { - $log.info('loaded config.js'); - $AnsibleConfig = eval(data); - Store('AnsibleConfig', $AnsibleConfig); + $rootScope.enteredPath = $location.path(); + // Load js/local_settings.json + $http({ method:'GET', url: $basePath + 'local_settings.json' }) + .then(function(response) { + $log.info('loaded local_settings.json'); + if(angular.isObject(response.data)){ + $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'); - }) - .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 - $http({ method:'GET', url: $basePath + '/local_config.js' }) + + // load config.js + $log.info('attempting to load config.js'); + $http({ method:'GET', url: $basePath + 'config.js' }) .success(function(data) { - $log.info('loaded local_config.js'); + $log.info('loaded config.js'); $AnsibleConfig = eval(data); Store('AnsibleConfig', $AnsibleConfig); - $rootScope.$emit('ConfigReady'); - }) - .error(function() { - //local_config.js not found - $log.info('local_config.js not found'); $rootScope.$emit('LoadConfig'); + }) + .error(function(data, status) { + ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', + msg: 'Failed to load ' + $basePath + '/config.js. GET status: ' + status + }); }); }; }]); diff --git a/awx/ui/client/src/login/loginModal.directive.js b/awx/ui/client/src/login/loginModal.directive.js index b0cbcc02b7..9c520bbb28 100644 --- a/awx/ui/client/src/login/loginModal.directive.js +++ b/awx/ui/client/src/login/loginModal.directive.js @@ -15,7 +15,6 @@ export default controller: authenticationController, templateUrl: templateUrl('login/loginModal'), link: function(scope, element, attrs) { - console.log('here you mfers'); // Display the login dialog $('#login-modal').modal({ show: true,