Skip to content

Commit

Permalink
ask for confmiratino when moving study
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 17, 2024
1 parent 167c5d9 commit c7907cf
Showing 1 changed file with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c7907cf

Please sign in to comment.