mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 17:37:30 -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
|
||||
$log.info('attempting to load config.js');
|
||||
$http({ method:'GET', url: $basePath + 'config.js' })
|
||||
.success(function(data) {
|
||||
.then(function(data) {
|
||||
$log.info('loaded config.js');
|
||||
$AnsibleConfig = eval(data);
|
||||
Store('AnsibleConfig', $AnsibleConfig);
|
||||
$rootScope.$emit('LoadConfig');
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Failed to load ' + $basePath + '/config.js. GET status: ' + status
|
||||
.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.'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
var options = [],
|
||||
error = "";
|
||||
|
||||
function parseGoogle(option, key) {
|
||||
function parseGoogle(option) {
|
||||
var newOption = {};
|
||||
|
||||
newOption.type = "google";
|
||||
|
||||
@@ -252,15 +252,20 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
|
||||
if ((!fieldErrors) && defaultMsg) {
|
||||
Alert(defaultMsg.hdr, defaultMsg.msg);
|
||||
}
|
||||
} else if (typeof data === 'object' && Object.keys(data).length > 0) {
|
||||
keys = Object.keys(data);
|
||||
if (Array.isArray(data[keys[0]])) {
|
||||
msg = data[keys[0]][0];
|
||||
} else if (typeof data === 'object'){
|
||||
if(Object.keys(data).length > 0) {
|
||||
keys = Object.keys(data);
|
||||
if (Array.isArray(data[keys[0]])) {
|
||||
msg = data[keys[0]][0];
|
||||
}
|
||||
else {
|
||||
msg = data[keys[0]];
|
||||
}
|
||||
Alert(defaultMsg.hdr, msg);
|
||||
}
|
||||
else {
|
||||
msg = data[keys[0]];
|
||||
Alert(defaultMsg.hdr, defaultMsg.msg);
|
||||
}
|
||||
Alert(defaultMsg.hdr, msg);
|
||||
} else {
|
||||
Alert(defaultMsg.hdr, defaultMsg.msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user