From 32fcf88de38f58da7ab2bb0f0e9070ff16dd0421 Mon Sep 17 00:00:00 2001 From: juanf <juanf@ethz.ch> Date: Tue, 18 Apr 2023 14:40:36 +0200 Subject: [PATCH] SSDM-12402: Bugfix, trascan to show wait feedback --- .../as/webapps/eln-lims/html/js/util/Util.js | 6 +++-- .../TrashManager/TrashManagerController.js | 24 ++++++++++++------- .../js/views/TrashManager/TrashManagerView.js | 6 ++--- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js index 45a9440fdda..867ef810ab7 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js @@ -153,7 +153,7 @@ var Util = new function() { Util.showError(errorMessage, function() {Util.unblockUI();}, undefined, isUserFailureException || isAuthorizationException); } - this.showWarning = function(text, okCallback) { + this.showWarning = function(text, okCallback, notUnblockOnAccept) { var css = { 'text-align' : 'left', 'top' : '15%', @@ -169,7 +169,9 @@ var Util = new function() { $("#warningAccept").on("click", function(event) { okCallback(); - Util.unblockUI(); + if(!notUnblockOnAccept) { + Util.unblockUI(); + } }); $("#warningCancel").on("click", function(event) { diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerController.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerController.js index 3edfe4c0688..ce62157aa12 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerController.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerController.js @@ -20,27 +20,31 @@ function TrashManagerController(mainController) { this._trashManagerView = new TrashManagerView(this, this._trashManagerModel); this.revertDeletions = function(deletionIds) { - Util.blockUINoMessage(); + Util.blockUI(); mainController.serverFacade.revertDeletions(deletionIds, function() { - Util.showSuccess("Deletions Reverted.", function() {}); - mainController.changeView('showTrashcanPage', null); + Util.showSuccess("Deletions Reverted.", function() { + Util.unblockUI(); + mainController.changeView('showTrashcanPage', null); + }); }); } this.deletePermanently = function(deletionIds, forceDeletionOfDependentDeletions) { - Util.blockUINoMessage(); + Util.blockUI(); mainController.serverFacade.deletePermanently(deletionIds, forceDeletionOfDependentDeletions, function(data) { if(data.error) { Util.showError(data.error.message, null, true, true, false, true); } else { - Util.showSuccess("Permanently Deleted."); - mainController.changeView('showTrashcanPage', null); + Util.showSuccess("Permanently Deleted.", function() { + Util.unblockUI(); + mainController.changeView('showTrashcanPage', null); + }); } }); } this.emptyTrash = function() { - Util.blockUINoMessage(); + Util.blockUI(); var deleteIds = []; for(var delIdx = 0; delIdx < this._trashManagerModel.deletions.length; delIdx++) { @@ -52,8 +56,10 @@ function TrashManagerController(mainController) { if(data.error) { Util.showError(data.error.message, null, true, true, false, true); } else { - Util.showSuccess("Trashcan cleaned."); - mainController.changeView('showTrashcanPage', null); + Util.showSuccess("Trashcan cleaned.", function() { + Util.unblockUI(); + mainController.changeView('showTrashcanPage', null); + }); } }); } diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js index 29280fa0a9c..2b45bf51fd5 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js @@ -32,7 +32,7 @@ function TrashManagerView(trashManagerController, trashManagerModel) { deleteAllBtn.click(function() { Util.showWarning(deleteMessageMany, function() { _this._trashManagerController.emptyTrash(); - }); + }, true); }); $header.append($("<h1>").append("Trashcan")); @@ -104,7 +104,7 @@ function TrashManagerView(trashManagerController, trashManagerModel) { $removeOption.click(function(e) { Util.showWarning(deleteMessageOne, function() { _this._trashManagerController.deletePermanently([data.entity.id], false); - }); + }, true); }); $list.append($removeOption); @@ -113,7 +113,7 @@ function TrashManagerView(trashManagerController, trashManagerModel) { $removeIncludedOption.click(function(e) { Util.showWarning(deleteMessageOne, function() { _this._trashManagerController.deletePermanently([data.entity.id], true); - }); + }, true); }); $list.append($removeIncludedOption); -- GitLab