From 46188341d243ec2858a6d3f147d2b23d50e51ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Rodr=C3=ADguez=20Ponce?= Date: Wed, 10 Jul 2024 08:16:12 +0200 Subject: [PATCH] Fix infinite "Please wait" message on error (#8249) If an error happens while using the delete, validate or other option of the editor dashboard metadata actions menu then remove the text "Please wait" and the spinner from the button to allow to perform a new action. --- .../metadataactions/MetadataActionService.js | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js b/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js index 100ebfca458..77429954b58 100644 --- a/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js +++ b/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js @@ -275,24 +275,28 @@ ); } else { $rootScope.$broadcast("operationOnSelectionStart"); - $http.delete("../api/records?" + "bucket=" + bucket).then( - function (data) { - $rootScope.$broadcast("mdSelectNone"); - $rootScope.$broadcast("operationOnSelectionStop"); - $rootScope.$broadcast("search"); - $timeout(function () { + $http + .delete("../api/records?" + "bucket=" + bucket) + .then( + function (data) { + $rootScope.$broadcast("mdSelectNone"); $rootScope.$broadcast("search"); - }, 5000); - deferred.resolve(data); - }, - function (data) { - gnAlertService.addAlert({ - msg: data.data.message || data.data.description, - type: "danger" - }); - deferred.reject(data); - } - ); + $timeout(function () { + $rootScope.$broadcast("search"); + }, 5000); + deferred.resolve(data); + }, + function (data) { + gnAlertService.addAlert({ + msg: data.data.message || data.data.description, + type: "danger" + }); + deferred.reject(data); + } + ) + .finally(function () { + $rootScope.$broadcast("operationOnSelectionStop"); + }); } return deferred.promise; }; @@ -644,8 +648,10 @@ }) .then(function (data) { $rootScope.$broadcast("inspireMdValidationStop"); - $rootScope.$broadcast("operationOnSelectionStop"); $rootScope.$broadcast("search"); + }) + .finally(function () { + $rootScope.$broadcast("operationOnSelectionStop"); }); }; @@ -657,8 +663,10 @@ method: "DELETE" }) .then(function (data) { - $rootScope.$broadcast("operationOnSelectionStop"); $rootScope.$broadcast("search"); + }) + .finally(function () { + $rootScope.$broadcast("operationOnSelectionStop"); }); };