From 96d937ed28dbd09381c3b9b76056a34e762a3ce9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:12:38 +0100 Subject: [PATCH] one more check --- .../client/source/class/osparc/dashboard/DragDropHelpers.js | 4 +++- .../client/source/class/osparc/dashboard/FolderButtonItem.js | 4 ++-- .../class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js index d8382a07903..2b980db4e91 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -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(); @@ -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) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js index 643ffc0de37..15e0827450c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -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()); } }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js index ca1e22e62b3..646b5fa7a8c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -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); } });