Skip to content

Commit c7907cf

Browse files
committed
ask for confmiratino when moving study
1 parent 167c5d9 commit c7907cf

File tree

1 file changed

+20
-21
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+20
-21
lines changed

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
11751175
__connectDropHandlers: function() {
11761176
const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree();
11771177
workspacesAndFoldersTree.addListener("studyToFolderRequested", e => {
1178-
this._studyToFolderRequested(e.getData());
1178+
const {
1179+
studyData,
1180+
destWorkspaceId,
1181+
destFolderId,
1182+
} = e.getData();
1183+
this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId);
11791184
});
11801185
workspacesAndFoldersTree.addListener("folderToFolderRequested", e => {
11811186
const {
@@ -1678,6 +1683,19 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16781683
});
16791684
},
16801685

1686+
_moveStudyToFolderReqested: function(studyData, destWorkspaceId, destFolderId) {
1687+
if (studyData["workspaceId"] === destWorkspaceId) {
1688+
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
1689+
} else {
1690+
const confirmationWin = this.__showMoveToDifferentWorkspaceWarningMessage();
1691+
confirmationWin.addListener("close", () => {
1692+
if (confirmationWin.getConfirmed()) {
1693+
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
1694+
}
1695+
}, this);
1696+
}
1697+
},
1698+
16811699
__getMoveStudyToMenuButton: function(studyData) {
16821700
const moveToButton = new qx.ui.menu.Button(this.tr("Move to..."), "@FontAwesome5Solid/folder/12");
16831701
moveToButton["moveToButton"] = true;
@@ -1692,17 +1710,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16921710
const data = e.getData();
16931711
const destWorkspaceId = data["workspaceId"];
16941712
const destFolderId = data["folderId"];
1695-
1696-
if (destWorkspaceId === currentWorkspaceId) {
1697-
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
1698-
} else {
1699-
const confirmationWin = this.__showMoveToDifferentWorkspaceWarningMessage();
1700-
confirmationWin.addListener("close", () => {
1701-
if (confirmationWin.getConfirmed()) {
1702-
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
1703-
}
1704-
}, this);
1705-
}
1713+
this._moveStudyToFolderReqested(studyData, destWorkspaceId, destFolderId);
17061714
}, this);
17071715
moveStudyTo.addListener("cancel", () => win.close());
17081716
}, this);
@@ -1743,15 +1751,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
17431751
.then(() => studyData["folderId"] = destFolderId);
17441752
},
17451753

1746-
_studyToFolderRequested: function(data) {
1747-
const {
1748-
studyData,
1749-
destWorkspaceId,
1750-
destFolderId,
1751-
} = data;
1752-
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
1753-
},
1754-
17551754
__getDuplicateMenuButton: function(studyData) {
17561755
const duplicateButton = new qx.ui.menu.Button(this.tr("Duplicate"), "@FontAwesome5Solid/copy/12");
17571756
duplicateButton["duplicateButton"] = true;

0 commit comments

Comments
 (0)