From c7907cf10425ee961e9cc61fbadc5c7aa86d0b4d Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 17 Dec 2024 11:48:42 +0100 Subject: [PATCH] ask for confmiratino when moving study --- .../class/osparc/dashboard/StudyBrowser.js | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 475f364672d..f6bcdf3c25f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -1175,7 +1175,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __connectDropHandlers: function() { const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); workspacesAndFoldersTree.addListener("studyToFolderRequested", e => { - this._studyToFolderRequested(e.getData()); + const { + studyData, + destWorkspaceId, + destFolderId, + } = e.getData(); + this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId); }); workspacesAndFoldersTree.addListener("folderToFolderRequested", e => { const { @@ -1678,6 +1683,19 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }); }, + _moveStudyToFolderReqested: function(studyData, destWorkspaceId, destFolderId) { + if (studyData["workspaceId"] === destWorkspaceId) { + this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); + } else { + const confirmationWin = this.__showMoveToDifferentWorkspaceWarningMessage(); + confirmationWin.addListener("close", () => { + if (confirmationWin.getConfirmed()) { + this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); + } + }, this); + } + }, + __getMoveStudyToMenuButton: function(studyData) { const moveToButton = new qx.ui.menu.Button(this.tr("Move to..."), "@FontAwesome5Solid/folder/12"); moveToButton["moveToButton"] = true; @@ -1692,17 +1710,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const data = e.getData(); const destWorkspaceId = data["workspaceId"]; const destFolderId = data["folderId"]; - - if (destWorkspaceId === currentWorkspaceId) { - this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); - } else { - const confirmationWin = this.__showMoveToDifferentWorkspaceWarningMessage(); - confirmationWin.addListener("close", () => { - if (confirmationWin.getConfirmed()) { - this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); - } - }, this); - } + this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId); }, this); moveStudyTo.addListener("cancel", () => win.close()); }, this); @@ -1743,15 +1751,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { .then(() => studyData["folderId"] = destFolderId); }, - _studyToFolderRequested: function(data) { - const { - studyData, - destWorkspaceId, - destFolderId, - } = data; - this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); - }, - __getDuplicateMenuButton: function(studyData) { const duplicateButton = new qx.ui.menu.Button(this.tr("Duplicate"), "@FontAwesome5Solid/copy/12"); duplicateButton["duplicateButton"] = true;