mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 02:17:37 -02:30
Changes redirect logic slightly to lean on a global var to store the config response rather than a constant on the awApp module. This should allow us to avoid test changes.
This commit is contained in:
committed by
Graham Mainwaring
parent
c16ad89ff9
commit
475e2605d4
@@ -3,6 +3,8 @@ global.$AnsibleConfig = null;
|
|||||||
// Provided via Webpack DefinePlugin in webpack.config.js
|
// Provided via Webpack DefinePlugin in webpack.config.js
|
||||||
global.$ENV = {};
|
global.$ENV = {};
|
||||||
|
|
||||||
|
global.$ConfigResponse = {};
|
||||||
|
|
||||||
var urlPrefix;
|
var urlPrefix;
|
||||||
|
|
||||||
if ($basePath) {
|
if ($basePath) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function fetchConfig (callback) {
|
|||||||
const request = $.ajax('/api/');
|
const request = $.ajax('/api/');
|
||||||
|
|
||||||
request.done(res => {
|
request.done(res => {
|
||||||
angular.module('awApp').constant('ConfigSettings', res);
|
global.$ConfigResponse = res;
|
||||||
if (res.login_redirect_override) {
|
if (res.login_redirect_override) {
|
||||||
if (!document.cookie.split(';').filter((item) => item.includes('userLoggedIn=true')).length && !window.location.href.includes('/#/login')) {
|
if (!document.cookie.split(';').filter((item) => item.includes('userLoggedIn=true')).length && !window.location.href.includes('/#/login')) {
|
||||||
window.location.replace(res.login_redirect_override);
|
window.location.replace(res.login_redirect_override);
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
export default
|
export default
|
||||||
function LoadConfig($rootScope, Store, ConfigSettings) {
|
function LoadConfig($rootScope, Store) {
|
||||||
return function() {
|
return function() {
|
||||||
|
|
||||||
var configSettings = {};
|
var configSettings = {};
|
||||||
|
|
||||||
if(ConfigSettings.custom_logo) {
|
if(global.$ConfigResponse.custom_logo) {
|
||||||
configSettings.custom_logo = true;
|
configSettings.custom_logo = true;
|
||||||
$rootScope.custom_logo = ConfigSettings.custom_logo;
|
$rootScope.custom_logo = global.$ConfigResponse.custom_logo;
|
||||||
} else {
|
} else {
|
||||||
configSettings.custom_logo = false;
|
configSettings.custom_logo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ConfigSettings.custom_login_info) {
|
if(global.$ConfigResponse.custom_login_info) {
|
||||||
configSettings.custom_login_info = ConfigSettings.custom_login_info;
|
configSettings.custom_login_info = global.$ConfigResponse.custom_login_info;
|
||||||
$rootScope.custom_login_info = ConfigSettings.custom_login_info;
|
$rootScope.custom_login_info = global.$ConfigResponse.custom_login_info;
|
||||||
} else {
|
} else {
|
||||||
configSettings.custom_login_info = false;
|
configSettings.custom_login_info = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigSettings.login_redirect_override) {
|
if (global.$ConfigResponse.login_redirect_override) {
|
||||||
configSettings.login_redirect_override = ConfigSettings.login_redirect_override;
|
configSettings.login_redirect_override = global.$ConfigResponse.login_redirect_override;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-resolving what used to be found when attempting to load local_setting.json
|
// Auto-resolving what used to be found when attempting to load local_setting.json
|
||||||
@@ -37,4 +37,4 @@ export default
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadConfig.$inject =
|
LoadConfig.$inject =
|
||||||
[ '$rootScope', 'Store', 'ConfigSettings' ];
|
[ '$rootScope', 'Store' ];
|
||||||
|
|||||||
Reference in New Issue
Block a user