1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge pull request #4091 from kensible/3865-config-updates

Removal of config.js and local_settings.json
This commit is contained in:
kensible 2016-11-22 08:18:38 -05:00 committed by GitHub
commit de1b773a50
2 changed files with 52 additions and 109 deletions

View File

@ -1,59 +0,0 @@
/*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
/**********************************************************************
* config.js
*
* Gobal configuration variables for controlling application behavior.
*
* Do NOT change this file, unless the changes should be included in
* production builds. For development, copy this file to local_config.js,
* and make changes. git will ignore local_config.js
*
*/
/*jshint unused:false */
(function() {
//$.fn.modal.Constructor.DEFAULTS.backdrop = 'static';
return {
// custom_logo: true // load /var/lib/awx/public/static/assets/custom_console_logo.png as the login modal header. if false, will load the standard tower console logo
// custom_login_info: "example notice" // have a notice displayed in the login modal for users. note that, as a security measure, custom html is not supported and will be escaped.
password_length: 8, // Minimum user password length. Set to 0 to not set a limit
password_hasLowercase: true, // require a lowercase letter in the password
password_hasUppercase: false, // require an uppercase letter in the password
password_hasNumber: true, // require a number in the password
password_hasSymbol: false, // require one of these symbols to be
// in the password: -!$%^&*()_+|~=`{}[]:";'<>?,./
variable_edit_modes: { // Options we pass to ControlMirror for editing YAML/JSON variables
yaml: {
mode: "text/x-yaml",
matchBrackets: true,
autoCloseBrackets: true,
styleActiveLine: true,
lineNumbers: true,
gutters: ["CodeMirror-lint-markers"],
lint: true
},
json: {
mode: "application/json",
styleActiveLine: true,
matchBrackets: true,
autoCloseBrackets: true,
lineNumbers: true,
gutters: ["CodeMirror-lint-markers"],
lint: true
}
},
};
})();

View File

@ -25,58 +25,60 @@ angular.module('LoadConfigHelper', ['Utilities'])
.factory('LoadConfig', ['$log', '$rootScope', '$http', '$location', .factory('LoadConfig', ['$log', '$rootScope', '$http', '$location',
'ProcessErrors', 'Store', 'ProcessErrors', 'Store',
function($log, $rootScope, $http, $location, ProcessErrors, Store) { function($log, $rootScope, $http, $location, ProcessErrors, Store) {
return function() { return function() {
if ($rootScope.removeLoadConfig) { // These ettings used to be found in config.js, hardcoded now.
$rootScope.removeLoadConfig(); var configSettings = {
} // custom_logo: true, // load /var/lib/awx/public/static/assets/custom_console_logo.png as the login modal header. if false, will load the standard tower console logo
$rootScope.removeLoadConfig = $rootScope.$on('LoadConfig', function() { // custom_login_info: "example notice", // have a notice displayed in the login modal for users. note that, as a security measure, custom html is not supported and will be escaped.
$rootScope.enteredPath = $location.path(); "tooltip_delay": {
// Load js/local_settings.json "show": 500,
$http({ method:'GET', url: $basePath + 'local_settings.json' }) "hide": 100
.then(function(response) { },
$log.info('loaded local_settings.json'); "password_length": 8,
if(angular.isObject(response.data)){ "password_hasLowercase": true,
global.$AnsibleConfig = _.extend($AnsibleConfig, response.data); "password_hasUppercase": false,
Store('AnsibleConfig', global.$AnsibleConfig); "password_hasNumber": true,
if ($rootScope.loginConfig) { "password_hasSymbol": false,
$rootScope.loginConfig.resolve('config loaded'); "variable_edit_modes": {
} "yaml": {
$rootScope.$emit('ConfigReady'); "mode": "text/x-yaml",
} "matchBrackets": true,
else { "autoCloseBrackets": true,
$log.info('local_settings.json is not a valid object'); "styleActiveLine": true,
if ($rootScope.loginConfig) { "lineNumbers": true,
$rootScope.loginConfig.resolve('config loaded'); "gutters": ["CodeMirror-lint-markers"],
} "lint": true
$rootScope.$emit('ConfigReady'); },
"json": {
"mode": "application/json",
"styleActiveLine": true,
"matchBrackets": true,
"autoCloseBrackets": true,
"lineNumbers": true,
"gutters": ["CodeMirror-lint-markers"],
"lint": true
} }
},
};
}, function() { // Auto-resolving what used to be found when attempting to load local_setting.json
//local_settings.json not found if ($rootScope.loginConfig) {
$log.info('local_settings.json not found'); $rootScope.loginConfig.resolve('config loaded');
if ($rootScope.loginConfig) { }
$rootScope.loginConfig.resolve('config loaded'); $rootScope.$emit('ConfigReady');
}
$rootScope.$emit('ConfigReady'); // Load new hardcoded settings from above
}); // TODO Add a check for a custom image to add to the settings.
}); // Update flag to true
// in loginModal.controller load the base64 src
// change partial to use base65 in the img src
global.$AnsibleConfig = configSettings;
Store('AnsibleConfig', global.$AnsibleConfig);
$rootScope.$emit('LoadConfig');
// load config.js };
$log.info('attempting to load config.js'); }
$http({ method:'GET', url: $basePath + 'config.js' }) ]);
.then(function(response) {
$log.info('loaded config.js');
global.$AnsibleConfig = eval(response.data);
Store('AnsibleConfig', global.$AnsibleConfig);
$rootScope.$emit('LoadConfig');
})
.catch(function(response) {
response.data = 'Failed to load ' + $basePath + '/config.js';
ProcessErrors($rootScope, response, response.status, null, { hdr: 'Error!',
msg: 'Failed to load ' + $basePath + '/config.js.'
});
});
};
}]);