diff --git a/awx/ui/client/src/access/permissions-list.controller.js b/awx/ui/client/src/access/permissions-list.controller.js index 3e190625ba..b50293d74a 100644 --- a/awx/ui/client/src/access/permissions-list.controller.js +++ b/awx/ui/client/src/access/permissions-list.controller.js @@ -25,7 +25,7 @@ export default ['$scope', 'ListDefinition', 'Dataset', 'Wait', 'Rest', 'ProcessE Wait('stop'); $state.go('.', null, {reload: true}); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Could not disassociate user from role. Call to ' + url + ' failed. DELETE returned status: ' + status @@ -58,7 +58,7 @@ export default ['$scope', 'ListDefinition', 'Dataset', 'Wait', 'Rest', 'ProcessE Wait('stop'); $state.go('.', null, {reload: true}); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Could not disassociate team from role. Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/access/rbac-role-column/roleList.directive.js b/awx/ui/client/src/access/rbac-role-column/roleList.directive.js index 4f750ee1b5..ef6b04988f 100644 --- a/awx/ui/client/src/access/rbac-role-column/roleList.directive.js +++ b/awx/ui/client/src/access/rbac-role-column/roleList.directive.js @@ -57,7 +57,7 @@ export default Wait('stop'); $state.go('.', null, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Failed to remove access. Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/configuration/configuration.service.js b/awx/ui/client/src/configuration/configuration.service.js index d4ec6a7da2..bd25d7179c 100644 --- a/awx/ui/client/src/configuration/configuration.service.js +++ b/awx/ui/client/src/configuration/configuration.service.js @@ -35,7 +35,7 @@ export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Re deferred.resolve(returnData); }) - .error(function(error) { + .catch(({error}) => { deferred.reject(error); }); @@ -50,7 +50,7 @@ export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Re .then(({data}) => { deferred.resolve(data); }) - .error(function(error) { + .catch(({error}) => { deferred.reject(error); }); @@ -64,7 +64,7 @@ export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Re .then(({data}) => { deferred.resolve(data); }) - .error(function(error) { + .catch(({error}) => { deferred.reject(error); }); diff --git a/awx/ui/client/src/credential-types/add/add.controller.js b/awx/ui/client/src/credential-types/add/add.controller.js index 0929716d6b..ca8519395a 100644 --- a/awx/ui/client/src/credential-types/add/add.controller.js +++ b/awx/ui/client/src/credential-types/add/add.controller.js @@ -103,7 +103,7 @@ export default ['Rest', 'Wait', $state.go('credentialTypes.edit', { credential_type_id: data.id }, { reload: true }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new credential type. PUT returned status: ' + status diff --git a/awx/ui/client/src/credential-types/edit/edit.controller.js b/awx/ui/client/src/credential-types/edit/edit.controller.js index 95266cec78..14745dcca7 100644 --- a/awx/ui/client/src/credential-types/edit/edit.controller.js +++ b/awx/ui/client/src/credential-types/edit/edit.controller.js @@ -177,7 +177,7 @@ export default ['Rest', 'Wait', $state.go($state.current, null, { reload: true }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new credential type. PUT returned status: ' + status diff --git a/awx/ui/client/src/credential-types/list/list.controller.js b/awx/ui/client/src/credential-types/list/list.controller.js index 3a14a33513..129d415711 100644 --- a/awx/ui/client/src/credential-types/list/list.controller.js +++ b/awx/ui/client/src/credential-types/list/list.controller.js @@ -75,7 +75,7 @@ export default ['$rootScope', '$scope', 'Wait', 'CredentialTypesList', $state.go('.', reloadListStateParams, { reload: true }); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/credentials/factories/credential-form-save.factory.js b/awx/ui/client/src/credentials/factories/credential-form-save.factory.js index 496a95e3ae..89fcba25e6 100644 --- a/awx/ui/client/src/credentials/factories/credential-form-save.factory.js +++ b/awx/ui/client/src/credentials/factories/credential-form-save.factory.js @@ -63,7 +63,7 @@ export default ReturnToCaller(1); } }) - .error(function (data, status) { + .catch(({data, status}) => { Wait('stop'); // TODO: hopefully this conditional error handling will to away in a future versions. The reason why we cannot // simply pass this error to ProcessErrors is because it will actually match the form element 'ssh_key_unlock' and show @@ -87,7 +87,7 @@ export default Wait('stop'); $state.go($state.current, {}, {reload: true}); }) - .error(function (data, status) { + .catch(({data, status}) => { Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: i18n._('Error!'), diff --git a/awx/ui/client/src/credentials/list/credentials-list.controller.js b/awx/ui/client/src/credentials/list/credentials-list.controller.js index e006b76fe2..798ce5b024 100644 --- a/awx/ui/client/src/credentials/list/credentials-list.controller.js +++ b/awx/ui/client/src/credentials/list/credentials-list.controller.js @@ -101,7 +101,7 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', ' } Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/home/home.controller.js b/awx/ui/client/src/home/home.controller.js index 57e53d208f..42ec5ec5b0 100644 --- a/awx/ui/client/src/home/home.controller.js +++ b/awx/ui/client/src/home/home.controller.js @@ -17,7 +17,7 @@ export default ['$scope', '$rootScope','Wait', .then(({data}) => { $scope.dashboardData = data; }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard host graph data: ' + status }); }); @@ -26,7 +26,7 @@ export default ['$scope', '$rootScope','Wait', .then(({data}) => { $scope.dashboardJobsListData = data.results; }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard jobs list: ' + status }); }); @@ -35,7 +35,7 @@ export default ['$scope', '$rootScope','Wait', .then(({data}) => { $scope.dashboardJobTemplatesListData = data.results; }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard jobs list: ' + status }); }); @@ -94,7 +94,7 @@ export default ['$scope', '$rootScope','Wait', $scope.dashboardData = data; $scope.$emit('dashboardReady', data); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status }); }); Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job"); @@ -103,7 +103,7 @@ export default ['$scope', '$rootScope','Wait', data = data.results; $scope.$emit('dashboardJobsListReady', data); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard jobs list: ' + status }); }); Rest.setUrl(GetBasePath("unified_job_templates") + "?order_by=-last_job_run&page_size=5&last_job_run__isnull=false&type=workflow_job_template,job_template"); @@ -112,7 +112,7 @@ export default ['$scope', '$rootScope','Wait', data = data.results; $scope.$emit('dashboardJobTemplatesListReady', data); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard job templates list: ' + status }); }); }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js b/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js index 490d05a7b9..0d3d79df37 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js @@ -243,7 +243,7 @@ function adhocController($q, $scope, $stateParams, Wait('stop'); $state.go('adHocJobStdout', {id: data.id}); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, adhocForm, { hdr: 'Error!', msg: 'Failed to launch adhoc command. POST ' + diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js index 53e56e0163..495c201646 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js @@ -13,7 +13,7 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError .then(({data}) => { $scope.generateTable(data, event); }) - .error( function(data, status) { + .catch(({data, status}) => { ProcessErrors( $scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. GET returned: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js index 76a63dcdd2..f55bd351e0 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js @@ -88,7 +88,7 @@ function InventoriesList($scope, .then(() => { Wait('stop'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors( $scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js index 77303ce704..661d122c88 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js @@ -9,7 +9,7 @@ export default [ '$scope', 'Wait', 'Empty', 'Rest', 'ProcessErrors', '$state', .then(({data}) => { $scope.generateTable(data, event); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors( $scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + $scope.inventory.related.inventory_sources + ' failed. GET returned status: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js index eacda2b133..d5a7672c63 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js @@ -69,7 +69,7 @@ export default Wait('stop'); $state.go('.', null, {reload: true}); }) - .error(function (data, status) { + .catch(({data, status}) => { Wait('stop'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Could not disassociate host from group. Call to ' + url + ' failed. DELETE returned status: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js index 9faa35e62d..9819795f29 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js @@ -42,7 +42,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', sync_inventory_file_select2(); Wait('stop'); }) - .error(function () { + .catch(() => { Alert('Cannot get inventory files', 'Unable to retrieve the list of inventory files for this project.', 'alert-info'); Wait('stop'); }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js index 1d4d965be4..66d00adcf8 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js @@ -131,7 +131,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', sync_inventory_file_select2(); Wait('stop'); }) - .error(function () { + .catch(() => { Alert('Cannot get inventory files', 'Unable to retrieve the list of inventory files for this project.', 'alert-info'); Wait('stop'); }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js index d89c5fca5e..394d0d5412 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js @@ -32,7 +32,7 @@ export default //Alert('Inventory Sync Cancelled', 'Request to cancel the sync process was submitted to the task manger. ' + // 'Click the button to monitor the status.', 'alert-info'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST status: ' + status }); @@ -42,13 +42,13 @@ export default Wait('stop'); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. GET status: ' + status }); }); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + inventory_source.url + ' failed. GET status: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js index 3d98a9ed5e..33e9b83ca7 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js @@ -21,7 +21,7 @@ export default scope.cloudCredentialRequired = false; scope.$emit('sourceTypeOptionsReady'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve options for inventory_sources.source. OPTIONS status: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js index 0543681644..e7820f79c8 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js @@ -19,7 +19,7 @@ export default $state.go('inventorySyncStdout', {id: update_id}); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve inventory source: ' + inventory_source.url + ' GET returned status: ' + status }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js index 71bbebdfdb..10ec28da54 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js @@ -24,7 +24,7 @@ export default Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, post: function(inventory_source){ @@ -33,7 +33,7 @@ export default Rest.setUrl(this.url); return Rest.post(inventory_source) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, put: function(inventory_source){ @@ -42,7 +42,7 @@ export default Rest.setUrl(this.url); return Rest.put(inventory_source) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, delete: function(id){ @@ -51,7 +51,7 @@ export default Rest.setUrl(this.url); return Rest.destroy() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, options: function(){ @@ -59,7 +59,7 @@ export default Rest.setUrl(this.url); return Rest.options() .then(this.then.bind(this)) - .error(this.error.bind(this)); + .catch(this.catch.bind(this)); }, getCredential: function(id){ Wait('start'); @@ -67,7 +67,7 @@ export default Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, getInventorySource: function(params){ @@ -76,7 +76,7 @@ export default Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, putInventorySource: function(params, url){ @@ -85,7 +85,7 @@ export default Rest.setUrl(this.url); return Rest.put(params) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, // these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level @@ -95,7 +95,7 @@ export default Rest.setUrl(this.url); return Rest.post(group) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, disassociateGroup: function(group, parent){ @@ -104,7 +104,7 @@ export default Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, promote: function(group, inventory){ @@ -113,7 +113,7 @@ export default Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, encodeGroupBy(source, group_by){ diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js index 4c00bc92b2..1f21e3844f 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js @@ -77,7 +77,7 @@ function SmartInventoryAdd($scope, $location, }); }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new inventory. Post returned status: ' + status diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js index 8b235842a8..7890b7b19c 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js @@ -90,7 +90,7 @@ function SmartInventoryEdit($scope, $location, }); }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update inventory. PUT returned status: ' + status diff --git a/awx/ui/client/src/inventories-hosts/shared/groups.service.js b/awx/ui/client/src/inventories-hosts/shared/groups.service.js index 491600ee72..9ad4b0dcf6 100644 --- a/awx/ui/client/src/inventories-hosts/shared/groups.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/groups.service.js @@ -24,7 +24,7 @@ export default Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, post: function(group){ @@ -33,7 +33,7 @@ export default Rest.setUrl(this.url); return Rest.post(group) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, put: function(group){ @@ -42,7 +42,7 @@ export default Rest.setUrl(this.url); return Rest.put(group) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, delete: function(id){ @@ -51,7 +51,7 @@ export default Rest.setUrl(this.url); return Rest.destroy() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, getCredential: function(id){ @@ -60,7 +60,7 @@ export default Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, getInventorySource: function(params){ @@ -69,7 +69,7 @@ export default Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, putInventorySource: function(params, url){ @@ -78,7 +78,7 @@ export default Rest.setUrl(this.url); return Rest.put(params) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, // these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level @@ -88,7 +88,7 @@ export default Rest.setUrl(this.url); return Rest.post(group) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, disassociateGroup: function(group, parent){ @@ -97,7 +97,7 @@ export default Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, associateHost: function(host, target){ @@ -106,7 +106,7 @@ export default Rest.setUrl(this.url); return Rest.post(host) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, disassociateHost: function(host, group){ @@ -115,7 +115,7 @@ export default Rest.setUrl(this.url); return Rest.post({id: host, disassociate: 1}) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, promote: function(group, inventory){ @@ -124,7 +124,7 @@ export default Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); } }; diff --git a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js index 20ba74a809..38d5047fdb 100644 --- a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js @@ -31,7 +31,7 @@ Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, post: function(host){ @@ -40,7 +40,7 @@ Rest.setUrl(this.url); return Rest.post(host) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, put: function(host){ @@ -49,7 +49,7 @@ Rest.setUrl(this.url); return Rest.put(host) .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, delete: function(id){ @@ -58,7 +58,7 @@ Rest.setUrl(this.url); return Rest.destroy() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); } }; diff --git a/awx/ui/client/src/inventories-hosts/shared/inventories.service.js b/awx/ui/client/src/inventories-hosts/shared/inventories.service.js index 370895f07f..8b85be3ea2 100644 --- a/awx/ui/client/src/inventories-hosts/shared/inventories.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/inventories.service.js @@ -26,7 +26,7 @@ Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, getBreadcrumbs: function(groups){ @@ -37,7 +37,7 @@ Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)) + .catch(this.catch.bind(this)) .finally(Wait('stop')); }, rootHostsUrl: function(id){ @@ -61,21 +61,21 @@ Rest.setUrl(this.url); return Rest.options() .then(this.then.bind(this)) - .error(this.error.bind(this)); + .catch(this.catch.bind(this)); }, updateInventorySourcesGet: function(inventoryId) { this.url = GetBasePath('inventory') + inventoryId + '/update_inventory_sources'; Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)); + .catch(this.catch.bind(this)); }, getHost: function(inventoryId, hostId) { this.url = GetBasePath('inventory') + inventoryId + '/hosts?id=' + hostId; Rest.setUrl(this.url); return Rest.get() .then(this.then.bind(this)) - .error(this.error.bind(this)); + .catch(this.catch.bind(this)); } }; }]; diff --git a/awx/ui/client/src/inventory-scripts/add/add.controller.js b/awx/ui/client/src/inventory-scripts/add/add.controller.js index 26e6d6801b..60c6714d70 100644 --- a/awx/ui/client/src/inventory-scripts/add/add.controller.js +++ b/awx/ui/client/src/inventory-scripts/add/add.controller.js @@ -47,7 +47,7 @@ export default ['Rest', 'Wait', $state.go('inventoryScripts', null, { reload: true }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new inventory script. POST returned status: ' + status diff --git a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js index 6655a529bd..5bd7ee8f19 100644 --- a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js +++ b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js @@ -63,7 +63,7 @@ export default ['Rest', 'Wait', $state.go('inventoryScripts', null, { reload: true }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new inventory script. PUT returned status: ' + status diff --git a/awx/ui/client/src/inventory-scripts/list/list.controller.js b/awx/ui/client/src/inventory-scripts/list/list.controller.js index 0108ae1549..979d6fc2e0 100644 --- a/awx/ui/client/src/inventory-scripts/list/list.controller.js +++ b/awx/ui/client/src/inventory-scripts/list/list.controller.js @@ -65,7 +65,7 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList', $state.go('.', reloadListStateParams, { reload: true }); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/job-results/job-results.route.js b/awx/ui/client/src/job-results/job-results.route.js index b7c453358d..bbfd0282c0 100644 --- a/awx/ui/client/src/job-results/job-results.route.js +++ b/awx/ui/client/src/job-results/job-results.route.js @@ -94,7 +94,7 @@ export default { countFinished: true}); } }) - .error(function() { + .catch(() => { defer.resolve({val: { ok: 0, skipped: 0, diff --git a/awx/ui/client/src/job-results/job-results.service.js b/awx/ui/client/src/job-results/job-results.service.js index b1c40bab10..53bc34a9ae 100644 --- a/awx/ui/client/src/job-results/job-results.service.js +++ b/awx/ui/client/src/job-results/job-results.service.js @@ -77,7 +77,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo val.resolve({results: data.results, next: data.next}); }) - .error(function(obj, status) { + .catch(({obj, status}) => { ProcessErrors(null, obj, status, null, { hdr: 'Error!', msg: `Could not get job events. @@ -106,7 +106,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo $('#prompt-modal').modal('hide'); $state.go('jobs'); }) - .error(function(obj, status) { + .catch(({obj, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(null, obj, status, null, { @@ -127,7 +127,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo Wait('stop'); $('#prompt-modal').modal('hide'); }) - .error(function(obj, status) { + .catch(({obj, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(null, obj, status, null, { @@ -242,7 +242,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo .then(({data}) => { return data; }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + '. GET returned: ' + status }); }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js index dde8e79b36..f8da6cb953 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js @@ -62,7 +62,7 @@ .then(() => { Wait('stop'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + @@ -92,7 +92,7 @@ $state.go('adHocJobStdout', {id: data.id}); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, { hdr: 'Error!', msg: 'Failed to launch adhoc command. POST ' + @@ -148,7 +148,7 @@ scope.$emit('StartAdhocRun'); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get job template details. GET returned status: ' + status }); }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js index 9da4dd2042..252fe1f647 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js @@ -30,7 +30,7 @@ export default }); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get job template details. GET returned status: ' + status }); }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/getsurveyquestions.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/getsurveyquestions.factory.js index 4d18d3fdcf..4c8c901ac9 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/getsurveyquestions.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/getsurveyquestions.factory.js @@ -74,7 +74,7 @@ export default return; } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, { hdr: 'Error!', msg: 'Failed to retrieve organization: ' + $stateParams.id + '. GET status: ' + status }); }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js index 3ed55607e5..ddb1f67ab7 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js @@ -63,7 +63,7 @@ export default } } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get inventory source ' + url + ' GET returned: ' + status }); }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js index 96f79304f4..58f45e38cf 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js @@ -188,7 +188,7 @@ export default $state.go('.', null, {reload: true}); } }) - .error(function(data, status) { + .catch(({data, status}) => { let template_id = scope.job_template_id; template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id); ProcessErrors(scope, data, status, null, { hdr: i18n._('Error!'), @@ -209,7 +209,7 @@ export default } buildData(); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, { hdr: i18n._('Error!'), msg: i18n._('Failed to retrieve job template extra variables.') }); }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js index 5e69365cd6..be732e0047 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js @@ -59,7 +59,7 @@ export default 'alert-danger'); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to lookup project ' + url + ' GET returned: ' + status }); }); diff --git a/awx/ui/client/src/job-submission/job-submission.controller.js b/awx/ui/client/src/job-submission/job-submission.controller.js index 5bc21c793c..f273012bfe 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -311,7 +311,7 @@ export default } initiateModal(); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get job details. GET returned status: ' + status }); }); @@ -324,7 +324,7 @@ export default } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get job template details. GET returned status: ' + status }); }); diff --git a/awx/ui/client/src/jobs/factories/delete-job.factory.js b/awx/ui/client/src/jobs/factories/delete-job.factory.js index 7829d7637a..d6c3a0d4f1 100644 --- a/awx/ui/client/src/jobs/factories/delete-job.factory.js +++ b/awx/ui/client/src/jobs/factories/delete-job.factory.js @@ -52,7 +52,7 @@ Wait('stop'); } }) - .error(function(obj, status) { + .catch(({obj, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); if (status === 403) { @@ -81,7 +81,7 @@ Wait('stop'); } }) - .error(function (obj, status) { + .catch(({obj, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); if (status === 403) { @@ -127,7 +127,7 @@ scope.$emit('CancelNotAllowed'); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. GET returned: ' + status }); }); diff --git a/awx/ui/client/src/jobs/factories/relaunch-inventory.factory.js b/awx/ui/client/src/jobs/factories/relaunch-inventory.factory.js index 2070da46d6..3c9b3ecc4d 100644 --- a/awx/ui/client/src/jobs/factories/relaunch-inventory.factory.js +++ b/awx/ui/client/src/jobs/factories/relaunch-inventory.factory.js @@ -13,7 +13,7 @@ export default url: data.related.update }); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve inventory source: ' + url + ' GET returned: ' + status }); }); diff --git a/awx/ui/client/src/license/checkLicense.factory.js b/awx/ui/client/src/license/checkLicense.factory.js index 5844ee3bec..8fcd2bbd2e 100644 --- a/awx/ui/client/src/license/checkLicense.factory.js +++ b/awx/ui/client/src/license/checkLicense.factory.js @@ -24,7 +24,7 @@ export default .success(function(res){ return res; }) - .error(function(res, status){ + .catch(({res, status}) => { ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status}); }); diff --git a/awx/ui/client/src/login/loginModal/loginModal.controller.js b/awx/ui/client/src/login/loginModal/loginModal.controller.js index 419c8c3734..9c59a7e3d5 100644 --- a/awx/ui/client/src/login/loginModal/loginModal.controller.js +++ b/awx/ui/client/src/login/loginModal/loginModal.controller.js @@ -149,7 +149,7 @@ export default ['$log', '$cookies', '$compile', '$rootScope', scope.$emit('AuthorizationGetLicense'); }); }) - .error(function (data, status) { + .catch(({data, status}) => { Authorization.logout().then( () => { Wait('stop'); Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', loginAgain); diff --git a/awx/ui/client/src/management-jobs/card/card.controller.js b/awx/ui/client/src/management-jobs/card/card.controller.js index a7de633af1..a66f5d7ec5 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -24,7 +24,7 @@ export default $scope.mgmtCards = data.results; Wait('stop'); }) - .error(function(data, status){ + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, {hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. Return status: %d'), (defaultUrl === undefined) ? "undefined" : defaultUrl, status )}); }); @@ -134,7 +134,7 @@ export default $("#configure-dialog").dialog('close'); $state.go('managementJobStdout', {id: data.system_job}, {reload:true}); }) - .error(function(data, status) { + .catch(({data, status}) => { let template_id = scope.job_template_id; template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id); ProcessErrors(scope, data, status, null, { hdr: i18n._('Error!'), @@ -224,7 +224,7 @@ export default // $("#configure-dialog").dialog('close'); $state.go('managementJobStdout', {id: data.system_job}, {reload:true}); }) - .error(function(data, status) { + .catch(({data, status}) => { let template_id = scope.job_template_id; template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id); ProcessErrors(scope, data, status, null, { hdr: i18n._('Error!'), diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index a7fafa4e77..11f7eb1aa1 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -51,7 +51,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', .then(({data}) => { $scope.organization_name = data.name; }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: `Failed to retrieve organization. GET status: ${status}` @@ -217,7 +217,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', $state.go('notifications', {}, { reload: true }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new notifier. POST returned status: ' + status diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index bed35b562f..0d871dd26f 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -144,7 +144,7 @@ export default ['Rest', 'Wait', }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to retrieve notification: ' + id + '. GET status: ' + status @@ -284,7 +284,7 @@ export default ['Rest', 'Wait', $state.go('notifications', {}, { reload: true }); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new notification template. POST returned status: ' + status diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js index cb20e18d17..3208c1bc22 100644 --- a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js +++ b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js @@ -180,7 +180,7 @@ } Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/notifications/shared/notification-list-init.factory.js b/awx/ui/client/src/notifications/shared/notification-list-init.factory.js index a51169942c..195fb2033c 100644 --- a/awx/ui/client/src/notifications/shared/notification-list-init.factory.js +++ b/awx/ui/client/src/notifications/shared/notification-list-init.factory.js @@ -86,7 +86,7 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices', Wait('stop'); } }) - .error( function(data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to update notification ' + data.id + ' PUT returned: ' + status }); }); diff --git a/awx/ui/client/src/notifications/shared/toggle-notification.factory.js b/awx/ui/client/src/notifications/shared/toggle-notification.factory.js index 3e32b13a0e..03cb53e260 100644 --- a/awx/ui/client/src/notifications/shared/toggle-notification.factory.js +++ b/awx/ui/client/src/notifications/shared/toggle-notification.factory.js @@ -47,7 +47,7 @@ export default ['Wait', 'ProcessErrors', 'Rest', // Hide the working spinner Wait('stop'); }) - .error( function(data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to update notification ' + data.id + ' PUT returned: ' + status }); }); diff --git a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js index 431521c033..3cf0c5fc5f 100644 --- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js +++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js @@ -127,7 +127,7 @@ export default ['$scope', '$location', '$stateParams', .then(() => { $('#prompt-modal').modal('hide'); }) - .error(function(data, status) { + .catch(({data, status}) => { $('#prompt-modal').modal('hide'); ProcessErrors($scope, data, status, null, { hdr: 'Error!', diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js index fc7e9bb08a..ab5908c041 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js @@ -54,7 +54,7 @@ export default ['$stateParams', '$scope', 'Rest', '$state', }).then(() => { $state.go('.', null, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js index fd8cf0c193..0e74eb5132 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js @@ -197,7 +197,7 @@ export default ['$scope', '$rootScope', '$location', .then(({data}) => { $scope.$emit('GroupSummaryReady', event, inventory, data); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + inventory.related.inventory_sources + ' failed. GET returned status: ' + status @@ -221,7 +221,7 @@ export default ['$scope', '$rootScope', '$location', .then(({data}) => { $scope.$emit('HostSummaryReady', event, data); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. GET returned: ' + status diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js index f58c1364ee..2854855211 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js @@ -93,7 +93,7 @@ export default ['$scope', '$rootScope', } }); }) - .error(function(res, status){ + .catch(({res, status}) => { ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', msg: 'Call failed. Return status: '+ status}); }); diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js index 6311ccaf5c..0bb54483b4 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js @@ -208,7 +208,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', .then(({data}) => { $scope.$emit('GoTojobResults', data); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Project lookup failed. GET returned: ' + status @@ -228,7 +228,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', Alert('SCM Update Cancel', 'Your request to cancel the update was submitted to the task manager.', 'alert-info'); $scope.refresh(); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST status: ' + status }); }); }); @@ -249,7 +249,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', 'Click the Refresh button to view the latest status.', 'alert-info', null, null, null, null, true); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. GET status: ' + status }); }); }); @@ -264,7 +264,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', .then(({data}) => { $scope.$emit('Check_Cancel', data); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + data.related.current_update + ' failed. GET status: ' + status @@ -275,7 +275,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', 'button to view the latest status.', 'alert-info', undefined, undefined, undefined, undefined, true); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to get project failed. GET status: ' + status diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js index bc2ed1c7a2..d657b973c8 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js @@ -53,7 +53,7 @@ export default ['$stateParams', '$scope', 'OrgUserList','Rest', '$state', }).then(() => { $state.go('.', null, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/organizations/list/organizations-list.controller.js b/awx/ui/client/src/organizations/list/organizations-list.controller.js index 4b700a218b..9cbe175efc 100644 --- a/awx/ui/client/src/organizations/list/organizations-list.controller.js +++ b/awx/ui/client/src/organizations/list/organizations-list.controller.js @@ -93,7 +93,7 @@ export default ['$stateParams', '$scope', '$rootScope', Rest.setUrl($scope.current_url); Rest.get() .success((data) => $scope.organizations = data.results) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + defaultUrl + ' failed. DELETE returned status: ' + status @@ -159,7 +159,7 @@ export default ['$stateParams', '$scope', '$rootScope', $state.go('.', reloadListStateParams, { reload: true }); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status diff --git a/awx/ui/client/src/projects/add/projects-add.controller.js b/awx/ui/client/src/projects/add/projects-add.controller.js index 64e044989e..e4304ccb32 100644 --- a/awx/ui/client/src/projects/add/projects-add.controller.js +++ b/awx/ui/client/src/projects/add/projects-add.controller.js @@ -103,7 +103,7 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm', $scope.addedItem = data.id; $state.go('projects.edit', { project_id: data.id }, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { Wait('stop'); ProcessErrors($scope, data, status, form, { hdr: i18n._('Error!'), msg: i18n._('Failed to create new project. POST returned status: ') + status }); diff --git a/awx/ui/client/src/projects/edit/projects-edit.controller.js b/awx/ui/client/src/projects/edit/projects-edit.controller.js index d694eeb592..7d1acb1bc1 100644 --- a/awx/ui/client/src/projects/edit/projects-edit.controller.js +++ b/awx/ui/client/src/projects/edit/projects-edit.controller.js @@ -152,7 +152,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', $scope.$emit('projectLoaded'); Wait('stop'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Failed to retrieve project: %s. GET status: '), id) + status }); @@ -218,7 +218,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', Wait('stop'); $state.go($state.current, {}, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Failed to update project: %s. PUT status: '), id) + status }); }); }; @@ -233,7 +233,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', .then(() => { $('#prompt-modal').modal('hide'); }) - .error(function(data, status) { + .catch(({data, status}) => { $('#prompt-modal').modal('hide'); ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. POST returned status: '), url) + status }); }); diff --git a/awx/ui/client/src/projects/factories/get-project-path.factory.js b/awx/ui/client/src/projects/factories/get-project-path.factory.js index 414385c7be..3778f3c28e 100644 --- a/awx/ui/client/src/projects/factories/get-project-path.factory.js +++ b/awx/ui/client/src/projects/factories/get-project-path.factory.js @@ -63,7 +63,7 @@ export default } scope.$emit('pathsReady'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to access API config. GET status: ' + status }); }); diff --git a/awx/ui/client/src/projects/list/projects-list.controller.js b/awx/ui/client/src/projects/list/projects-list.controller.js index aca57f2649..0e7d50f240 100644 --- a/awx/ui/client/src/projects/list/projects-list.controller.js +++ b/awx/ui/client/src/projects/list/projects-list.controller.js @@ -165,7 +165,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', .then(({data}) => { $scope.$emit('GoTojobResults', data); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n._('Project lookup failed. GET returned: ') + status }); }); @@ -194,7 +194,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', $state.go('.', reloadListStateParams, {reload: true}); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. DELETE returned status: '), url) + status }); }) @@ -221,7 +221,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', .then(() => { Alert(i18n._('SCM Update Cancel'), i18n._('Your request to cancel the update was submitted to the task manager.'), 'alert-info'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. POST status: '), url) + status }); }); }); @@ -242,7 +242,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', 'Click the %sRefresh%s button to view the latest status.'), '', '') + '', 'alert-info', null, null, null, null, true); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. GET status: '), url) + status }); }); }); @@ -258,7 +258,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', .then(({data}) => { $scope.$emit('Check_Cancel', data); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. GET status: '), data.related.current_update) + status }); }); @@ -267,7 +267,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', 'button to view the latest status.'), $filter('sanitize')(name), '', '') + '', 'alert-info',undefined,undefined,undefined,undefined,true); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n._('Call to get project failed. GET status: ') + status }); }); diff --git a/awx/ui/client/src/scheduler/factories/delete-schedule.factory.js b/awx/ui/client/src/scheduler/factories/delete-schedule.factory.js index 537f9146bf..e1f9376b48 100644 --- a/awx/ui/client/src/scheduler/factories/delete-schedule.factory.js +++ b/awx/ui/client/src/scheduler/factories/delete-schedule.factory.js @@ -40,7 +40,7 @@ export default $state.go('.', reloadListStateParams, {reload: true}); } }) - .error(function (data, status) { + .catch(({data, status}) => { try { $('#prompt-modal').modal('hide'); } diff --git a/awx/ui/client/src/scheduler/factories/edit-schedule.factory.js b/awx/ui/client/src/scheduler/factories/edit-schedule.factory.js index 9ca2d5191a..fe8c2eff24 100644 --- a/awx/ui/client/src/scheduler/factories/edit-schedule.factory.js +++ b/awx/ui/client/src/scheduler/factories/edit-schedule.factory.js @@ -141,7 +141,7 @@ export default scope.$emit('ScheduleFound'); }) - .error(function(data,status){ + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve schedule ' + id + ' GET returned: ' + status }); }); diff --git a/awx/ui/client/src/scheduler/factories/schedule-post.factory.js b/awx/ui/client/src/scheduler/factories/schedule-post.factory.js index e3609516bb..e62388368e 100644 --- a/awx/ui/client/src/scheduler/factories/schedule-post.factory.js +++ b/awx/ui/client/src/scheduler/factories/schedule-post.factory.js @@ -43,7 +43,7 @@ export default Wait('stop'); } }) - .error(function(data, status){ + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'POST to ' + url + ' returned: ' + status }); }); @@ -58,7 +58,7 @@ export default Wait('stop'); } }) - .error(function(data, status){ + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'POST to ' + url + ' returned: ' + status }); }); diff --git a/awx/ui/client/src/scheduler/factories/toggle-schedule.factory.js b/awx/ui/client/src/scheduler/factories/toggle-schedule.factory.js index d7abe88380..5c2b04e395 100644 --- a/awx/ui/client/src/scheduler/factories/toggle-schedule.factory.js +++ b/awx/ui/client/src/scheduler/factories/toggle-schedule.factory.js @@ -16,7 +16,7 @@ export default Wait('stop'); $state.go('.', null, {reload: true}); }) - .error( function(data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to update schedule ' + id + ' PUT returned: ' + status }); }); @@ -30,7 +30,7 @@ export default .then(({data}) => { scope.$emit('ScheduleFound', data); }) - .error(function(data,status){ + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve schedule ' + id + ' GET returned: ' + status }); }); diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index d69b762e8d..b040fbbc01 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -753,7 +753,7 @@ angular.module('Utilities', ['RestServices', 'Utilities']) .then(({data}) => { withOptions(data); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get ' + url + '. OPTIONS status: ' + status diff --git a/awx/ui/client/src/shared/api-loader.js b/awx/ui/client/src/shared/api-loader.js index 93fc604ab8..56f8bb6d9a 100644 --- a/awx/ui/client/src/shared/api-loader.js +++ b/awx/ui/client/src/shared/api-loader.js @@ -37,7 +37,7 @@ angular.module('ApiLoader', ['Utilities']) $rootScope.defaultUrls = data; Store('api', data); }) - .error(function (data, status) { + .catch(({data, status}) => { $rootScope.defaultUrls = { status: 'error' }; @@ -47,7 +47,7 @@ angular.module('ApiLoader', ['Utilities']) }); }); }) - .error(function (data, status) { + .catch(({data, status}) => { $rootScope.defaultUrls = { status: 'error' }; diff --git a/awx/ui/client/src/shared/load-config/load-config.factory.js b/awx/ui/client/src/shared/load-config/load-config.factory.js index ee8be4e754..4e6dad6a52 100644 --- a/awx/ui/client/src/shared/load-config/load-config.factory.js +++ b/awx/ui/client/src/shared/load-config/load-config.factory.js @@ -41,7 +41,7 @@ export default configInit(); - }).error(function(error) { + }).catch(({error}) => { $log.debug(error); configInit(); }); diff --git a/awx/ui/client/src/standard-out/log/standard-out-log.controller.js b/awx/ui/client/src/standard-out/log/standard-out-log.controller.js index c8f0c2abea..728f8faedf 100644 --- a/awx/ui/client/src/standard-out/log/standard-out-log.controller.js +++ b/awx/ui/client/src/standard-out/log/standard-out-log.controller.js @@ -117,7 +117,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce api_complete = true; } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status }); }); @@ -152,7 +152,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce } $('#stdoutMoreRowsBottom').fadeOut(400); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status }); }); @@ -170,7 +170,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce $('#pre-container-content').append(data.content); current_range = data.range; }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status }); }); diff --git a/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js b/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js index 0cf174dfcc..43b39da58c 100644 --- a/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js +++ b/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js @@ -25,7 +25,7 @@ scope.$emit(callback, data); } }) - .error(function(data, status) { + .catch(({data, status}) => { if (status === 403 && params.ignore_403) { return; } diff --git a/awx/ui/client/src/standard-out/standard-out.controller.js b/awx/ui/client/src/standard-out/standard-out.controller.js index e79c18bb0a..220eead31c 100644 --- a/awx/ui/client/src/standard-out/standard-out.controller.js +++ b/awx/ui/client/src/standard-out/standard-out.controller.js @@ -211,7 +211,7 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, } } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve job: ' + job_id + '. GET returned: ' + status }); }); diff --git a/awx/ui/client/src/teams/add/teams-add.controller.js b/awx/ui/client/src/teams/add/teams-add.controller.js index 873abcdb7a..e33c918a63 100644 --- a/awx/ui/client/src/teams/add/teams-add.controller.js +++ b/awx/ui/client/src/teams/add/teams-add.controller.js @@ -49,7 +49,7 @@ export default ['$scope', '$rootScope', 'TeamForm', 'GenerateForm', 'Rest', $rootScope.$broadcast("EditIndicatorChange", "users", data.id); $state.go('teams.edit', { team_id: data.id }, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { Wait('stop'); ProcessErrors($scope, data, status, form, { hdr: 'Error!', diff --git a/awx/ui/client/src/teams/edit/teams-edit.controller.js b/awx/ui/client/src/teams/edit/teams-edit.controller.js index 35394b975d..49c90c1316 100644 --- a/awx/ui/client/src/teams/edit/teams-edit.controller.js +++ b/awx/ui/client/src/teams/edit/teams-edit.controller.js @@ -77,7 +77,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest', Rest.put(data).then(() => { $state.go($state.current, null, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user: ' + diff --git a/awx/ui/client/src/teams/list/teams-list.controller.js b/awx/ui/client/src/teams/list/teams-list.controller.js index e8dff3f0cc..b4d0176213 100644 --- a/awx/ui/client/src/teams/list/teams-list.controller.js +++ b/awx/ui/client/src/teams/list/teams-list.controller.js @@ -65,7 +65,7 @@ export default ['$scope', 'Rest', 'TeamList', 'Prompt', $state.go('.', reloadListStateParams, { reload: true }); } }) - .error(function(data, status) { + .catch(({data, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors($scope, data, status, null, { diff --git a/awx/ui/client/src/templates/copy-template/template-copy.service.js b/awx/ui/client/src/templates/copy-template/template-copy.service.js index 931fd12423..8282facadc 100644 --- a/awx/ui/client/src/templates/copy-template/template-copy.service.js +++ b/awx/ui/client/src/templates/copy-template/template-copy.service.js @@ -15,7 +15,7 @@ .success(function(res){ return res; }) - .error(function(res, status){ + .catch(({res, status}) => { ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status}); }); @@ -46,7 +46,7 @@ return job_template_res; } }) - .error(function(res, status){ + .catch(({res, status}) => { ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status}); }); diff --git a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js index 3c0cd0d3ab..70920240ec 100644 --- a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js +++ b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js @@ -155,7 +155,7 @@ sync_playbook_select2(); Wait('stop'); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to get playbook list for ' + url + '. GET returned status: ' + status }); }); @@ -190,7 +190,7 @@ Alert('Warning', msg, 'alert-info alert-info--noTextTransform', null, null, null, null, true); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to get project ' + $scope.project + '. GET returned status: ' + status }); }); diff --git a/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js b/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js index 23b0bb4bf0..441cc5ce68 100644 --- a/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js +++ b/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js @@ -130,7 +130,7 @@ export default Alert('Warning', msg, 'alert-info alert-info--noTextTransform', null, null, null, null, true); } }) - .error(function (data, status) { + .catch(({data, status}) => { if (status === 403) { /* User doesn't have read access to the project, no problem. */ } else { @@ -725,7 +725,7 @@ export default .then(({data}) => { $scope.$emit('templateSaveSuccess', data); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update job template. PUT returned status: ' + status }); }); diff --git a/awx/ui/client/src/templates/labels/labelsList.directive.js b/awx/ui/client/src/templates/labels/labelsList.directive.js index 2dfe6ae061..180371c862 100644 --- a/awx/ui/client/src/templates/labels/labelsList.directive.js +++ b/awx/ui/client/src/templates/labels/labelsList.directive.js @@ -75,7 +75,7 @@ export default Wait('stop'); $state.go('.', null, {reload: true}); }) - .error(function (data, status) { + .catch(({data, status}) => { Wait('stop'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Could not disassociate label from JT. Call to ' + url + ' failed. DELETE returned status: ' + status }); diff --git a/awx/ui/client/src/templates/list/templates-list.controller.js b/awx/ui/client/src/templates/list/templates-list.controller.js index 47567d7c62..f9fefeb2b2 100644 --- a/awx/ui/client/src/templates/list/templates-list.controller.js +++ b/awx/ui/client/src/templates/list/templates-list.controller.js @@ -211,7 +211,7 @@ export default ['$scope', '$rootScope', } }); }) - .error(function(res, status){ + .catch(({res, status}) => { ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', msg: 'Call failed. Return status: '+ status}); }); diff --git a/awx/ui/client/src/templates/survey-maker/surveys/delete.factory.js b/awx/ui/client/src/templates/survey-maker/surveys/delete.factory.js index c02d3733b8..a1ee5d3660 100644 --- a/awx/ui/client/src/templates/survey-maker/surveys/delete.factory.js +++ b/awx/ui/client/src/templates/survey-maker/surveys/delete.factory.js @@ -45,7 +45,7 @@ export default scope.$emit("SurveyDeleted"); }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, { hdr: 'Error!', msg: 'Failed to delete survey. DELETE returned status: ' + status }); }); diff --git a/awx/ui/client/src/templates/survey-maker/surveys/edit.factory.js b/awx/ui/client/src/templates/survey-maker/surveys/edit.factory.js index 526a2bde4c..790822e628 100644 --- a/awx/ui/client/src/templates/survey-maker/surveys/edit.factory.js +++ b/awx/ui/client/src/templates/survey-maker/surveys/edit.factory.js @@ -45,7 +45,7 @@ export default } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve survey. GET returned status: ' + status }); }); diff --git a/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js b/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js index a98428c828..3a13f4f70c 100644 --- a/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js +++ b/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js @@ -84,7 +84,7 @@ export default .then(() => { }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to add new survey. POST returned status: ' + status }); }); @@ -101,7 +101,7 @@ export default .then(() => { }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to save survey_enabled: GET status: ' + status diff --git a/awx/ui/client/src/templates/templates.service.js b/awx/ui/client/src/templates/templates.service.js index 77c4ac215c..cc322a0fb1 100644 --- a/awx/ui/client/src/templates/templates.service.js +++ b/awx/ui/client/src/templates/templates.service.js @@ -261,7 +261,7 @@ export default ['Rest', 'GetBasePath', '$q', 'NextPage', function(Rest, GetBaseP Rest.options() .then(({data}) => { deferred.resolve(data); - }).error(function(msg, code) { + }).catch(({msg, code}) => { deferred.reject(msg, code); }); @@ -276,7 +276,7 @@ export default ['Rest', 'GetBasePath', '$q', 'NextPage', function(Rest, GetBaseP Rest.options() .then(({data}) => { deferred.resolve(data); - }).error(function(msg, code) { + }).catch(({msg, code}) => { deferred.reject(msg, code); }); diff --git a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js index 0a945398a2..14153cb5aa 100644 --- a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js +++ b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js @@ -894,7 +894,7 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge goToJobResults(res.results[0].type); } }) - .error(function (data, status) { + .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Unable to get job: ' + status }); }); } diff --git a/awx/ui/client/src/users/add/users-add.controller.js b/awx/ui/client/src/users/add/users-add.controller.js index 76bb739986..081ae21a90 100644 --- a/awx/ui/client/src/users/add/users-add.controller.js +++ b/awx/ui/client/src/users/add/users-add.controller.js @@ -95,7 +95,7 @@ export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest', ReturnToCaller(1); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, form, { hdr: i18n._('Error!'), msg: i18n._('Failed to add new user. POST returned status: ') + status }); }); } else { diff --git a/awx/ui/client/src/users/edit/users-edit.controller.js b/awx/ui/client/src/users/edit/users-edit.controller.js index c5b958ed77..a8639bc1f5 100644 --- a/awx/ui/client/src/users/edit/users-edit.controller.js +++ b/awx/ui/client/src/users/edit/users-edit.controller.js @@ -75,7 +75,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', setScopeFields(data); Wait('stop'); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Failed to retrieve user: %s. GET status: '), $stateParams.id) + status @@ -175,7 +175,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', Rest.put(data).then(() => { $state.go($state.current, null, { reload: true }); }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Failed to retrieve user: %s. GET status: '), $stateParams.id) + status diff --git a/awx/ui/client/src/users/list/users-list.controller.js b/awx/ui/client/src/users/list/users-list.controller.js index 38e4995cbe..99ea9dedcf 100644 --- a/awx/ui/client/src/users/list/users-list.controller.js +++ b/awx/ui/client/src/users/list/users-list.controller.js @@ -77,7 +77,7 @@ export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt', $state.go('.', null, { reload: true }); } }) - .error(function(data, status) { + .catch(({data, status}) => { ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), msg: i18n.sprintf(i18n._('Call to %s failed. DELETE returned status: '), url) + status diff --git a/awx/ui/client/src/workflow-results/workflow-results.route.js b/awx/ui/client/src/workflow-results/workflow-results.route.js index fb54118aa4..83e86de83e 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.route.js +++ b/awx/ui/client/src/workflow-results/workflow-results.route.js @@ -77,7 +77,7 @@ export default { defer.resolve(data.results); } }) - .error(function() { + .catch(() => { // TODO: handle this //defer.resolve(data); }); diff --git a/awx/ui/client/src/workflow-results/workflow-results.service.js b/awx/ui/client/src/workflow-results/workflow-results.service.js index 22b4bd0a0b..af360226d4 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.service.js +++ b/awx/ui/client/src/workflow-results/workflow-results.service.js @@ -50,7 +50,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr $('#prompt-modal').modal('hide'); $state.go('jobs'); }) - .error(function(obj, status) { + .catch(({obj, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(null, obj, status, null, { @@ -71,7 +71,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr Wait('stop'); $('#prompt-modal').modal('hide'); }) - .error(function(obj, status) { + .catch(({obj, status}) => { Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(null, obj, status, null, {