Skip to content

Commit

Permalink
one more check
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 15, 2024
1 parent 1de0288 commit 96d937e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", {
folderItem.setOpacity(0.2);
},

dragOver: function(event, folderItem, workspaceDestId) {
dragOver: function(event, folderItem, workspaceDestId, folderDestId) {
let compatible = false;
const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"];
const workspaceIdOrigin = folderOrigin.getWorkspaceId();
Expand All @@ -131,6 +131,8 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", {
// - Write on dest Workspace
if (workspaceDestId === -1) { // (0)
compatible = false;
} else if (folderOrigin.getFolderId() === folderDestId) {
compatible = false;
} else if (workspaceIdOrigin === null && workspaceDestId === null) { // (1)
compatible = true;
} else if (workspaceIdOrigin === null && workspaceDest) { // (2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
this.addListener("dragover", e => {
const folderDest = this.getFolder();
if (e.supportsType("osparc-moveStudy")) {
osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, folderDest.getWorkspaceId());
osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, folderDest.getWorkspaceId(), folderDest.getFolderId());
} else if (e.supportsType("osparc-moveFolder")) {
osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest.getWorkspaceId());
osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest.getWorkspaceId(), folderDest.getFolderId());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", {

this.addListener("dragover", e => {
const workspaceDestId = this.getModel().getWorkspaceId();
const folderDestId = this.getModel().getFolderId();
if (e.supportsType("osparc-moveStudy")) {
osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, workspaceDestId);
osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, workspaceDestId, folderDestId);
} else if (e.supportsType("osparc-moveFolder")) {
osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, workspaceDestId);
osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, workspaceDestId, folderDestId);
}
});

Expand Down

0 comments on commit 96d937e

Please sign in to comment.