From fabdab78ef6635bf0686ef5fa15873e1032adb1f Mon Sep 17 00:00:00 2001 From: Ben Thomasson Date: Wed, 4 Oct 2017 11:43:29 -0400 Subject: [PATCH 1/9] Upgrade AngularJS to 1.6.6 --- awx/ui/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui/package.json b/awx/ui/package.json index 971f206e15..4525ecea47 100644 --- a/awx/ui/package.json +++ b/awx/ui/package.json @@ -92,7 +92,7 @@ }, "dependencies": { "@uirouter/angularjs": "^1.0.7", - "angular": "~1.4.14", + "angular": "~1.6.6", "angular-breadcrumb": "git+https://git@github.com/ansible/angular-breadcrumb#0.4.1", "angular-codemirror": "git+https://git@github.com/ansible/angular-codemirror#1.0.4", "angular-cookies": "~1.4.14", @@ -110,7 +110,7 @@ "bootstrap-datepicker": "^1.7.1", "codemirror": "^5.17.0", "components-font-awesome": "^4.6.1", - "d3": "~3.3.13", + "d3": "~3.5.4", "javascript-detect-element-resize": "^0.5.3", "jquery": "~2.2.4", "jquery-ui": "~1.10.5", @@ -120,7 +120,7 @@ "lr-infinite-scroll": "git+https://git@github.com/lorenzofox3/lrInfiniteScroll", "moment": "~2.10.0", "ng-toast": "git+https://git@github.com/ansible/ngToast#2.0.1", - "nvd3": "git+https://git@github.com/ansible/nvd3#1.7.1", + "nvd3": "git+https://git@github.com/benthomasson/nvd3#1.7.1", "reconnectingwebsocket": "^1.0.0", "rrule": "git+https://git@github.com/jkbrzt/rrule#4ff63b2f8524fd6d5ba6e80db770953b5cd08a0c", "select2": "^4.0.2", From 834e6c692c8eb889a35baac41d71af91fa83aabd Mon Sep 17 00:00:00 2001 From: Ben Thomasson Date: Wed, 4 Oct 2017 13:18:30 -0400 Subject: [PATCH 2/9] Automatically change instances of .success to .then with this linux script: #Run in awx/awx/ui/client/src #!/bin/bash -ex FILES=`grep -l -R "\.success(\s*function\s*(data)\s*{" . | xargs` sed -i "s/\.success(\s*function\s*(data)\s*{/\.then(({data}) => {/g" $FILES FILES=`grep -l -R "\.success(\s*function\s*()\s*{" . | xargs` sed -i "s/\.success(\s*function\s*()\s*{/\.then(() => {/g" $FILES FILES=`grep -l -R "\.success(this\.success\.bind(this))" . | xargs` sed -i "s/\.success(this\.success\.bind(this))/\.then(this\.then\.bind(this))/g" $FILES --- .../src/access/permissions-list.controller.js | 4 ++-- .../rbac-role-column/roleList.directive.js | 2 +- .../configuration/configuration.service.js | 6 ++--- .../credential-types/add/add.controller.js | 2 +- .../credential-types/edit/edit.controller.js | 2 +- .../credential-types/list/list.controller.js | 2 +- .../factories/credential-form-save.factory.js | 4 ++-- .../list/credentials-list.controller.js | 2 +- awx/ui/client/src/home/home.controller.js | 12 +++++----- .../inventories/adhoc/adhoc.controller.js | 2 +- .../host-summary-popover.controller.js | 2 +- .../list/inventory-list.controller.js | 2 +- .../source-summary-popover.controller.js | 2 +- .../relatedGroupsLabelsList.directive.js | 6 ++--- .../sources/add/sources-add.controller.js | 2 +- .../sources/edit/sources-edit.controller.js | 2 +- .../factories/cancel-source-update.factory.js | 6 ++--- .../get-source-type-options.factory.js | 2 +- .../factories/view-update-status.factory.js | 2 +- .../related/sources/sources.service.js | 22 ++++++++--------- .../add/smart-inventory-add.controller.js | 2 +- .../edit/smart-inventory-edit.controller.js | 2 +- .../ansible-facts/ansible-facts.route.js | 2 +- .../shared/groups.service.js | 24 +++++++++---------- .../inventories-hosts/shared/hosts.service.js | 8 +++---- .../shared/inventories.service.js | 10 ++++---- .../inventory-scripts/add/add.controller.js | 4 ++-- .../inventory-scripts/edit/edit.controller.js | 2 +- .../inventory-scripts/list/list.controller.js | 2 +- .../src/job-results/job-results.route.js | 6 ++--- .../src/job-results/job-results.service.js | 10 ++++---- .../adhoc-run.factory.js | 6 ++--- .../check-passwords.factory.js | 2 +- .../getsurveyquestions.factory.js | 2 +- .../inventory-update.factory.js | 2 +- .../launchjob.factory.js | 4 ++-- .../project-update.factory.js | 2 +- .../job-submission.controller.js | 2 +- .../src/jobs/factories/delete-job.factory.js | 6 ++--- .../factories/relaunch-inventory.factory.js | 2 +- .../client/src/license/license.controller.js | 2 +- .../login/loginModal/loginModal.controller.js | 2 +- .../management-jobs/card/card.controller.js | 6 ++--- .../src/notifications/add/add.controller.js | 6 ++--- .../src/notifications/edit/edit.controller.js | 4 ++-- .../list.controller.js | 2 +- .../shared/notification-list-init.factory.js | 2 +- .../shared/toggle-notification.factory.js | 2 +- .../add/organizations-add.controller.js | 2 +- .../edit/organizations-edit.controller.js | 4 ++-- .../organizations-admins.controller.js | 4 ++-- .../organizations-inventories.controller.js | 6 ++--- .../organizations-job-templates.controller.js | 2 +- .../organizations-projects.controller.js | 12 +++++----- .../organizations-teams.controller.js | 2 +- .../organizations-users.controller.js | 4 ++-- .../list/organizations-list.controller.js | 2 +- .../projects/add/projects-add.controller.js | 4 ++-- .../projects/edit/projects-edit.controller.js | 6 ++--- .../factories/get-project-path.factory.js | 2 +- .../projects/list/projects-list.controller.js | 12 +++++----- .../client/src/rest/restServices.factory.js | 2 +- .../factories/delete-schedule.factory.js | 2 +- .../factories/edit-schedule.factory.js | 2 +- .../factories/schedule-post.factory.js | 4 ++-- .../factories/toggle-schedule.factory.js | 4 ++-- awx/ui/client/src/shared/Utilities.js | 2 +- awx/ui/client/src/shared/api-loader.js | 4 ++-- awx/ui/client/src/shared/directives.js | 2 +- .../org-admin-lookup.factory.js | 2 +- awx/ui/client/src/shared/rbacUiControl.js | 2 +- .../log/standard-out-log.controller.js | 6 ++--- .../lookup-name.factory.js | 2 +- .../standard-out/standard-out.controller.js | 2 +- .../src/teams/add/teams-add.controller.js | 4 ++-- .../src/teams/edit/teams-edit.controller.js | 4 ++-- .../src/teams/list/teams-list.controller.js | 2 +- .../job-template-add.controller.js | 8 +++---- .../job-template-edit.controller.js | 12 +++++----- .../templates/labels/labelsList.directive.js | 6 ++--- .../survey-maker/surveys/delete.factory.js | 2 +- .../survey-maker/surveys/edit.factory.js | 2 +- .../survey-maker/surveys/init.factory.js | 4 ++-- .../client/src/templates/templates.service.js | 4 ++-- .../add-workflow/workflow-add.controller.js | 2 +- .../edit-workflow/workflow-edit.controller.js | 6 ++--- .../src/users/add/users-add.controller.js | 4 ++-- .../src/users/edit/users-edit.controller.js | 4 ++-- .../src/users/list/users-list.controller.js | 2 +- .../workflow-results.route.js | 6 ++--- .../workflow-results.service.js | 6 ++--- 91 files changed, 194 insertions(+), 194 deletions(-) diff --git a/awx/ui/client/src/access/permissions-list.controller.js b/awx/ui/client/src/access/permissions-list.controller.js index f36ee5fa64..3e190625ba 100644 --- a/awx/ui/client/src/access/permissions-list.controller.js +++ b/awx/ui/client/src/access/permissions-list.controller.js @@ -21,7 +21,7 @@ export default ['$scope', 'ListDefinition', 'Dataset', 'Wait', 'Rest', 'ProcessE Wait('start'); Rest.setUrl(url); Rest.post({ "disassociate": true, "id": Number(userId) }) - .success(function() { + .then(() => { Wait('stop'); $state.go('.', null, {reload: true}); }) @@ -54,7 +54,7 @@ export default ['$scope', 'ListDefinition', 'Dataset', 'Wait', 'Rest', 'ProcessE Wait('start'); Rest.setUrl(url); Rest.post({ "disassociate": true, "id": teamId }) - .success(function() { + .then(() => { Wait('stop'); $state.go('.', null, {reload: true}); }) 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 ec3b79754d..4f750ee1b5 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 @@ -53,7 +53,7 @@ export default Rest.setUrl(url); Rest.post({ "disassociate": true, "id": entry.id }) - .success(function() { + .then(() => { Wait('stop'); $state.go('.', null, { reload: true }); }) diff --git a/awx/ui/client/src/configuration/configuration.service.js b/awx/ui/client/src/configuration/configuration.service.js index a26b0996a4..d4ec6a7da2 100644 --- a/awx/ui/client/src/configuration/configuration.service.js +++ b/awx/ui/client/src/configuration/configuration.service.js @@ -15,7 +15,7 @@ export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Re Rest.setUrl(url); Rest.options() - .success(function(data) { + .then(({data}) => { // Compare GET actions with PUT actions and flag discrepancies // for disabling in the UI var getActions = data.actions.GET; @@ -47,7 +47,7 @@ export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Re Rest.setUrl(url); Rest.patch(body) - .success(function(data) { + .then(({data}) => { deferred.resolve(data); }) .error(function(error) { @@ -61,7 +61,7 @@ export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Re var deferred = $q.defer(); Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { deferred.resolve(data); }) .error(function(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 bc7e284fd2..0929716d6b 100644 --- a/awx/ui/client/src/credential-types/add/add.controller.js +++ b/awx/ui/client/src/credential-types/add/add.controller.js @@ -99,7 +99,7 @@ export default ['Rest', 'Wait', inputs: inputs, injectors: injectors }) - .success(function(data) { + .then(({data}) => { $state.go('credentialTypes.edit', { credential_type_id: data.id }, { reload: true }); Wait('stop'); }) 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 42cd0ebadd..95266cec78 100644 --- a/awx/ui/client/src/credential-types/edit/edit.controller.js +++ b/awx/ui/client/src/credential-types/edit/edit.controller.js @@ -173,7 +173,7 @@ export default ['Rest', 'Wait', inputs: inputs, injectors: injectors }) - .success(function() { + .then(() => { $state.go($state.current, null, { reload: true }); Wait('stop'); }) 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 912a8b01a9..3a14a33513 100644 --- a/awx/ui/client/src/credential-types/list/list.controller.js +++ b/awx/ui/client/src/credential-types/list/list.controller.js @@ -60,7 +60,7 @@ export default ['$rootScope', '$scope', 'Wait', 'CredentialTypesList', var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { let reloadListStateParams = null; 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 ec47648497..496a95e3ae 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 @@ -51,7 +51,7 @@ export default url = GetBasePath("credentials"); Rest.setUrl(url); Rest.post(data) - .success(function (data) { + .then(({data}) => { scope.addedItem = data.id; Wait('stop'); @@ -83,7 +83,7 @@ export default url = GetBasePath('credentials') + scope.id + '/'; Rest.setUrl(url); Rest.put(data) - .success(function () { + .then(() => { Wait('stop'); $state.go($state.current, {}, {reload: true}); }) 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 924f58e367..e006b76fe2 100644 --- a/awx/ui/client/src/credentials/list/credentials-list.controller.js +++ b/awx/ui/client/src/credentials/list/credentials-list.controller.js @@ -85,7 +85,7 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', ' var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { let reloadListStateParams = null; diff --git a/awx/ui/client/src/home/home.controller.js b/awx/ui/client/src/home/home.controller.js index 3b70235c84..57e53d208f 100644 --- a/awx/ui/client/src/home/home.controller.js +++ b/awx/ui/client/src/home/home.controller.js @@ -14,7 +14,7 @@ export default ['$scope', '$rootScope','Wait', $scope.$on('ws-jobs', function () { Rest.setUrl(GetBasePath('dashboard')); Rest.get() - .success(function (data) { + .then(({data}) => { $scope.dashboardData = data; }) .error(function (data, status) { @@ -23,7 +23,7 @@ export default ['$scope', '$rootScope','Wait', Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job"); Rest.get() - .success(function (data) { + .then(({data}) => { $scope.dashboardJobsListData = data.results; }) .error(function (data, status) { @@ -32,7 +32,7 @@ export default ['$scope', '$rootScope','Wait', 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"); Rest.get() - .success(function (data) { + .then(({data}) => { $scope.dashboardJobTemplatesListData = data.results; }) .error(function (data, status) { @@ -90,7 +90,7 @@ export default ['$scope', '$rootScope','Wait', Wait('start'); Rest.setUrl(GetBasePath('dashboard')); Rest.get() - .success(function (data) { + .then(({data}) => { $scope.dashboardData = data; $scope.$emit('dashboardReady', data); }) @@ -99,7 +99,7 @@ export default ['$scope', '$rootScope','Wait', }); Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job"); Rest.get() - .success(function (data) { + .then(({data}) => { data = data.results; $scope.$emit('dashboardJobsListReady', data); }) @@ -108,7 +108,7 @@ export default ['$scope', '$rootScope','Wait', }); 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"); Rest.get() - .success(function (data) { + .then(({data}) => { data = data.results; $scope.$emit('dashboardJobTemplatesListReady', data); }) 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 86534a5871..490d05a7b9 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 @@ -239,7 +239,7 @@ function adhocController($q, $scope, $stateParams, // Launch the adhoc job Rest.setUrl(GetBasePath('inventory') + id + '/ad_hoc_commands/'); Rest.post(data) - .success(function (data) { + .then(({data}) => { Wait('stop'); $state.go('adHocJobStdout', {id: data.id}); }) 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 8dd449df82..53e56e0163 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 @@ -10,7 +10,7 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError url += "&order_by=-finished&page_size=5"; Rest.setUrl(url); Rest.get() - .success( function(data) { + .then(({data}) => { $scope.generateTable(data, event); }) .error( function(data, 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 f6d8e0534f..76a63dcdd2 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 @@ -85,7 +85,7 @@ function InventoriesList($scope, $('#prompt-modal').modal('hide'); Rest.setUrl(url); Rest.destroy() - .success(function () { + .then(() => { Wait('stop'); }) .error(function (data, 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 0b32903df8..77303ce704 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 @@ -6,7 +6,7 @@ export default [ '$scope', 'Wait', 'Empty', 'Rest', 'ProcessErrors', '$state', Wait('start'); Rest.setUrl($scope.inventory.related.inventory_sources + '?order_by=-last_job_run&page_size=5'); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.generateTable(data, event); }) .error(function(data, 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 e115871c4a..eacda2b133 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 @@ -22,7 +22,7 @@ export default var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.next) { getNext(data, arr.concat(data.results), resolve); } else { @@ -35,7 +35,7 @@ export default var seeMoreResolve = $q.defer(); Rest.setUrl(`${scope[scope.$parent.list.iterator].related.groups}?order_by=id`); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.next) { getNext(data, data.results, seeMoreResolve); } else { @@ -65,7 +65,7 @@ export default if(url) { Rest.setUrl(url); Rest.post({"disassociate": true, "id": host.id}) - .success(function () { + .then(() => { Wait('stop'); $state.go('.', null, {reload: true}); }) 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 248ecbff60..9faa35e62d 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 @@ -36,7 +36,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', Wait('start'); Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { $scope.inventory_files = data; $scope.inventory_files.push("/ (project root)"); sync_inventory_file_select2(); 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 4728e2747a..1d4d965be4 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 @@ -116,7 +116,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', Wait('start'); Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { $scope.inventory_files = data; $scope.inventory_files.push("/ (project root)"); 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 a0fb73e7eb..d89c5fca5e 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 @@ -16,18 +16,18 @@ export default Wait('start'); Rest.setUrl(inventory_source.url); Rest.get() - .success(function (data) { + .then(({data}) => { // Check that we have access to cancelling an update var url = (data.related.current_update) ? data.related.current_update : data.related.last_update; url += 'cancel/'; Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.can_cancel) { // Cancel the update process Rest.setUrl(url); Rest.post() - .success(function () { + .then(() => { Wait('stop'); //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'); 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 659c1c112a..3d98a9ed5e 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 @@ -8,7 +8,7 @@ export default scope[variable] = []; Rest.setUrl(GetBasePath('inventory_sources')); Rest.options() - .success(function (data) { + .then(({data}) => { var i, choices = data.actions.GET.source.choices; for (i = 0; i < choices.length; i++) { if (choices[i][0] !== 'file' && choices[i][0] !== "") { 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 5a746aa075..0543681644 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 @@ -13,7 +13,7 @@ export default Wait('start'); Rest.setUrl(inventory_source.url); Rest.get() - .success(function (data) { + .then(({data}) => { // Get the ID from the correct summary field var update_id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id; 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 8ae2d144b7..71bbebdfdb 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 @@ -23,7 +23,7 @@ export default this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -32,7 +32,7 @@ export default this.url = GetBasePath('inventory_sources'); Rest.setUrl(this.url); return Rest.post(inventory_source) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -41,7 +41,7 @@ export default this.url = GetBasePath('inventory_sources') + inventory_source.id; Rest.setUrl(this.url); return Rest.put(inventory_source) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -50,7 +50,7 @@ export default this.url = GetBasePath('inventory_sources') + id; Rest.setUrl(this.url); return Rest.destroy() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -58,7 +58,7 @@ export default this.url = GetBasePath('inventory_sources'); Rest.setUrl(this.url); return Rest.options() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)); }, getCredential: function(id){ @@ -66,7 +66,7 @@ export default this.url = GetBasePath('credentials') + id; Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -75,7 +75,7 @@ export default this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -84,7 +84,7 @@ export default this.url = url; Rest.setUrl(this.url); return Rest.put(params) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -94,7 +94,7 @@ export default this.url = GetBasePath('groups') + target + '/children/'; Rest.setUrl(this.url); return Rest.post(group) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -103,7 +103,7 @@ export default this.url = GetBasePath('groups') + parent + '/children/'; Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -112,7 +112,7 @@ export default this.url = GetBasePath('inventory') + inventory + '/groups/'; Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, 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 533bf256a9..4c00bc92b2 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 @@ -60,7 +60,7 @@ function SmartInventoryAdd($scope, $location, Rest.setUrl(defaultUrl); Rest.post(data) - .success(function(data) { + .then(({data}) => { const inventory_id = data.id, instance_group_url = data.related.instance_groups; 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 3621413cd8..8b235842a8 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 @@ -77,7 +77,7 @@ function SmartInventoryEdit($scope, $location, Rest.setUrl(defaultUrl + inventory_id + '/'); Rest.put(data) - .success(function() { + .then(() => { InstanceGroupsService.editInstanceGroups(instance_group_url, $scope.instance_groups) .then(() => { Wait('stop'); diff --git a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js b/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js index cbac4735db..045fe535dd 100644 --- a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js +++ b/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js @@ -18,7 +18,7 @@ export default { let ansibleFactsUrl = GetBasePath('hosts') + $stateParams.host_id + '/ansible_facts'; Rest.setUrl(ansibleFactsUrl); return Rest.get() - .success(function(data) { + .then(({data}) => { return data; }); } 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 b3d947a832..491600ee72 100644 --- a/awx/ui/client/src/inventories-hosts/shared/groups.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/groups.service.js @@ -23,7 +23,7 @@ export default this.url = GetBasePath('groups') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -32,7 +32,7 @@ export default this.url = GetBasePath('groups'); Rest.setUrl(this.url); return Rest.post(group) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -41,7 +41,7 @@ export default this.url = GetBasePath('groups') + group.id; Rest.setUrl(this.url); return Rest.put(group) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -50,7 +50,7 @@ export default this.url = GetBasePath('groups') + id; Rest.setUrl(this.url); return Rest.destroy() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -59,7 +59,7 @@ export default this.url = GetBasePath('credentials') + id; Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -68,7 +68,7 @@ export default this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -77,7 +77,7 @@ export default this.url = url; Rest.setUrl(this.url); return Rest.put(params) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -87,7 +87,7 @@ export default this.url = GetBasePath('groups') + target + '/children/'; Rest.setUrl(this.url); return Rest.post(group) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -96,7 +96,7 @@ export default this.url = GetBasePath('groups') + parent + '/children/'; Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -105,7 +105,7 @@ export default this.url = GetBasePath('groups') + target + '/hosts/'; Rest.setUrl(this.url); return Rest.post(host) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -114,7 +114,7 @@ export default this.url = GetBasePath('groups') + group + '/hosts/'; Rest.setUrl(this.url); return Rest.post({id: host, disassociate: 1}) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -123,7 +123,7 @@ export default this.url = GetBasePath('inventory') + inventory + '/groups/'; Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.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 5e6a8cc0c9..20ba74a809 100644 --- a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js @@ -30,7 +30,7 @@ this.url = GetBasePath('hosts') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -39,7 +39,7 @@ this.url = GetBasePath('hosts'); Rest.setUrl(this.url); return Rest.post(host) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -48,7 +48,7 @@ this.url = GetBasePath('hosts') + host.id; Rest.setUrl(this.url); return Rest.put(host) - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -57,7 +57,7 @@ this.url = GetBasePath('hosts') + id; Rest.setUrl(this.url); return Rest.destroy() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.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 9ca46ba998..370895f07f 100644 --- a/awx/ui/client/src/inventories-hosts/shared/inventories.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/inventories.service.js @@ -25,7 +25,7 @@ this.url = GetBasePath('inventory') + id; Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -36,7 +36,7 @@ }).join(''); Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)) .finally(Wait('stop')); }, @@ -60,21 +60,21 @@ this.url = GetBasePath('inventory') + inventoryId + '/inventory_sources'; Rest.setUrl(this.url); return Rest.options() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)); }, updateInventorySourcesGet: function(inventoryId) { this.url = GetBasePath('inventory') + inventoryId + '/update_inventory_sources'; Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.bind(this)); }, getHost: function(inventoryId, hostId) { this.url = GetBasePath('inventory') + inventoryId + '/hosts?id=' + hostId; Rest.setUrl(this.url); return Rest.get() - .success(this.success.bind(this)) + .then(this.then.bind(this)) .error(this.error.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 5b162c2c4c..26e6d6801b 100644 --- a/awx/ui/client/src/inventory-scripts/add/add.controller.js +++ b/awx/ui/client/src/inventory-scripts/add/add.controller.js @@ -19,7 +19,7 @@ export default ['Rest', 'Wait', function init() { Rest.setUrl(url); Rest.options() - .success(function(data) { + .then(({data}) => { if (!data.actions.POST) { $state.go("^"); Alert('Permission Error', 'You do not have permission to add an inventory script.', 'alert-info'); @@ -43,7 +43,7 @@ export default ['Rest', 'Wait', organization: $scope.organization, script: $scope.script }) - .success(function() { + .then(() => { $state.go('inventoryScripts', null, { reload: true }); Wait('stop'); }) 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 44b58fe197..6655a529bd 100644 --- a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js +++ b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js @@ -59,7 +59,7 @@ export default ['Rest', 'Wait', organization: $scope.organization, script: $scope.script }) - .success(function() { + .then(() => { $state.go('inventoryScripts', null, { reload: true }); Wait('stop'); }) 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 cd28c440d4..0108ae1549 100644 --- a/awx/ui/client/src/inventory-scripts/list/list.controller.js +++ b/awx/ui/client/src/inventory-scripts/list/list.controller.js @@ -50,7 +50,7 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList', var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { let reloadListStateParams = null; 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 c648558779..b7c453358d 100644 --- a/awx/ui/client/src/job-results/job-results.route.js +++ b/awx/ui/client/src/job-results/job-results.route.js @@ -76,7 +76,7 @@ export default { Rest.setUrl(jobData.related.job_events + "?event=playbook_on_stats"); Rest.get() - .success(function(data) { + .then(({data}) => { if(!data.results[0]){ defer.resolve({val: { ok: 0, @@ -131,7 +131,7 @@ export default { var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.next) { getNext(data, arr.concat(data.results), resolve); } else { @@ -145,7 +145,7 @@ export default { Rest.setUrl(GetBasePath('jobs') + $stateParams.id + '/labels/'); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.next) { getNext(data, data.results, seeMoreResolve); } else { 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 0db4d4cca4..b1c40bab10 100644 --- a/awx/ui/client/src/job-results/job-results.service.js +++ b/awx/ui/client/src/job-results/job-results.service.js @@ -73,7 +73,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { val.resolve({results: data.results, next: data.next}); }) @@ -101,7 +101,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo Wait('start'); Rest.setUrl(job.url); Rest.destroy() - .success(function() { + .then(() => { Wait('stop'); $('#prompt-modal').modal('hide'); $state.go('jobs'); @@ -123,7 +123,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo var doCancel = function() { Rest.setUrl(job.url + 'cancel'); Rest.post({}) - .success(function() { + .then(() => { Wait('stop'); $('#prompt-modal').modal('hide'); }) @@ -150,7 +150,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo Wait('start'); Rest.setUrl(job.url + 'cancel'); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.can_cancel === true) { doCancel(); } else { @@ -239,7 +239,7 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo url = url + id + '/job_events/?' + this.stringifyParams(params); Rest.setUrl(url); return Rest.get() - .success(function(data){ + .then(({data}) => { return data; }) .error(function(data, 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 333fe5caae..dde8e79b36 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 @@ -59,7 +59,7 @@ Wait('start'); Rest.setUrl(GetBasePath('ad_hoc_commands') + new_job_id + '/'); Rest.destroy() - .success(function() { + .then(() => { Wait('stop'); }) .error(function (data, status) { @@ -86,7 +86,7 @@ // Re-launch the adhoc job Rest.setUrl(url); Rest.post(postData) - .success(function (data) { + .then(({data}) => { Wait('stop'); if($location.path().replace(/^\//, '').split('/')[0] !== 'jobs') { $state.go('adHocJobStdout', {id: data.id}); @@ -133,7 +133,7 @@ url = GetBasePath('ad_hoc_commands') + id + '/relaunch/'; Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { new_job_id = data.id; scope.passwords_needed_to_start = data.passwords_needed_to_start; 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 850b043663..9da4dd2042 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 @@ -9,7 +9,7 @@ export default if (!Empty(credential)) { Rest.setUrl(GetBasePath('credentials')+credential); Rest.get() - .success(function (data) { + .then(({data}) => { credentialTypesLookup() .then(kinds => { if(data.credential_type === kinds.Machine && data.inputs){ 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 4b633d3eaa..4d18d3fdcf 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 @@ -20,7 +20,7 @@ export default Rest.setUrl(survey_url); Rest.get() - .success(function (data) { + .then(({data}) => { if(!Empty(data)){ scope.survey_name = data.name; scope.survey_description = data.description; 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 f6fb49c727..3ed55607e5 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 @@ -42,7 +42,7 @@ export default Wait('start'); Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { if(params.updateAllSources) { scope.$emit('StartTheUpdate', {}); } 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 22059756cc..96f79304f4 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 @@ -139,7 +139,7 @@ export default Rest.setUrl(url); Rest.post(job_launch_data) - .success(function(data) { + .then(({data}) => { Wait('stop'); var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command; if(base !== 'portal' && Empty(data.system_job) || (base === 'home')){ @@ -200,7 +200,7 @@ export default var getExtraVars = function() { Rest.setUrl(vars_url); Rest.get() - .success(function (data) { + .then(({data}) => { if(!Empty(data.extra_vars)){ data.extra_vars = ToJSON('yaml', data.extra_vars, false); $.each(data.extra_vars, function(key,value){ 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 b089127600..5e69365cd6 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 @@ -43,7 +43,7 @@ export default Wait('start'); Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { project = data; if (project.can_update) { if (project.passwords_needed_to_updated) { 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 9fb0ece241..5bc21c793c 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -152,7 +152,7 @@ export default Wait('start'); Rest.setUrl(launch_url); Rest.get() - .success(function (data) { + .then(({data}) => { // Put all the data that we get back about the launch onto scope angular.extend($scope, data); 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 7157b9fa93..7829d7637a 100644 --- a/awx/ui/client/src/jobs/factories/delete-job.factory.js +++ b/awx/ui/client/src/jobs/factories/delete-job.factory.js @@ -42,7 +42,7 @@ Rest.setUrl(url); if (action_label === 'cancel') { Rest.post() - .success(function () { + .then(() => { $('#prompt-modal').modal('hide'); if (callback) { scope.$emit(callback, action_label); @@ -64,7 +64,7 @@ }); } else { Rest.destroy() - .success(function () { + .then(() => { $('#prompt-modal').modal('hide'); if (callback) { scope.$emit(callback, action_label); @@ -119,7 +119,7 @@ if (action_label === 'cancel') { Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.can_cancel) { scope.$emit('CancelJob'); } 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 0630c27419..2070da46d6 100644 --- a/awx/ui/client/src/jobs/factories/relaunch-inventory.factory.js +++ b/awx/ui/client/src/jobs/factories/relaunch-inventory.factory.js @@ -7,7 +7,7 @@ export default Wait('start'); Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { InventoryUpdate({ scope: scope, url: data.related.update diff --git a/awx/ui/client/src/license/license.controller.js b/awx/ui/client/src/license/license.controller.js index 25911b28e2..c5b5fcf532 100644 --- a/awx/ui/client/src/license/license.controller.js +++ b/awx/ui/client/src/license/license.controller.js @@ -86,7 +86,7 @@ export default $scope.submit = function(){ Wait('start'); CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula) - .success(function(){ + .then(() => { reset(); ConfigService.delete(); ConfigService.getConfig().then(function(config){ diff --git a/awx/ui/client/src/login/loginModal/loginModal.controller.js b/awx/ui/client/src/login/loginModal/loginModal.controller.js index 0ad7817a82..419c8c3734 100644 --- a/awx/ui/client/src/login/loginModal/loginModal.controller.js +++ b/awx/ui/client/src/login/loginModal/loginModal.controller.js @@ -139,7 +139,7 @@ export default ['$log', '$cookies', '$compile', '$rootScope', scope.removeAuthorizationGetUser = scope.$on('AuthorizationGetUser', function() { // Get all the profile/access info regarding the logged in user Authorization.getUser() - .success(function (data) { + .then(({data}) => { Authorization.setUserInfo(data); Timer.init().then(function(timer){ $rootScope.sessionTimer = timer; 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 a422782b04..a7de633af1 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -20,7 +20,7 @@ export default var getManagementJobs = function(){ Rest.setUrl(defaultUrl); Rest.get() - .success(function(data){ + .then(({data}) => { $scope.mgmtCards = data.results; Wait('stop'); }) @@ -128,7 +128,7 @@ export default Rest.setUrl(defaultUrl); Rest.post(data) - .success(function(data) { + .then(({data}) => { Wait('stop'); $("#prompt-for-days-facts").dialog("close"); $("#configure-dialog").dialog('close'); @@ -218,7 +218,7 @@ export default Rest.setUrl(defaultUrl); Rest.post(data) - .success(function(data) { + .then(({data}) => { Wait('stop'); $("#prompt-for-days").dialog("close"); // $("#configure-dialog").dialog('close'); diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index e0d2759acc..a7fafa4e77 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -24,7 +24,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', function init() { Rest.setUrl(GetBasePath('projects')); Rest.options() - .success(function(data) { + .then(({data}) => { if (!data.actions.POST) { $state.go("^"); Alert('Permission Error', 'You do not have permission to add a notification template.', 'alert-info'); @@ -48,7 +48,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; }) .error(function(data, status) { @@ -213,7 +213,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', Wait('start'); Rest.setUrl(url); Rest.post(params) - .success(function() { + .then(() => { $state.go('notifications', {}, { reload: true }); Wait('stop'); }) diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index a87d273313..bed35b562f 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -59,7 +59,7 @@ export default ['Rest', 'Wait', Wait('start'); Rest.setUrl(url + id + '/'); Rest.get() - .success(function(data) { + .then(({data}) => { var fld; for (fld in form.fields) { if (data[fld]) { @@ -280,7 +280,7 @@ export default ['Rest', 'Wait', Wait('start'); Rest.setUrl(url + id + '/'); Rest.put(params) - .success(function() { + .then(() => { $state.go('notifications', {}, { reload: true }); Wait('stop'); }) 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 ba11f5cd9d..cb20e18d17 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 @@ -164,7 +164,7 @@ var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { let reloadListStateParams = null; 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 981e7721a3..a51169942c 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 @@ -26,7 +26,7 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices', Rest.setUrl($rootScope.current_user.related.admin_of_organizations); Rest.get() - .success(function(data) { + .then(({data}) => { scope.current_user_admin_orgs = data.results.map(i => i.name); }); 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 c2638f76b1..3e32b13a0e 100644 --- a/awx/ui/client/src/notifications/shared/toggle-notification.factory.js +++ b/awx/ui/client/src/notifications/shared/toggle-notification.factory.js @@ -39,7 +39,7 @@ export default ['Wait', 'ProcessErrors', 'Rest', Wait('start'); Rest.setUrl(url); Rest.post(params) - .success( function(data) { + .then(({data}) => { if (callback) { scope.$emit(callback, data.id); notifier[column] = !notifier[column]; diff --git a/awx/ui/client/src/organizations/add/organizations-add.controller.js b/awx/ui/client/src/organizations/add/organizations-add.controller.js index fbd0957153..009f9240e6 100644 --- a/awx/ui/client/src/organizations/add/organizations-add.controller.js +++ b/awx/ui/client/src/organizations/add/organizations-add.controller.js @@ -12,7 +12,7 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', Rest.setUrl(GetBasePath('organizations')); Rest.options() - .success(function(data) { + .then(({data}) => { if (!data.actions.POST) { $state.go("^"); Alert('Permission Error', 'You do not have permission to add an organization.', 'alert-info'); 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 7c74e1e3cb..431521c033 100644 --- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js +++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js @@ -36,7 +36,7 @@ export default ['$scope', '$location', '$stateParams', Wait('start'); Rest.setUrl(defaultUrl + id + '/'); Rest.get() - .success(function(data) { + .then(({data}) => { let fld; $scope.organization_name = data.name; @@ -124,7 +124,7 @@ export default ['$scope', '$location', '$stateParams', var url = defaultUrl + $stateParams.organization_id + '/' + set + '/'; Rest.setUrl(url); Rest.post({ id: itm_id, disassociate: 1 }) - .success(function() { + .then(() => { $('#prompt-modal').modal('hide'); }) .error(function(data, status) { 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 c7de39ca84..fc7e9bb08a 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 @@ -24,7 +24,7 @@ export default ['$stateParams', '$scope', 'Rest', '$state', Rest.setUrl(orgBase + $stateParams.organization_id); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; $scope.name = data.name; $scope.org_id = data.id; @@ -51,7 +51,7 @@ export default ['$stateParams', '$scope', 'Rest', '$state', Rest.post({ id: id, disassociate: true - }).success(function() { + }).then(() => { $state.go('.', null, { reload: true }); }) .error(function(data, 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 44bf60bb62..fd8cf0c193 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 @@ -28,7 +28,7 @@ export default ['$scope', '$rootScope', '$location', $rootScope.flashMessage = null; Rest.setUrl(orgBase + $stateParams.organization_id); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; $scope.name = data.name; @@ -194,7 +194,7 @@ export default ['$scope', '$rootScope', '$location', Wait('start'); Rest.setUrl(inventory.related.inventory_sources + '?or__source=ec2&or__source=rax&order_by=-last_job_run&page_size=5'); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.$emit('GroupSummaryReady', event, inventory, data); }) .error(function(data, status) { @@ -218,7 +218,7 @@ export default ['$scope', '$rootScope', '$location', url += "&order_by=-finished&page_size=5"; Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.$emit('HostSummaryReady', event, data); }) .error(function(data, 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 682ceb477e..f58c1364ee 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 @@ -34,7 +34,7 @@ export default ['$scope', '$rootScope', $scope[list.name] = $scope[`${list.iterator}_dataset`].results; Rest.setUrl(orgBase + $stateParams.organization_id); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; $scope.name = data.name; $scope.org_id = data.id; 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 e1bc8e72eb..6311ccaf5c 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 @@ -99,7 +99,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', // Go out and get the organization Rest.setUrl(orgBase + $stateParams.organization_id); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; $scope.name = data.name; $scope.org_id = data.id; @@ -205,7 +205,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', // Refresh what we have in memory to insure we're accessing the most recent status record Rest.setUrl(project.url); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.$emit('GoTojobResults', data); }) .error(function(data, status) { @@ -224,7 +224,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', // Cancel the project update process Rest.setUrl(url); Rest.post() - .success(function() { + .then(() => { Alert('SCM Update Cancel', 'Your request to cancel the update was submitted to the task manager.', 'alert-info'); $scope.refresh(); }) @@ -241,7 +241,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', var url = data.related.cancel; Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.can_cancel) { $scope.$emit('Cancel_Update', url); } else { @@ -257,11 +257,11 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', $scope.cancelUpdate = function(id, name) { Rest.setUrl(GetBasePath("projects") + id); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.related.current_update) { Rest.setUrl(data.related.current_update); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.$emit('Check_Cancel', data); }) .error(function(data, status) { diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js index d706ffb75c..c4b9435d1d 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js @@ -30,7 +30,7 @@ export default ['$scope', '$stateParams', 'OrgTeamList', 'Rest', 'OrgTeamsDatase Rest.setUrl(orgBase + $stateParams.organization_id); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; $scope.name = data.name; 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 ed2fbeeaa9..bc2ed1c7a2 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 @@ -23,7 +23,7 @@ export default ['$stateParams', '$scope', 'OrgUserList','Rest', '$state', Rest.setUrl(orgBase + $stateParams.organization_id); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.organization_name = data.name; $scope.name = data.name; $scope.org_id = data.id; @@ -50,7 +50,7 @@ export default ['$stateParams', '$scope', 'OrgUserList','Rest', '$state', Rest.post({ id: id, disassociate: true - }).success(function() { + }).then(() => { $state.go('.', null, { reload: true }); }) .error(function(data, 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 c47da2c5fd..4b700a218b 100644 --- a/awx/ui/client/src/organizations/list/organizations-list.controller.js +++ b/awx/ui/client/src/organizations/list/organizations-list.controller.js @@ -143,7 +143,7 @@ export default ['$stateParams', '$scope', '$rootScope', var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { Wait('stop'); let reloadListStateParams = null; 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 1891c92ff6..64e044989e 100644 --- a/awx/ui/client/src/projects/add/projects-add.controller.js +++ b/awx/ui/client/src/projects/add/projects-add.controller.js @@ -23,7 +23,7 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm', $scope.canEditOrg = true; Rest.setUrl(GetBasePath('projects')); Rest.options() - .success(function(data) { + .then(({data}) => { if (!data.actions.POST) { $state.go("^"); Alert(i18n._('Permission Error'), i18n._('You do not have permission to add a project.'), 'alert-info'); @@ -99,7 +99,7 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm', Wait('start'); Rest.setUrl(url); Rest.post(data) - .success(function(data) { + .then(({data}) => { $scope.addedItem = data.id; $state.go('projects.edit', { project_id: data.id }, { reload: true }); }) 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 4ac43a8160..d694eeb592 100644 --- a/awx/ui/client/src/projects/edit/projects-edit.controller.js +++ b/awx/ui/client/src/projects/edit/projects-edit.controller.js @@ -85,7 +85,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', // Retrieve detail record and prepopulate the form Rest.setUrl(defaultUrl); Rest.get({ params: { id: id } }) - .success(function(data) { + .then(({data}) => { var fld, i; for (fld in form.fields) { if (form.fields[fld].type === 'checkbox_group') { @@ -214,7 +214,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', Rest.setUrl(defaultUrl); Rest.put(params) - .success(function() { + .then(() => { Wait('stop'); $state.go($state.current, {}, { reload: true }); }) @@ -230,7 +230,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', $rootScope.flashMessage = null; Rest.setUrl(url); Rest.post({ id: itm_id, disassociate: 1 }) - .success(function() { + .then(() => { $('#prompt-modal').modal('hide'); }) .error(function(data, 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 1a48772ff9..414385c7be 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 @@ -26,7 +26,7 @@ export default Rest.setUrl(GetBasePath('config')); Rest.get() - .success(function (data) { + .then(({data}) => { var opts = [], i; if (data.project_local_paths) { for (i = 0; i < data.project_local_paths.length; i++) { 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 9ce0f5b807..aca57f2649 100644 --- a/awx/ui/client/src/projects/list/projects-list.controller.js +++ b/awx/ui/client/src/projects/list/projects-list.controller.js @@ -162,7 +162,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', // Refresh what we have in memory to insure we're accessing the most recent status record Rest.setUrl(project.url); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.$emit('GoTojobResults', data); }) .error(function(data, status) { @@ -179,7 +179,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { let reloadListStateParams = null; @@ -218,7 +218,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', // Cancel the project update process Rest.setUrl(url); Rest.post() - .success(function () { + .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) { @@ -234,7 +234,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', var url = data.related.cancel; Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.can_cancel) { $scope.$emit('Cancel_Update', url); } else { @@ -251,11 +251,11 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', project.pending_cancellation = true; Rest.setUrl(GetBasePath("projects") + project.id); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.related.current_update) { Rest.setUrl(data.related.current_update); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.$emit('Check_Cancel', data); }) .error(function (data, status) { diff --git a/awx/ui/client/src/rest/restServices.factory.js b/awx/ui/client/src/rest/restServices.factory.js index 148a1a8994..08c4ea9ca0 100644 --- a/awx/ui/client/src/rest/restServices.factory.js +++ b/awx/ui/client/src/rest/restServices.factory.js @@ -38,7 +38,7 @@ * var url = GetBasePath('inventories') + $stateParams.id + '/'; * Rest.setUrl(url); * Rest.get() - * .success(function(data) { + * .then(({data}) => { * // review the data object and take action * }) * .error(function(status, data) { 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 45b8eca7bb..537f9146bf 100644 --- a/awx/ui/client/src/scheduler/factories/delete-schedule.factory.js +++ b/awx/ui/client/src/scheduler/factories/delete-schedule.factory.js @@ -22,7 +22,7 @@ export default Wait('start'); Rest.setUrl(url); Rest.destroy() - .success(function () { + .then(() => { $('#prompt-modal').modal('hide'); scope.$emit(callback, id); 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 de591aee08..9ca2d5191a 100644 --- a/awx/ui/client/src/scheduler/factories/edit-schedule.factory.js +++ b/awx/ui/client/src/scheduler/factories/edit-schedule.factory.js @@ -121,7 +121,7 @@ export default // Get the existing record Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { schedule = data; try { schedule.extra_data = JSON.parse(schedule.extra_data); 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 2c636f8b89..e3609516bb 100644 --- a/awx/ui/client/src/scheduler/factories/schedule-post.factory.js +++ b/awx/ui/client/src/scheduler/factories/schedule-post.factory.js @@ -35,7 +35,7 @@ export default Rest.setUrl(url); if (mode === 'add') { Rest.post(schedule) - .success(function(){ + .then(() => { if (callback) { scope.$emit(callback); } @@ -50,7 +50,7 @@ export default } else { Rest.put(schedule) - .success(function(){ + .then(() => { if (callback) { scope.$emit(callback, schedule); } 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 423c92227a..d7abe88380 100644 --- a/awx/ui/client/src/scheduler/factories/toggle-schedule.factory.js +++ b/awx/ui/client/src/scheduler/factories/toggle-schedule.factory.js @@ -12,7 +12,7 @@ export default scope.removeScheduleFound = scope.$on('ScheduleFound', function(e, data) { data.enabled = (data.enabled) ? false : true; Rest.put(data) - .success( function() { + .then(() => { Wait('stop'); $state.go('.', null, {reload: true}); }) @@ -27,7 +27,7 @@ export default // Get the schedule Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { scope.$emit('ScheduleFound', data); }) .error(function(data,status){ diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index 08bdff71aa..d69b762e8d 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -750,7 +750,7 @@ angular.module('Utilities', ['RestServices', 'Utilities']) if (!options) { Rest.setUrl(url); Rest.options() - .success(function(data) { + .then(({data}) => { withOptions(data); }) .error(function(data, status) { diff --git a/awx/ui/client/src/shared/api-loader.js b/awx/ui/client/src/shared/api-loader.js index 1dd41529d2..93fc604ab8 100644 --- a/awx/ui/client/src/shared/api-loader.js +++ b/awx/ui/client/src/shared/api-loader.js @@ -29,10 +29,10 @@ angular.module('ApiLoader', ['Utilities']) return function () { $http({ method: 'GET', url:'/api/', headers: { 'Authorization': "" } }) - .success(function (data) { + .then(({data}) => { var base = data.current_version; $http({ method: 'GET', url:base, headers: { 'Authorization': "" } }) - .success(function (data) { + .then(({data}) => { data.base = base; $rootScope.defaultUrls = data; Store('api', data); diff --git a/awx/ui/client/src/shared/directives.js b/awx/ui/client/src/shared/directives.js index 5bb0d30f96..2013c4392c 100644 --- a/awx/ui/client/src/shared/directives.js +++ b/awx/ui/client/src/shared/directives.js @@ -556,7 +556,7 @@ function(ConfigurationUtils, i18n, $rootScope) { Rest.setUrl(`${basePath}` + query); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.count === 1) { scope[modelKey] = data.results[0].name; scope[modelName] = data.results[0].id; diff --git a/awx/ui/client/src/shared/org-admin-lookup/org-admin-lookup.factory.js b/awx/ui/client/src/shared/org-admin-lookup/org-admin-lookup.factory.js index aa200ef984..12bea302cc 100644 --- a/awx/ui/client/src/shared/org-admin-lookup/org-admin-lookup.factory.js +++ b/awx/ui/client/src/shared/org-admin-lookup/org-admin-lookup.factory.js @@ -14,7 +14,7 @@ export default if(Authorization.getUserInfo('is_superuser') !== true) { Rest.setUrl(GetBasePath('users') + $rootScope.current_user.id + '/admin_of_organizations'); Rest.get({ params: { id: params.organization } }) - .success(function(data) { + .then(({data}) => { if(data.count && data.count > 0) { deferred.resolve(true); } diff --git a/awx/ui/client/src/shared/rbacUiControl.js b/awx/ui/client/src/shared/rbacUiControl.js index ee74951d43..84d053c5b6 100644 --- a/awx/ui/client/src/shared/rbacUiControl.js +++ b/awx/ui/client/src/shared/rbacUiControl.js @@ -18,7 +18,7 @@ export default Wait("start"); Rest.options() - .success(function(data) { + .then(({data}) => { if (data.actions.POST) { canAddVal.resolve({canAdd: true, options: data}); } else { 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 bf8a8f89ef..c8f0c2abea 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 @@ -98,7 +98,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce Rest.setUrl($scope.stdoutEndpoint + '?format=json&start_line=0&end_line=' + page_size); Rest.get() - .success(function(data) { + .then(({data}) => { Wait('stop'); if (data.content) { api_complete = true; @@ -134,7 +134,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce $('#stdoutMoreRowsBottom').fadeIn(); Rest.setUrl(url); Rest.get() - .success( function(data) { + .then(({data}) => { if ($('#pre-container-content').html() === "Waiting for results...") { $('#pre-container-content').html(data.content); } else { @@ -166,7 +166,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce '&end_line=' + (current_range.end + page_size); Rest.setUrl(url); Rest.get() - .success(function(data){ + .then(({data}) => { $('#pre-container-content').append(data.content); current_range = data.range; }) 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 7d2f865268..0cf174dfcc 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 @@ -13,7 +13,7 @@ callback = params.callback; Rest.setUrl(url); Rest.get() - .success(function(data) { + .then(({data}) => { if (scope_var === 'inventory_source') { scope.inventory = data.inventory; } 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 97b85f68b2..e79c18bb0a 100644 --- a/awx/ui/client/src/standard-out/standard-out.controller.js +++ b/awx/ui/client/src/standard-out/standard-out.controller.js @@ -79,7 +79,7 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, // of stdout jobs. Rest.setUrl(GetBasePath('base') + jobType + '/' + job_id + '/'); Rest.get() - .success(function(data) { + .then(({data}) => { $scope.job = data; $scope.job_template_name = data.name; $scope.created_by = data.summary_fields.created_by; 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 c309947b4d..873abcdb7a 100644 --- a/awx/ui/client/src/teams/add/teams-add.controller.js +++ b/awx/ui/client/src/teams/add/teams-add.controller.js @@ -11,7 +11,7 @@ export default ['$scope', '$rootScope', 'TeamForm', 'GenerateForm', 'Rest', Rest.setUrl(GetBasePath('teams')); Rest.options() - .success(function(data) { + .then(({data}) => { if (!data.actions.POST) { $state.go("^"); Alert('Permission Error', 'You do not have permission to add a team.', 'alert-info'); @@ -43,7 +43,7 @@ export default ['$scope', '$rootScope', 'TeamForm', 'GenerateForm', 'Rest', data[fld] = $scope[fld]; } Rest.post(data) - .success(function(data) { + .then(({data}) => { Wait('stop'); $rootScope.flashMessage = "New team successfully created!"; $rootScope.$broadcast("EditIndicatorChange", "users", data.id); 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 77166dfad5..35394b975d 100644 --- a/awx/ui/client/src/teams/edit/teams-edit.controller.js +++ b/awx/ui/client/src/teams/edit/teams-edit.controller.js @@ -19,7 +19,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest', $scope.team_id = id; Rest.setUrl(defaultUrl); Wait('start'); - Rest.get(defaultUrl).success(function(data) { + Rest.get(defaultUrl).then(({data}) => { setScopeFields(data); $scope.organization_name = data.summary_fields.organization.name; @@ -74,7 +74,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest', if ($scope[form.name + '_form'].$valid) { var data = processNewData(form.fields); Rest.setUrl(defaultUrl); - Rest.put(data).success(function() { + Rest.put(data).then(() => { $state.go($state.current, null, { reload: true }); }) .error(function(data, status) { 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 80ed78c241..e8dff3f0cc 100644 --- a/awx/ui/client/src/teams/list/teams-list.controller.js +++ b/awx/ui/client/src/teams/list/teams-list.controller.js @@ -48,7 +48,7 @@ export default ['$scope', 'Rest', 'TeamList', 'Prompt', var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { Wait('stop'); $('#prompt-modal').modal('hide'); 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 9cd73e1da7..3c0cd0d3ab 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 @@ -146,7 +146,7 @@ url = GetBasePath('projects') + $scope.project + '/playbooks/'; Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { var i, opts = []; for (i = 0; i < data.length; i++) { opts.push(data[i]); @@ -172,7 +172,7 @@ if (oldValue !== newValue && !Empty($scope.project)) { Rest.setUrl(GetBasePath('projects') + $scope.project + '/'); Rest.get() - .success(function (data) { + .then(({data}) => { var msg; switch (data.status) { case 'failed': @@ -394,7 +394,7 @@ Rest.setUrl(GetBasePath("organizations")); Rest.get() - .success(function(data) { + .then(({data}) => { orgDefer.resolve(data.results[0].id); }); @@ -434,7 +434,7 @@ Rest.post({ name: $scope.survey_name, description: $scope.survey_description, spec: $scope.survey_questions }) - .success(function () { + .then(() => { Wait('stop'); }) .error(function (data, 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 fa5d74219a..23b0bb4bf0 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 @@ -81,7 +81,7 @@ export default Wait('start'); Rest.setUrl(url); promises.push(Rest.get() - .success(function (data) { + .then(({data}) => { $scope.disablePlaybookBecausePermissionDenied = false; $scope.playbook_options = []; var playbookNotFound = true; @@ -112,7 +112,7 @@ export default Rest.setUrl(GetBasePath('projects') + $scope.project + '/'); promises.push(Rest.get() - .success(function (data) { + .then(({data}) => { var msg; switch (data.status) { case 'failed': @@ -539,7 +539,7 @@ export default var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.next) { getNext(data, arr.concat(data.results), resolve); } else { @@ -551,7 +551,7 @@ export default Rest.setUrl(data.related.labels); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.next) { getNext(data, data.results, associatedLabelsDefer); } else { @@ -578,7 +578,7 @@ export default Rest.setUrl(GetBasePath("organizations")); Rest.get() - .success(function(data) { + .then(({data}) => { orgDefer.resolve(data.results[0].id); }); @@ -722,7 +722,7 @@ export default Rest.setUrl(defaultUrl + $state.params.job_template_id); Rest.put(data) - .success(function (data) { + .then(({data}) => { $scope.$emit('templateSaveSuccess', data); }) .error(function (data, status) { diff --git a/awx/ui/client/src/templates/labels/labelsList.directive.js b/awx/ui/client/src/templates/labels/labelsList.directive.js index ba7bc06d1b..2dfe6ae061 100644 --- a/awx/ui/client/src/templates/labels/labelsList.directive.js +++ b/awx/ui/client/src/templates/labels/labelsList.directive.js @@ -21,7 +21,7 @@ export default var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.next) { getNext(data, arr.concat(data.results), resolve); } else { @@ -34,7 +34,7 @@ export default var seeMoreResolve = $q.defer(); Rest.setUrl(scope[scope.$parent.list.iterator].related.labels); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.next) { getNext(data, data.results, seeMoreResolve); } else { @@ -71,7 +71,7 @@ export default if(url) { Rest.setUrl(url); Rest.post({"disassociate": true, "id": label.id}) - .success(function () { + .then(() => { Wait('stop'); $state.go('.', null, {reload: true}); }) 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 48565727f4..c02d3733b8 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 @@ -41,7 +41,7 @@ export default Rest.setUrl(url); Rest.destroy() - .success(function () { + .then(() => { scope.$emit("SurveyDeleted"); }) 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 2f2cf2b754..526a2bde4c 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 @@ -31,7 +31,7 @@ export default // Get the existing record Rest.setUrl(url); Rest.get() - .success(function (data) { + .then(({data}) => { if(!Empty(data)){ ShowSurveyModal({ title: "Edit Survey", scope: scope, callback: 'DialogReady' }); scope.survey_name = data.name; 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 0a834febc3..a98428c828 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 @@ -81,7 +81,7 @@ export default Rest.setUrl(GetBasePath('workflow_job_templates') + id + '/survey_spec/'); } return Rest.post({name: scope.survey_name, description: scope.survey_description, spec: scope.survey_questions }) - .success(function () { + .then(() => { }) .error(function (data, status) { @@ -98,7 +98,7 @@ export default Rest.setUrl(GetBasePath('workflow_job_templates') + id+ '/'); } return Rest.patch({"survey_enabled": scope.survey_enabled}) - .success(function () { + .then(() => { }) .error(function (data, status) { diff --git a/awx/ui/client/src/templates/templates.service.js b/awx/ui/client/src/templates/templates.service.js index 1c9940cb0f..77c4ac215c 100644 --- a/awx/ui/client/src/templates/templates.service.js +++ b/awx/ui/client/src/templates/templates.service.js @@ -259,7 +259,7 @@ export default ['Rest', 'GetBasePath', '$q', 'NextPage', function(Rest, GetBaseP Rest.setUrl(url); Rest.options() - .success(function(data) { + .then(({data}) => { deferred.resolve(data); }).error(function(msg, code) { deferred.reject(msg, code); @@ -274,7 +274,7 @@ export default ['Rest', 'GetBasePath', '$q', 'NextPage', function(Rest, GetBaseP Rest.setUrl(url); Rest.options() - .success(function(data) { + .then(({data}) => { deferred.resolve(data); }).error(function(msg, code) { deferred.reject(msg, code); diff --git a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js index 6fdbff391d..c725dbf1c6 100644 --- a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js +++ b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js @@ -112,7 +112,7 @@ export default [ Rest.setUrl(GetBasePath("organizations")); Rest.get() - .success(function(data) { + .then(({data}) => { orgDefer.resolve(data.results[0].id); }); diff --git a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js index 71257b99e2..eead433902 100644 --- a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js +++ b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js @@ -181,7 +181,7 @@ export default [ var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.next) { getNext(data, arr.concat(data.results), resolve); } else { @@ -193,7 +193,7 @@ export default [ Rest.setUrl($scope.workflow_job_template_obj.related.labels); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.next) { getNext(data, data.results, associatedLabelsDefer); } else { @@ -220,7 +220,7 @@ export default [ Rest.setUrl(GetBasePath("organizations")); Rest.get() - .success(function(data) { + .then(({data}) => { orgDefer.resolve(data.results[0].id); }); 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 0f425bb316..76bb739986 100644 --- a/awx/ui/client/src/users/add/users-add.controller.js +++ b/awx/ui/client/src/users/add/users-add.controller.js @@ -37,7 +37,7 @@ export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest', Rest.setUrl(GetBasePath('users')); Rest.options() - .success(function(data) { + .then(({data}) => { if (!data.actions.POST) { $state.go("^"); Alert(i18n._('Permission Error'), i18n._('You do not have permission to add a user.'), 'alert-info'); @@ -85,7 +85,7 @@ export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest', data.is_system_auditor = $scope.is_system_auditor; Wait('start'); Rest.post(data) - .success(function(data) { + .then(({data}) => { var base = $location.path().replace(/^\//, '').split('/')[0]; if (base === 'users') { $rootScope.flashMessage = i18n._('New user successfully created!'); 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 dcef70314e..c5b958ed77 100644 --- a/awx/ui/client/src/users/edit/users-edit.controller.js +++ b/awx/ui/client/src/users/edit/users-edit.controller.js @@ -38,7 +38,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', $scope.$watch('is_superuser', hidePermissionsTabSmartSearchAndPaginationIfSuperUser($scope)); Rest.setUrl(defaultUrl); Wait('start'); - Rest.get(defaultUrl).success(function(data) { + Rest.get(defaultUrl).then(({data}) => { $scope.user_id = id; $scope.ldap_user = (data.ldap_dn !== null && data.ldap_dn !== undefined && data.ldap_dn !== '') ? true : false; $scope.not_ldap_user = !$scope.ldap_user; @@ -172,7 +172,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', if ($scope[form.name + '_form'].$valid) { Rest.setUrl(defaultUrl + '/'); var data = processNewData(form.fields); - Rest.put(data).success(function() { + Rest.put(data).then(() => { $state.go($state.current, null, { reload: true }); }) .error(function(data, 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 d3dd6a7df8..38e4995cbe 100644 --- a/awx/ui/client/src/users/list/users-list.controller.js +++ b/awx/ui/client/src/users/list/users-list.controller.js @@ -62,7 +62,7 @@ export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt', var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() - .success(function() { + .then(() => { let reloadListStateParams = null; 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 168f0b8329..fb54118aa4 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.route.js +++ b/awx/ui/client/src/workflow-results/workflow-results.route.js @@ -51,7 +51,7 @@ export default { var defer = $q.defer(); Rest.setUrl(workflowData.related.workflow_nodes + '?order_by=id'); Rest.get() - .success(function(data) { + .then(({data}) => { if(data.next) { let allNodes = data.results; let getNodes = function(nextUrl){ @@ -101,7 +101,7 @@ export default { var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() - .success(function (data) { + .then(({data}) => { if (data.next) { getNext(data, arr.concat(data.results), resolve); } else { @@ -115,7 +115,7 @@ export default { Rest.setUrl(GetBasePath('workflow_jobs') + $stateParams.id + '/labels/'); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.next) { getNext(data, data.results, seeMoreResolve); } else { 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 f6cf877596..22b4bd0a0b 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.service.js +++ b/awx/ui/client/src/workflow-results/workflow-results.service.js @@ -45,7 +45,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr Wait('start'); Rest.setUrl(workflow.url); Rest.destroy() - .success(function() { + .then(() => { Wait('stop'); $('#prompt-modal').modal('hide'); $state.go('jobs'); @@ -67,7 +67,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr var doCancel = function() { Rest.setUrl(workflow.url + 'cancel'); Rest.post({}) - .success(function() { + .then(() => { Wait('stop'); $('#prompt-modal').modal('hide'); }) @@ -94,7 +94,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr Wait('start'); Rest.setUrl(workflow.url + 'cancel'); Rest.get() - .success(function(data) { + .then(({data}) => { if (data.can_cancel === true) { doCancel(); } else { From 7d767f8f634615aadb81b39ae12878bb475b9370 Mon Sep 17 00:00:00 2001 From: Ben Thomasson Date: Wed, 4 Oct 2017 13:24:00 -0400 Subject: [PATCH 3/9] Automatically change .error to .catch. Use this script to change .error to .catch using this linux script: #!/bin/bash -ex #Run in awx/awx/ui/client/src FILES=`grep -l -R "\.error(\s*function\s*(data,\s*status)\s*{" . | xargs` sed -i "s/\.error(\s*function\s*(data,\s*status)\s*{/.catch(({data, status}) => {/g" $FILES FILES=`grep -l -R "\.error(this\.error\.bind(this))" . | xargs` sed -i "s/\.error(this\.error\.bind(this))/\.catch(this\.catch\.bind(this))/g" $FILES FILES=`grep -l -R "\.error(\s*function\s*(error)\s*{" . | xargs` sed -i "s/\.error(\s*function\s*(error)\s*{/.catch(({error}) => {/g" $FILES FILES=`grep -l -R "\.error(\s*function\s*(obj,\s*status)\s*{" . | xargs` sed -i "s/\.error(\s*function\s*(obj,\s*status)\s*{/.catch(({obj, status}) => {/g" $FILES FILES=`grep -l -R "\.error(\s*function\s*(res,\s*status)\s*{" . | xargs` sed -i "s/\.error(\s*function\s*(res,\s*status)\s*{/.catch(({res, status}) => {/g" $FILES FILES=`grep -l -R "\.error(\s*function\s*(msg,\s*code)\s*{" . | xargs` sed -i "s/\.error(\s*function\s*(msg,\s*code)\s*{/.catch(({msg, code}) => {/g" $FILES FILES=`grep -l -R "\.error(\s*function\s*()\s*{" . | xargs` sed -i "s/\.error(\s*function\s*()\s*{/.catch(() => {/g" $FILES --- .../src/access/permissions-list.controller.js | 4 ++-- .../rbac-role-column/roleList.directive.js | 2 +- .../configuration/configuration.service.js | 6 ++--- .../credential-types/add/add.controller.js | 2 +- .../credential-types/edit/edit.controller.js | 2 +- .../credential-types/list/list.controller.js | 2 +- .../factories/credential-form-save.factory.js | 4 ++-- .../list/credentials-list.controller.js | 2 +- awx/ui/client/src/home/home.controller.js | 12 +++++----- .../inventories/adhoc/adhoc.controller.js | 2 +- .../host-summary-popover.controller.js | 2 +- .../list/inventory-list.controller.js | 2 +- .../source-summary-popover.controller.js | 2 +- .../relatedGroupsLabelsList.directive.js | 2 +- .../sources/add/sources-add.controller.js | 2 +- .../sources/edit/sources-edit.controller.js | 2 +- .../factories/cancel-source-update.factory.js | 6 ++--- .../get-source-type-options.factory.js | 2 +- .../factories/view-update-status.factory.js | 2 +- .../related/sources/sources.service.js | 22 ++++++++--------- .../add/smart-inventory-add.controller.js | 2 +- .../edit/smart-inventory-edit.controller.js | 2 +- .../shared/groups.service.js | 24 +++++++++---------- .../inventories-hosts/shared/hosts.service.js | 8 +++---- .../shared/inventories.service.js | 10 ++++---- .../inventory-scripts/add/add.controller.js | 2 +- .../inventory-scripts/edit/edit.controller.js | 2 +- .../inventory-scripts/list/list.controller.js | 2 +- .../src/job-results/job-results.route.js | 2 +- .../src/job-results/job-results.service.js | 8 +++---- .../adhoc-run.factory.js | 6 ++--- .../check-passwords.factory.js | 2 +- .../getsurveyquestions.factory.js | 2 +- .../inventory-update.factory.js | 2 +- .../launchjob.factory.js | 4 ++-- .../project-update.factory.js | 2 +- .../job-submission.controller.js | 4 ++-- .../src/jobs/factories/delete-job.factory.js | 6 ++--- .../factories/relaunch-inventory.factory.js | 2 +- .../src/license/checkLicense.factory.js | 2 +- .../login/loginModal/loginModal.controller.js | 2 +- .../management-jobs/card/card.controller.js | 6 ++--- .../src/notifications/add/add.controller.js | 4 ++-- .../src/notifications/edit/edit.controller.js | 4 ++-- .../list.controller.js | 2 +- .../shared/notification-list-init.factory.js | 2 +- .../shared/toggle-notification.factory.js | 2 +- .../edit/organizations-edit.controller.js | 2 +- .../organizations-admins.controller.js | 2 +- .../organizations-inventories.controller.js | 4 ++-- .../organizations-job-templates.controller.js | 2 +- .../organizations-projects.controller.js | 10 ++++---- .../organizations-users.controller.js | 2 +- .../list/organizations-list.controller.js | 4 ++-- .../projects/add/projects-add.controller.js | 2 +- .../projects/edit/projects-edit.controller.js | 6 ++--- .../factories/get-project-path.factory.js | 2 +- .../projects/list/projects-list.controller.js | 12 +++++----- .../factories/delete-schedule.factory.js | 2 +- .../factories/edit-schedule.factory.js | 2 +- .../factories/schedule-post.factory.js | 4 ++-- .../factories/toggle-schedule.factory.js | 4 ++-- awx/ui/client/src/shared/Utilities.js | 2 +- awx/ui/client/src/shared/api-loader.js | 4 ++-- .../shared/load-config/load-config.factory.js | 2 +- .../log/standard-out-log.controller.js | 6 ++--- .../lookup-name.factory.js | 2 +- .../standard-out/standard-out.controller.js | 2 +- .../src/teams/add/teams-add.controller.js | 2 +- .../src/teams/edit/teams-edit.controller.js | 2 +- .../src/teams/list/teams-list.controller.js | 2 +- .../copy-template/template-copy.service.js | 4 ++-- .../job-template-add.controller.js | 4 ++-- .../job-template-edit.controller.js | 4 ++-- .../templates/labels/labelsList.directive.js | 2 +- .../list/templates-list.controller.js | 2 +- .../survey-maker/surveys/delete.factory.js | 2 +- .../survey-maker/surveys/edit.factory.js | 2 +- .../survey-maker/surveys/init.factory.js | 4 ++-- .../client/src/templates/templates.service.js | 4 ++-- .../workflow-chart.directive.js | 2 +- .../src/users/add/users-add.controller.js | 2 +- .../src/users/edit/users-edit.controller.js | 4 ++-- .../src/users/list/users-list.controller.js | 2 +- .../workflow-results.route.js | 2 +- .../workflow-results.service.js | 4 ++-- 86 files changed, 163 insertions(+), 163 deletions(-) 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, { From b3c2f353586aed346a0a3a3a0315ddb75e6c37b2 Mon Sep 17 00:00:00 2001 From: Ben Thomasson Date: Wed, 4 Oct 2017 13:49:03 -0400 Subject: [PATCH 4/9] Change success to then manually --- .../src/shared/load-config/load-config.factory.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 4e6dad6a52..2c89ff97a8 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 @@ -24,17 +24,17 @@ export default method: 'GET', url: '/api/', }) - .success(function(response) { - if(response.custom_logo) { + .then(function({data}) { + if({data}.custom_logo) { configSettings.custom_logo = true; - $rootScope.custom_logo = response.custom_logo; + $rootScope.custom_logo = {data}.custom_logo; } else { configSettings.custom_logo = false; } - if(response.custom_login_info) { - configSettings.custom_login_info = response.custom_login_info; - $rootScope.custom_login_info = response.custom_login_info; + if({data}.custom_login_info) { + configSettings.custom_login_info = {data}.custom_login_info; + $rootScope.custom_login_info = {data}.custom_login_info; } else { configSettings.custom_login_info = false; } From b544922da1a84ceaca3dd93859601425efb94df0 Mon Sep 17 00:00:00 2001 From: Ben Thomasson Date: Wed, 4 Oct 2017 13:55:50 -0400 Subject: [PATCH 5/9] Fix incorrect JS syntax --- .../src/shared/load-config/load-config.factory.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 2c89ff97a8..ca12f1739b 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 @@ -25,16 +25,16 @@ export default url: '/api/', }) .then(function({data}) { - if({data}.custom_logo) { + if(data.custom_logo) { configSettings.custom_logo = true; - $rootScope.custom_logo = {data}.custom_logo; + $rootScope.custom_logo = data.custom_logo; } else { configSettings.custom_logo = false; } - if({data}.custom_login_info) { - configSettings.custom_login_info = {data}.custom_login_info; - $rootScope.custom_login_info = {data}.custom_login_info; + if(data.custom_login_info) { + configSettings.custom_login_info = data.custom_login_info; + $rootScope.custom_login_info = data.custom_login_info; } else { configSettings.custom_login_info = false; } From cee81e9df643d3803799c11a1a4878eba2f8f8f6 Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Thu, 12 Oct 2017 09:33:57 -0400 Subject: [PATCH 6/9] Fix any unhandled rejections --- .../components/truncate/truncate.directive.js | 20 +- awx/ui/client/src/app.js | 5 +- .../related/groups/edit/groups-edit.route.js | 2 +- .../hosts/edit/standard-host-edit.route.js | 4 +- .../nested-groups/host-nested-groups.route.js | 4 +- .../sources/add/sources-add.controller.js | 4 +- .../sources/edit/sources-edit.route.js | 6 +- .../sources/list/sources-list.controller.js | 2 +- .../sources/list/sources-list.route.js | 2 +- .../related/sources/sources.service.js | 270 +++++++++--------- .../shared/groups.service.js | 48 ++-- .../inventories-hosts/shared/hosts.service.js | 16 +- .../shared/inventories.service.js | 20 +- .../host-event/host-event.route.js | 3 +- .../src/job-results/job-results.service.js | 4 +- .../job-submission.controller.js | 21 +- .../src/license/checkLicense.factory.js | 4 +- .../list.controller.js | 5 +- .../shared/notification-list-init.factory.js | 8 +- .../organizations-job-templates.controller.js | 20 +- awx/ui/client/src/scheduler/main.js | 6 +- .../src/scheduler/schedulerAdd.controller.js | 2 +- awx/ui/client/src/shared/rbacUiControl.js | 3 +- .../src/shared/socket/socket.service.js | 2 + .../copy-template/template-copy.service.js | 30 +- .../job-template-edit.controller.js | 9 +- .../list/templates-list.controller.js | 22 +- awx/ui/npm-debug.log.1254872885 | 0 awx/ui/npm-debug.log.3063400582 | 0 awx/ui/package.json | 7 +- npm-debug.log.1381475670 | 0 npm-debug.log.2251662136 | 0 32 files changed, 279 insertions(+), 270 deletions(-) create mode 100644 awx/ui/npm-debug.log.1254872885 create mode 100644 awx/ui/npm-debug.log.3063400582 create mode 100644 npm-debug.log.1381475670 create mode 100644 npm-debug.log.2251662136 diff --git a/awx/ui/client/lib/components/truncate/truncate.directive.js b/awx/ui/client/lib/components/truncate/truncate.directive.js index a2aa6b14ab..8cc3df8bef 100644 --- a/awx/ui/client/lib/components/truncate/truncate.directive.js +++ b/awx/ui/client/lib/components/truncate/truncate.directive.js @@ -22,6 +22,16 @@ function AtTruncateController (strings) { vm.truncatedString = string.substring(0, maxlength); }; + vm.copyToClipboard = () => { + vm.tooltip.popover.text = vm.strings.get('truncate.COPIED'); + + const textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0]; + textarea.value = string; + textarea.select(); + + document.execCommand('copy'); + }; + vm.tooltip = { popover: { text: vm.strings.get('truncate.DEFAULT'), @@ -32,16 +42,6 @@ function AtTruncateController (strings) { click: vm.copyToClipboard } }; - - vm.copyToClipboard = () => { - vm.tooltip.popover.text = vm.strings.get('truncate.COPIED'); - - const textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0]; - textarea.value = string; - textarea.select(); - - document.execCommand('copy'); - }; } AtTruncateController.$inject = ['ComponentsStrings']; diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index d57ffa44ee..e1667e6fb8 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -114,6 +114,9 @@ angular .constant('AngularScheduler.useTimezone', true) .constant('AngularScheduler.showUTCField', true) .constant('$timezones.definitions.location', urlPrefix + 'lib/angular-tz-extensions/tz/data') + .config(['$locationProvider', function($locationProvider) { + $locationProvider.hashPrefix(''); + }]) .config(['$logProvider', function($logProvider) { $logProvider.debugEnabled($ENV['ng-debug'] || false); }]) @@ -176,7 +179,7 @@ angular LoadConfig, Store, pendoService, Prompt, Rest, Wait, ProcessErrors, $state, GetBasePath, ConfigService, FeaturesService, $filter, SocketService, AppStrings, $transitions) { - + $rootScope.$state = $state; $rootScope.$state.matches = function(stateName) { return $state.current.name.search(stateName) > 0; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js index 77f3f33653..0fbdd763c7 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js @@ -19,7 +19,7 @@ export default { }, resolve: { groupData: ['$stateParams', 'GroupsService', function($stateParams, GroupsService) { - return GroupsService.get({ id: $stateParams.group_id }).then(res => res.data.results[0]); + return GroupsService.get({ id: $stateParams.group_id }).then(response => response.data.results[0]); }] } }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js index 53fb28d48f..432037658f 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js @@ -19,9 +19,7 @@ export default { }, resolve: { host: ['$stateParams', 'HostsService', function($stateParams, HostsService) { - return HostsService.get({ id: $stateParams.host_id }).then(function(res) { - return res.data.results[0]; - }); + return HostsService.get({ id: $stateParams.host_id }).then((response) => response.data.results[0]); }] } }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js index 4600eecb63..7f3a82a493 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js @@ -58,9 +58,7 @@ export default { ], host: ['$stateParams', 'HostsService', function($stateParams, HostsService) { if($stateParams.host_id){ - return HostsService.get({ id: $stateParams.host_id }).then(function(res) { - return res.data.results[0]; - }); + return HostsService.get({ id: $stateParams.host_id }).then((res) => res.data.results[0]); } }], inventoryData: ['InventoriesService', '$stateParams', 'host', function(InventoriesService, $stateParams, host) { 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 9819795f29..943acefb3a 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 @@ -322,8 +322,8 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', } else { params.source = null; } - SourcesService.post(params).then(function(res){ - let inventory_source_id = res.data.id; + SourcesService.post(params).then((response) => { + let inventory_source_id = response.data.id; $state.go('^.edit', {inventory_source_id: inventory_source_id}, {reload: true}); }); }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js index 4560a1f6ba..c73c7840b4 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js @@ -21,13 +21,11 @@ export default { }, resolve: { inventorySourceData: ['$stateParams', 'SourcesService', function($stateParams, SourcesService) { - return SourcesService.get({id: $stateParams.inventory_source_id }).then(res => res.data.results[0]); + return SourcesService.get({id: $stateParams.inventory_source_id }).then(response => response.data.results[0]); }], inventorySourcesOptions: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) { return InventoriesService.inventorySourcesOptions($stateParams.inventory_id) - .then(function(res) { - return res.data; - }); + .then((response) => response.data); }] } }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js index 6561fe6fc9..0d806bb4e3 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js @@ -47,7 +47,7 @@ let path = GetBasePath('inventory') + $stateParams.inventory_id + '/inventory_sources'; qs.search(path, $state.params[`${list.iterator}_search`]) - .then(function(searchResponse) { + .then((searchResponse)=> { $scope[`${list.iterator}_dataset`] = searchResponse.data; $scope[list.name] = $scope[`${list.iterator}_dataset`].results; _.forEach($scope[list.name], buildStatusIndicators); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js index 3d4d99546d..c9d9882581 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js @@ -40,7 +40,7 @@ export default { }, resolve: { inventorySourceOptions: ['SourcesService', (SourcesService) => { - return SourcesService.options().then(res => res.data.actions.GET); + return SourcesService.options().then(response => response.data.actions.GET); }], Dataset: ['SourcesListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => { 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 10ec28da54..ce3ff77c0f 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 @@ -1,137 +1,137 @@ export default - ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){ - return { - stringifyParams: function(params){ - return _.reduce(params, (result, value, key) => { - return result + key + '=' + value + '&'; - }, ''); - }, - // cute abstractions via fn.bind() - url: function(){ - return ''; - }, - error: function(data, status) { - ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', - msg: 'Call to ' + this.url + '. GET returned: ' + status }); - }, - success: function(data){ - return data; - }, - // HTTP methods - get: function(params){ - Wait('start'); - this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); - Rest.setUrl(this.url); - return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - post: function(inventory_source){ - Wait('start'); - this.url = GetBasePath('inventory_sources'); - Rest.setUrl(this.url); - return Rest.post(inventory_source) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - put: function(inventory_source){ - Wait('start'); - this.url = GetBasePath('inventory_sources') + inventory_source.id; - Rest.setUrl(this.url); - return Rest.put(inventory_source) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - delete: function(id){ - Wait('start'); - this.url = GetBasePath('inventory_sources') + id; - Rest.setUrl(this.url); - return Rest.destroy() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - options: function(){ - this.url = GetBasePath('inventory_sources'); - Rest.setUrl(this.url); - return Rest.options() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)); - }, - getCredential: function(id){ - Wait('start'); - this.url = GetBasePath('credentials') + id; - Rest.setUrl(this.url); - return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - getInventorySource: function(params){ - Wait('start'); - this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); - Rest.setUrl(this.url); - return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - putInventorySource: function(params, url){ - Wait('start'); - this.url = url; - Rest.setUrl(this.url); - return Rest.put(params) - .then(this.then.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 - associateGroup: function(group, target){ - Wait('start'); - this.url = GetBasePath('groups') + target + '/children/'; - Rest.setUrl(this.url); - return Rest.post(group) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - disassociateGroup: function(group, parent){ - Wait('start'); - this.url = GetBasePath('groups') + parent + '/children/'; - Rest.setUrl(this.url); - return Rest.post({id: group, disassociate: 1}) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - promote: function(group, inventory){ - Wait('start'); - this.url = GetBasePath('inventory') + inventory + '/groups/'; - Rest.setUrl(this.url); - return Rest.post({id: group, disassociate: 1}) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) - .finally(Wait('stop')); - }, - encodeGroupBy(source, group_by){ - source = source && source.value ? source.value : ''; - if(source === 'ec2'){ - return _.map(group_by, 'value').join(','); - } - if(source === 'vmware'){ - group_by = _.map(group_by, (i) => {return i.value;}); - $("#inventory_source_group_by").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){ - group_by.push(option.title); - }); - group_by = (Array.isArray(group_by)) ? _.uniq(group_by).join() : ""; - return group_by; - } - else { - return; - } +['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){ + return { + stringifyParams: function(params){ + return _.reduce(params, (result, value, key) => { + return result + key + '=' + value + '&'; + }, ''); + }, + // cute abstractions via fn.bind() + url: function(){ + return ''; + }, + error: function(data, status) { + ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', + msg: 'Call to ' + this.url + '. GET returned: ' + status }); + }, + success: function(data){ + return data; + }, + // HTTP methods + get: function(params){ + Wait('start'); + this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); + Rest.setUrl(this.url); + return Rest.get() + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + post: function(inventory_source){ + Wait('start'); + this.url = GetBasePath('inventory_sources'); + Rest.setUrl(this.url); + return Rest.post(inventory_source) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + put: function(inventory_source){ + Wait('start'); + this.url = GetBasePath('inventory_sources') + inventory_source.id; + Rest.setUrl(this.url); + return Rest.put(inventory_source) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + delete: function(id){ + Wait('start'); + this.url = GetBasePath('inventory_sources') + id; + Rest.setUrl(this.url); + return Rest.destroy() + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + options: function(){ + this.url = GetBasePath('inventory_sources'); + Rest.setUrl(this.url); + return Rest.options() + .then(this.success.bind(this)) + .catch(this.error.bind(this)); + }, + getCredential: function(id){ + Wait('start'); + this.url = GetBasePath('credentials') + id; + Rest.setUrl(this.url); + return Rest.get() + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + getInventorySource: function(params){ + Wait('start'); + this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); + Rest.setUrl(this.url); + return Rest.get() + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + putInventorySource: function(params, url){ + Wait('start'); + this.url = url; + Rest.setUrl(this.url); + return Rest.put(params) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + // these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level + associateGroup: function(group, target){ + Wait('start'); + this.url = GetBasePath('groups') + target + '/children/'; + Rest.setUrl(this.url); + return Rest.post(group) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + disassociateGroup: function(group, parent){ + Wait('start'); + this.url = GetBasePath('groups') + parent + '/children/'; + Rest.setUrl(this.url); + return Rest.post({id: group, disassociate: 1}) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + promote: function(group, inventory){ + Wait('start'); + this.url = GetBasePath('inventory') + inventory + '/groups/'; + Rest.setUrl(this.url); + return Rest.post({id: group, disassociate: 1}) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) + .finally(Wait('stop')); + }, + encodeGroupBy(source, group_by){ + source = source && source.value ? source.value : ''; + if(source === 'ec2'){ + return _.map(group_by, 'value').join(','); } - }; - }]; + if(source === 'vmware'){ + group_by = _.map(group_by, (i) => {return i.value;}); + $("#inventory_source_group_by").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){ + group_by.push(option.title); + }); + group_by = (Array.isArray(group_by)) ? _.uniq(group_by).join() : ""; + return group_by; + } + else { + return; + } + } + }; +}]; \ No newline at end of file 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 9ad4b0dcf6..caf31eca2f 100644 --- a/awx/ui/client/src/inventories-hosts/shared/groups.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/groups.service.js @@ -23,8 +23,8 @@ export default this.url = GetBasePath('groups') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, post: function(group){ @@ -32,8 +32,8 @@ export default this.url = GetBasePath('groups'); Rest.setUrl(this.url); return Rest.post(group) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, put: function(group){ @@ -41,8 +41,8 @@ export default this.url = GetBasePath('groups') + group.id; Rest.setUrl(this.url); return Rest.put(group) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, delete: function(id){ @@ -50,8 +50,8 @@ export default this.url = GetBasePath('groups') + id; Rest.setUrl(this.url); return Rest.destroy() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, getCredential: function(id){ @@ -59,8 +59,8 @@ export default this.url = GetBasePath('credentials') + id; Rest.setUrl(this.url); return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, getInventorySource: function(params){ @@ -68,8 +68,8 @@ export default this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, putInventorySource: function(params, url){ @@ -77,8 +77,8 @@ export default this.url = url; Rest.setUrl(this.url); return Rest.put(params) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, // these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level @@ -87,8 +87,8 @@ export default this.url = GetBasePath('groups') + target + '/children/'; Rest.setUrl(this.url); return Rest.post(group) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, disassociateGroup: function(group, parent){ @@ -96,8 +96,8 @@ export default this.url = GetBasePath('groups') + parent + '/children/'; Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, associateHost: function(host, target){ @@ -105,8 +105,8 @@ export default this.url = GetBasePath('groups') + target + '/hosts/'; Rest.setUrl(this.url); return Rest.post(host) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, disassociateHost: function(host, group){ @@ -114,8 +114,8 @@ export default this.url = GetBasePath('groups') + group + '/hosts/'; Rest.setUrl(this.url); return Rest.post({id: host, disassociate: 1}) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, promote: function(group, inventory){ @@ -123,8 +123,8 @@ export default this.url = GetBasePath('inventory') + inventory + '/groups/'; Rest.setUrl(this.url); return Rest.post({id: group, disassociate: 1}) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.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 38d5047fdb..9f074d2628 100644 --- a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js @@ -30,8 +30,8 @@ this.url = GetBasePath('hosts') + '?' + this.stringifyParams(params); Rest.setUrl(this.url); return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, post: function(host){ @@ -39,8 +39,8 @@ this.url = GetBasePath('hosts'); Rest.setUrl(this.url); return Rest.post(host) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, put: function(host){ @@ -48,8 +48,8 @@ this.url = GetBasePath('hosts') + host.id; Rest.setUrl(this.url); return Rest.put(host) - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, delete: function(id){ @@ -57,8 +57,8 @@ this.url = GetBasePath('hosts') + id; Rest.setUrl(this.url); return Rest.destroy() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.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 8b85be3ea2..3cd069c4c2 100644 --- a/awx/ui/client/src/inventories-hosts/shared/inventories.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/inventories.service.js @@ -25,8 +25,8 @@ this.url = GetBasePath('inventory') + id; Rest.setUrl(this.url); return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, getBreadcrumbs: function(groups){ @@ -36,8 +36,8 @@ }).join(''); Rest.setUrl(this.url); return Rest.get() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)) + .then(this.success.bind(this)) + .catch(this.error.bind(this)) .finally(Wait('stop')); }, rootHostsUrl: function(id){ @@ -60,22 +60,22 @@ this.url = GetBasePath('inventory') + inventoryId + '/inventory_sources'; Rest.setUrl(this.url); return Rest.options() - .then(this.then.bind(this)) - .catch(this.catch.bind(this)); + .then(this.success.bind(this)) + .catch(this.error.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)) - .catch(this.catch.bind(this)); + .then(this.success.bind(this)) + .catch(this.error.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)) - .catch(this.catch.bind(this)); + .then(this.success.bind(this)) + .catch(this.error.bind(this)); } }; }]; diff --git a/awx/ui/client/src/job-results/host-event/host-event.route.js b/awx/ui/client/src/job-results/host-event/host-event.route.js index bb456bad6c..e0a32ad7e4 100644 --- a/awx/ui/client/src/job-results/host-event/host-event.route.js +++ b/awx/ui/client/src/job-results/host-event/host-event.route.js @@ -19,8 +19,7 @@ var hostEventModal = { hostEvent: ['jobResultsService', '$stateParams', function(jobResultsService, $stateParams) { return jobResultsService.getRelatedJobEvents($stateParams.id, { id: $stateParams.eventId - }).then(function(res) { - return res.data.results[0]; }); + }).then((response) => response.data.results[0]); }] }, onExit: function() { 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 53bc34a9ae..8846620f73 100644 --- a/awx/ui/client/src/job-results/job-results.service.js +++ b/awx/ui/client/src/job-results/job-results.service.js @@ -239,8 +239,8 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo url = url + id + '/job_events/?' + this.stringifyParams(params); Rest.setUrl(url); return Rest.get() - .then(({data}) => { - return data; + .then((response) => { + return response; }) .catch(({data, status}) => { ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', 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 f273012bfe..f79a927539 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -179,26 +179,26 @@ export default if ($scope.has_other_prompts) { Rest.options() - .success(options => { + .then(options => { if ($scope.ask_job_type_on_launch) { - let choices = getChoices(options, 'actions.POST.job_type.choices'); + let choices = getChoices(options.data, 'actions.POST.job_type.choices'); let initialValue = _.get(data, 'defaults.job_type'); let initialChoice = getChoiceFromValue(choices, initialValue); $scope.other_prompt_data.job_type_options = choices; $scope.other_prompt_data.job_type = initialChoice; } if ($scope.ask_verbosity_on_launch) { - let choices = getChoices(options, 'actions.POST.verbosity.choices'); + let choices = getChoices(options.data, 'actions.POST.verbosity.choices'); let initialValue = _.get(data, 'defaults.verbosity'); let initialChoice = getChoiceFromValue(choices, initialValue); $scope.other_prompt_data.verbosity_options = choices; $scope.other_prompt_data.verbosity = initialChoice; } }) - .error((err, status) => { - ProcessErrors($scope, err, status, null, { + .catch((error) => { + ProcessErrors($scope, error.data, error.status, null, { hdr: 'Error!', - msg: `Failed to get ${launch_url}. OPTIONS status: ${status}` + msg: `Failed to get ${launch_url}. OPTIONS status: ${error.status}` }); }); } @@ -260,7 +260,8 @@ export default // Go out and get the credential types Rest.setUrl(GetBasePath('credential_types')); Rest.get() - .success(function (credentialTypeData) { + .then( (response) => { + let credentialTypeData = response.data; let credential_types = {}; $scope.credentialTypeOptions = []; credentialTypeData.results.forEach((credentialType => { @@ -273,6 +274,9 @@ export default } })); $scope.credential_types = credential_types; + }) + .catch( (error) => { + console.log(error); }); // Figure out which step the user needs to start on @@ -296,7 +300,8 @@ export default // Go out and get some of the job details like inv, cred, name Rest.setUrl(GetBasePath('jobs') + $scope.submitJobId); Rest.get() - .success(function (jobResultData) { + .then( (response) => { + let jobResultData = response.data; $scope.job_template_data = { name: jobResultData.name }; diff --git a/awx/ui/client/src/license/checkLicense.factory.js b/awx/ui/client/src/license/checkLicense.factory.js index 8fcd2bbd2e..04a658fa82 100644 --- a/awx/ui/client/src/license/checkLicense.factory.js +++ b/awx/ui/client/src/license/checkLicense.factory.js @@ -21,8 +21,8 @@ export default var data = license; data.eula_accepted = eula; return Rest.post(JSON.stringify(data)) - .success(function(res){ - return res; + .then((response) =>{ + return response.data; }) .catch(({res, status}) => { ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', 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 3208c1bc22..599e17bb67 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 @@ -141,7 +141,10 @@ }); } - }); + }) + .catch( (error) => { + console.log(error); + }) }, 5000); } }; 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 195fb2033c..65c65ce1ee 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 @@ -71,10 +71,10 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices', var notifier_url = url + id + column; Rest.setUrl(notifier_url); Rest.get() - .success( function(data, i, j, obj) { - var type = (obj.url.indexOf('success')>0) ? "notification_templates_success" : "notification_templates_error"; - if (data.results) { - _.forEach(data.results, function(result){ + .then(function(response) { + var type = (url.indexOf('success')>0) ? "notification_templates_success" : "notification_templates_error"; + if (response.data.results) { + _.forEach(response.data.results, function(result){ _.forEach(scope.notifications, function(notification){ if(notification.id === result.id){ notification[type] = true; 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 2854855211..8673874890 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 @@ -84,17 +84,17 @@ export default ['$scope', '$rootScope', $scope.copyTemplate = function(id) { Wait('start'); TemplateCopyService.get(id) - .success(function(res){ - TemplateCopyService.set(res) - .success(function(res){ - Wait('stop'); - if(res.type && res.type === 'job_template') { - $state.go('templates.editJobTemplate', {job_template_id: res.id}, {reload: true}); - } - }); + .then((data) => { + TemplateCopyService.set(data.results) + .then((results) => { + Wait('stop'); + if(results.type && results.type === 'job_template') { + $state.go('templates.editJobTemplate', {job_template_id: results.id}, {reload: true}); + } + }); }) - .catch(({res, status}) => { - ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', + .catch(({data, status}) => { + ProcessErrors($rootScope, data, status, null, {hdr: 'Error!', msg: 'Call failed. Return status: '+ status}); }); diff --git a/awx/ui/client/src/scheduler/main.js b/awx/ui/client/src/scheduler/main.js index 3c72575373..735dd3b804 100644 --- a/awx/ui/client/src/scheduler/main.js +++ b/awx/ui/client/src/scheduler/main.js @@ -61,7 +61,7 @@ export default ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ let path = `${GetBasePath('job_templates')}${$stateParams.id}`; Rest.setUrl(path); - return Rest.get(path).then((res) => res.data); + return Rest.get(path).then(response => response.data) }], UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', function(Rest, GetBasePath, $stateParams, $q) { @@ -152,7 +152,7 @@ export default ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ let path = `${GetBasePath('workflow_job_templates')}${$stateParams.id}`; Rest.setUrl(path); - return Rest.get(path).then((res) => res.data); + return Rest.get(path).then(response => response.data) }], UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', function(Rest, GetBasePath, $stateParams, $q) { @@ -242,7 +242,7 @@ export default ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ let path = `${GetBasePath('projects')}${$stateParams.id}`; Rest.setUrl(path); - return Rest.get(path).then((res) => res.data); + return Rest.get(path).then(response => response.data) }], UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', function(Rest, GetBasePath, $stateParams, $q) { diff --git a/awx/ui/client/src/scheduler/schedulerAdd.controller.js b/awx/ui/client/src/scheduler/schedulerAdd.controller.js index 91dde4352a..9485315078 100644 --- a/awx/ui/client/src/scheduler/schedulerAdd.controller.js +++ b/awx/ui/client/src/scheduler/schedulerAdd.controller.js @@ -27,7 +27,7 @@ export default ['$filter', '$state', '$stateParams', 'AddSchedule', 'Wait', /* * This is a workaround for the angular-scheduler library inserting `ll` into fields after an - * invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars + * invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars * in that case. * * Because this same problem exists in the edit mode and because there's no inheritence, this diff --git a/awx/ui/client/src/shared/rbacUiControl.js b/awx/ui/client/src/shared/rbacUiControl.js index 84d053c5b6..2085f9cde9 100644 --- a/awx/ui/client/src/shared/rbacUiControl.js +++ b/awx/ui/client/src/shared/rbacUiControl.js @@ -22,8 +22,7 @@ export default if (data.actions.POST) { canAddVal.resolve({canAdd: true, options: data}); } else { - canAddVal.reject(false); - } + canAddVal.resolve({canAdd: false}) } Wait("stop"); }); diff --git a/awx/ui/client/src/shared/socket/socket.service.js b/awx/ui/client/src/shared/socket/socket.service.js index f520fbcbe9..3b7a60e9ab 100644 --- a/awx/ui/client/src/shared/socket/socket.service.js +++ b/awx/ui/client/src/shared/socket/socket.service.js @@ -34,6 +34,7 @@ export default self.socket.onopen = function () { $log.debug("Websocket connection opened. Socket readyState: " + self.socket.readyState); socketPromise.resolve(); + console.log('promise resolved, and readyState: '+ self.readyState); self.checkStatus(); if(needsResubscribing){ self.subscribe(self.getLast()); @@ -116,6 +117,7 @@ export default if(this.socket){ this.socket.close(); delete this.socket; + console.log("Socket deleted: "+this.socket); } }, subscribe: function(state){ 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 8282facadc..d4ac1e8adf 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 @@ -12,11 +12,9 @@ var defaultUrl = GetBasePath('job_templates') + '?id=' + id; Rest.setUrl(defaultUrl); return Rest.get() - .success(function(res){ - return res; - }) - .catch(({res, status}) => { - ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', + .then(response => response) + .catch((error) => { + ProcessErrors($rootScope, error.response, error.status, null, {hdr: 'Error!', msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status}); }); }, @@ -25,25 +23,25 @@ return Rest.get(); }, copySurvey: function(source, target){ - return this.getSurvey(source.related.survey_spec).success( (data) => { + return this.getSurvey(source.related.survey_spec).then( (response) => { Rest.setUrl(target.related.survey_spec); - return Rest.post(data); + return Rest.post(response.data); }); }, - set: function(data){ + set: function(results){ var defaultUrl = GetBasePath('job_templates'); var self = this; Rest.setUrl(defaultUrl); - var name = this.buildName(data.results[0].name); - data.results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm - return Rest.post(data.results[0]) - .success(function(job_template_res){ + var name = this.buildName(results[0].name); + results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm + return Rest.post(results[0]) + .then((response) => { // also copy any associated survey_spec - if (data.results[0].summary_fields.survey){ - return self.copySurvey(data.results[0], job_template_res).success( () => job_template_res); + if (results[0].summary_fields.survey){ + return self.copySurvey(results[0], response.data).then( () => response.data); } - else{ - return job_template_res; + else { + return response.data; } }) .catch(({res, 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 441cc5ce68..9f639b2172 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 @@ -98,7 +98,8 @@ export default jobTemplateLoadFinished(); } }) - .error(function (ret,status_code) { + .catch( (error) => { + console.log(error); if (status_code === 403) { /* user doesn't have access to see the project, no big deal. */ $scope.disablePlaybookBecausePermissionDenied = true; @@ -142,7 +143,10 @@ export default $q.all(promises) .then(function(){ Wait('stop'); - }); + }) + .catch( (error) => { + console.log(error); + }) } } }); @@ -423,7 +427,6 @@ export default $scope.$emit('jobTemplateLoaded', master); }); - } }); 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 f9fefeb2b2..cce220f91c 100644 --- a/awx/ui/client/src/templates/list/templates-list.controller.js +++ b/awx/ui/client/src/templates/list/templates-list.controller.js @@ -202,17 +202,21 @@ export default ['$scope', '$rootScope', if(template.type && template.type === 'job_template') { Wait('start'); TemplateCopyService.get(template.id) - .success(function(res){ - TemplateCopyService.set(res) - .success(function(res){ + .then(function(response){ + TemplateCopyService.set(response.data.results) + .then(function(results){ Wait('stop'); - if(res.type && res.type === 'job_template') { - $state.go('templates.editJobTemplate', {job_template_id: res.id}, {reload: true}); + if(results.type && results.type === 'job_template') { + $state.go('templates.editJobTemplate', {job_template_id: results.id}, {reload: true}); } - }); - }) - .catch(({res, status}) => { - ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', + }) + .catch((error)=> { + console.log(error); + }) + }) + .catch((error) => { + console.log(error); + ProcessErrors($rootScope, error, status, null, {hdr: 'Error!', msg: 'Call failed. Return status: '+ status}); }); } diff --git a/awx/ui/npm-debug.log.1254872885 b/awx/ui/npm-debug.log.1254872885 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/awx/ui/npm-debug.log.3063400582 b/awx/ui/npm-debug.log.3063400582 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/awx/ui/package.json b/awx/ui/package.json index 4525ecea47..955c855c1c 100644 --- a/awx/ui/package.json +++ b/awx/ui/package.json @@ -32,7 +32,7 @@ "production": "webpack --config build/webpack.production.js" }, "devDependencies": { - "angular-mocks": "~1.4.14", + "angular-mocks": "~1.6.6", "axios": "^0.16.2", "babel-core": "^6.26.0", "babel-istanbul": "^0.12.2", @@ -95,14 +95,13 @@ "angular": "~1.6.6", "angular-breadcrumb": "git+https://git@github.com/ansible/angular-breadcrumb#0.4.1", "angular-codemirror": "git+https://git@github.com/ansible/angular-codemirror#1.0.4", - "angular-cookies": "~1.4.14", + "angular-cookies": "~1.6.6", "angular-drag-and-drop-lists": "git+https://git@github.com/ansible/angular-drag-and-drop-lists#1.4.0", "angular-duration-format": "^1.0.1", "angular-gettext": "^2.3.5", "angular-md5": "^0.1.8", "angular-moment": "^0.10.1", - "angular-resource": "~1.4.14", - "angular-sanitize": "~1.4.14", + "angular-sanitize": "~1.6.6", "angular-scheduler": "git+https://git@github.com/ansible/angular-scheduler#0.1.1", "angular-tz-extensions": "git+https://git@github.com/ansible/angular-tz-extensions#0.3.13", "babel-polyfill": "^6.26.0", diff --git a/npm-debug.log.1381475670 b/npm-debug.log.1381475670 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/npm-debug.log.2251662136 b/npm-debug.log.2251662136 new file mode 100644 index 0000000000..e69de29bb2 From 32da68672416da58b6efbc7526efbed733867070 Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Thu, 19 Oct 2017 14:59:49 -0400 Subject: [PATCH 7/9] Handle errors with ProcessErrors --- .../job-submission/job-submission.controller.js | 7 +++++-- .../notification-templates-list/list.controller.js | 11 +++++++---- awx/ui/client/src/scheduler/main.js | 6 +++--- awx/ui/client/src/shared/rbacUiControl.js | 3 ++- .../job-template-edit.controller.js | 12 +++++++----- .../templates/list/templates-list.controller.js | 14 ++++++++------ 6 files changed, 32 insertions(+), 21 deletions(-) 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 f79a927539..97f4002119 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -275,8 +275,11 @@ export default })); $scope.credential_types = credential_types; }) - .catch( (error) => { - console.log(error); + .catch(({data, status}) => { + ProcessErrors($scope, data, status, null, { + hdr: 'Error!', + msg: 'Failed to get credential types. GET status: ' + status + }); }); // Figure out which step the user needs to start on 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 599e17bb67..6a6cf071e4 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 @@ -116,7 +116,7 @@ function retrieveStatus(id) { setTimeout(function() { - var url = GetBasePath('notifications') + id; + let url = GetBasePath('notifications') + id; Rest.setUrl(url); Rest.get() .then(function(res) { @@ -142,9 +142,12 @@ } }) - .catch( (error) => { - console.log(error); - }) + .catch(({data, status}) => { + ProcessErrors($scope, data, status, null, { + hdr: 'Error!', + msg: 'Failed to get ' + url + '. GET status: ' + status + }); + }); }, 5000); } }; diff --git a/awx/ui/client/src/scheduler/main.js b/awx/ui/client/src/scheduler/main.js index 735dd3b804..6dbaf01971 100644 --- a/awx/ui/client/src/scheduler/main.js +++ b/awx/ui/client/src/scheduler/main.js @@ -61,7 +61,7 @@ export default ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ let path = `${GetBasePath('job_templates')}${$stateParams.id}`; Rest.setUrl(path); - return Rest.get(path).then(response => response.data) + return Rest.get(path).then(response => response.data); }], UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', function(Rest, GetBasePath, $stateParams, $q) { @@ -152,7 +152,7 @@ export default ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ let path = `${GetBasePath('workflow_job_templates')}${$stateParams.id}`; Rest.setUrl(path); - return Rest.get(path).then(response => response.data) + return Rest.get(path).then(response => response.data); }], UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', function(Rest, GetBasePath, $stateParams, $q) { @@ -242,7 +242,7 @@ export default ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ let path = `${GetBasePath('projects')}${$stateParams.id}`; Rest.setUrl(path); - return Rest.get(path).then(response => response.data) + return Rest.get(path).then(response => response.data); }], UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', function(Rest, GetBasePath, $stateParams, $q) { diff --git a/awx/ui/client/src/shared/rbacUiControl.js b/awx/ui/client/src/shared/rbacUiControl.js index 2085f9cde9..b65c6c57bd 100644 --- a/awx/ui/client/src/shared/rbacUiControl.js +++ b/awx/ui/client/src/shared/rbacUiControl.js @@ -22,7 +22,8 @@ export default if (data.actions.POST) { canAddVal.resolve({canAdd: true, options: data}); } else { - canAddVal.resolve({canAdd: false}) } + canAddVal.resolve({canAdd: false}); + } Wait("stop"); }); 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 9f639b2172..0cbf4e04b4 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 @@ -99,8 +99,7 @@ export default } }) .catch( (error) => { - console.log(error); - if (status_code === 403) { + if (error.status_code === 403) { /* user doesn't have access to see the project, no big deal. */ $scope.disablePlaybookBecausePermissionDenied = true; } else { @@ -144,9 +143,12 @@ export default .then(function(){ Wait('stop'); }) - .catch( (error) => { - console.log(error); - }) + .catch(({data, status}) => { + ProcessErrors($scope, data, status, null, { + hdr: 'Error!', + msg: 'Call failed. 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 cce220f91c..b400ec66ed 100644 --- a/awx/ui/client/src/templates/list/templates-list.controller.js +++ b/awx/ui/client/src/templates/list/templates-list.controller.js @@ -210,13 +210,15 @@ export default ['$scope', '$rootScope', $state.go('templates.editJobTemplate', {job_template_id: results.id}, {reload: true}); } }) - .catch((error)=> { - console.log(error); - }) + .catch(({data, status}) => { + ProcessErrors($scope, data, status, null, { + hdr: 'Error!', + msg: 'Call failed. Return status: ' + status + }); + }); }) - .catch((error) => { - console.log(error); - ProcessErrors($rootScope, error, status, null, {hdr: 'Error!', + .catch(({data, status}) => { + ProcessErrors($rootScope, data, status, null, {hdr: 'Error!', msg: 'Call failed. Return status: '+ status}); }); } From 9bb696aa6e021fed39e0f22755030b5ff406fa19 Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Fri, 20 Oct 2017 15:24:07 -0400 Subject: [PATCH 8/9] Fix for input directive using strict comparison to determined "checked" row --- .../lists/inventory/job-sub-inv-list.controller.js | 2 +- awx/ui/client/src/shared/lookup/lookup-modal.directive.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/job-submission/lists/inventory/job-sub-inv-list.controller.js b/awx/ui/client/src/job-submission/lists/inventory/job-sub-inv-list.controller.js index 002cb17e42..9a5bfdad9b 100644 --- a/awx/ui/client/src/job-submission/lists/inventory/job-sub-inv-list.controller.js +++ b/awx/ui/client/src/job-submission/lists/inventory/job-sub-inv-list.controller.js @@ -46,7 +46,7 @@ export default if (row.checked) { row.success_class = 'success'; } else { - row.checked = true; + row.checked = 1; row.success_class = ''; } $scope.$emit('inventorySelected', row); diff --git a/awx/ui/client/src/shared/lookup/lookup-modal.directive.js b/awx/ui/client/src/shared/lookup/lookup-modal.directive.js index a15d5b7d2b..6d263119f8 100644 --- a/awx/ui/client/src/shared/lookup/lookup-modal.directive.js +++ b/awx/ui/client/src/shared/lookup/lookup-modal.directive.js @@ -44,7 +44,7 @@ export default ['templateUrl', function(templateUrl) { if($scope.currentSelection && $scope.currentSelection.id) { $scope[list.name].forEach(function(row) { if (row.id === $scope.currentSelection.id) { - row.checked = true; + row.checked = 1; } }); } @@ -71,7 +71,7 @@ export default ['templateUrl', function(templateUrl) { if (row.checked) { row.success_class = 'success'; } else { - row.checked = true; + row.checked = 1; row.success_class = ''; } $scope.currentSelection = { From 9157f53d43a39d4c86761dd9415bb40d4c2baf82 Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Fri, 20 Oct 2017 15:37:14 -0400 Subject: [PATCH 9/9] Update angular-scheduler and angular-tz-extensions versions --- awx/ui/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui/package.json b/awx/ui/package.json index 955c855c1c..b2e46b413a 100644 --- a/awx/ui/package.json +++ b/awx/ui/package.json @@ -102,8 +102,8 @@ "angular-md5": "^0.1.8", "angular-moment": "^0.10.1", "angular-sanitize": "~1.6.6", - "angular-scheduler": "git+https://git@github.com/ansible/angular-scheduler#0.1.1", - "angular-tz-extensions": "git+https://git@github.com/ansible/angular-tz-extensions#0.3.13", + "angular-scheduler": "git+https://git@github.com/ansible/angular-scheduler#v0.2.0", + "angular-tz-extensions": "git+https://git@github.com/ansible/angular-tz-extensions#v0.4.0", "babel-polyfill": "^6.26.0", "bootstrap": "^3.3.7", "bootstrap-datepicker": "^1.7.1", @@ -119,7 +119,7 @@ "lr-infinite-scroll": "git+https://git@github.com/lorenzofox3/lrInfiniteScroll", "moment": "~2.10.0", "ng-toast": "git+https://git@github.com/ansible/ngToast#2.0.1", - "nvd3": "git+https://git@github.com/benthomasson/nvd3#1.7.1", + "nvd3": "git+https://git@github.com/ansible/nvd3#1.7.1", "reconnectingwebsocket": "^1.0.0", "rrule": "git+https://git@github.com/jkbrzt/rrule#4ff63b2f8524fd6d5ba6e80db770953b5cd08a0c", "select2": "^4.0.2",