From 12d31c50999f591061531a1a2ad34b180247f5df Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 27 Oct 2015 20:49:37 -0700 Subject: [PATCH] promise function was outdated for $http request of config.js using .catch instead of .error --- awx/ui/client/src/helpers/LoadConfig.js | 9 +++++---- .../thirdPartySignOn.service.js | 2 +- awx/ui/client/src/shared/Utilities.js | 17 +++++++++++------ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/awx/ui/client/src/helpers/LoadConfig.js b/awx/ui/client/src/helpers/LoadConfig.js index 8c4245697e..4b7cb26cc6 100644 --- a/awx/ui/client/src/helpers/LoadConfig.js +++ b/awx/ui/client/src/helpers/LoadConfig.js @@ -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.' }); }); }; diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js index 4129b9b758..6b55f34881 100644 --- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js +++ b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js @@ -25,7 +25,7 @@ var options = [], error = ""; - function parseGoogle(option, key) { + function parseGoogle(option) { var newOption = {}; newOption.type = "google"; diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index de9bbf67b2..cff6227215 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -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); }