mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
promise function was outdated for $http request of config.js
using .catch instead of .error
This commit is contained in:
@@ -57,15 +57,16 @@ angular.module('LoadConfigHelper', ['Utilities'])
|
|||||||
// load config.js
|
// load config.js
|
||||||
$log.info('attempting to load config.js');
|
$log.info('attempting to load config.js');
|
||||||
$http({ method:'GET', url: $basePath + 'config.js' })
|
$http({ method:'GET', url: $basePath + 'config.js' })
|
||||||
.success(function(data) {
|
.then(function(data) {
|
||||||
$log.info('loaded config.js');
|
$log.info('loaded config.js');
|
||||||
$AnsibleConfig = eval(data);
|
$AnsibleConfig = eval(data);
|
||||||
Store('AnsibleConfig', $AnsibleConfig);
|
Store('AnsibleConfig', $AnsibleConfig);
|
||||||
$rootScope.$emit('LoadConfig');
|
$rootScope.$emit('LoadConfig');
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.catch(function(response) {
|
||||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
response.data = 'Failed to load ' + $basePath + '/config.js';
|
||||||
msg: 'Failed to load ' + $basePath + '/config.js. GET status: ' + status
|
ProcessErrors($rootScope, response, response.status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Failed to load ' + $basePath + '/config.js.'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
var options = [],
|
var options = [],
|
||||||
error = "";
|
error = "";
|
||||||
|
|
||||||
function parseGoogle(option, key) {
|
function parseGoogle(option) {
|
||||||
var newOption = {};
|
var newOption = {};
|
||||||
|
|
||||||
newOption.type = "google";
|
newOption.type = "google";
|
||||||
|
|||||||
@@ -252,15 +252,20 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
|
|||||||
if ((!fieldErrors) && defaultMsg) {
|
if ((!fieldErrors) && defaultMsg) {
|
||||||
Alert(defaultMsg.hdr, defaultMsg.msg);
|
Alert(defaultMsg.hdr, defaultMsg.msg);
|
||||||
}
|
}
|
||||||
} else if (typeof data === 'object' && Object.keys(data).length > 0) {
|
} else if (typeof data === 'object'){
|
||||||
keys = Object.keys(data);
|
if(Object.keys(data).length > 0) {
|
||||||
if (Array.isArray(data[keys[0]])) {
|
keys = Object.keys(data);
|
||||||
msg = data[keys[0]][0];
|
if (Array.isArray(data[keys[0]])) {
|
||||||
|
msg = data[keys[0]][0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = data[keys[0]];
|
||||||
|
}
|
||||||
|
Alert(defaultMsg.hdr, msg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg = data[keys[0]];
|
Alert(defaultMsg.hdr, defaultMsg.msg);
|
||||||
}
|
}
|
||||||
Alert(defaultMsg.hdr, msg);
|
|
||||||
} else {
|
} else {
|
||||||
Alert(defaultMsg.hdr, defaultMsg.msg);
|
Alert(defaultMsg.hdr, defaultMsg.msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user