From d590432590dfe8a7a3eb146d30085ed9c2355ee7 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Tue, 10 Jan 2017 15:54:06 -0500 Subject: [PATCH] gracefully handle 409 on delete related to #3245 --- awx/ui/client/src/shared/Utilities.js | 2 ++ .../client/src/templates/list/templates-list.controller.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index 9bc18dfd13..3bb9c02de0 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -198,6 +198,8 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter']) msg += 'Please contact your system administrator.'; } Alert(defaultMsg.hdr, msg); + } else if (status === 409) { + Alert('Conflict', data.conflict || "Resource currently in use."); } else if (status === 410) { Alert('Deleted Object', 'The requested object was previously deleted and can no longer be accessed.'); } else if ((status === 'Token is expired') || (status === 401 && data.detail && data.detail === 'Token is expired') || 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 5bcd659a38..820f843852 100644 --- a/awx/ui/client/src/templates/list/templates-list.controller.js +++ b/awx/ui/client/src/templates/list/templates-list.controller.js @@ -131,7 +131,7 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', handleSuccessfulDelete(); }, function (data) { Wait('stop'); - ProcessErrors($scope, data, status, null, { hdr: 'Error!', + ProcessErrors($scope, data, data.status, null, { hdr: 'Error!', msg: 'Call to delete workflow job template failed. DELETE returned status: ' + status }); }); } @@ -141,8 +141,8 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', handleSuccessfulDelete(); }, function (data) { Wait('stop'); - ProcessErrors($scope, data, status, null, { hdr: 'Error!', - msg: 'Call to delete job template failed. DELETE returned status: ' + status }); + ProcessErrors($scope, data, data.status, null, { hdr: 'Error!', + msg: 'Call to delete job template failed. DELETE returned status: ' + data.status }); }); } else {