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 cb3cd9b4c07..ec55b646712 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -50,6 +50,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { "untrashFolderRequested": "qx.event.type.Data", "deleteFolderRequested": "qx.event.type.Data", "changeContext": "qx.event.type.Data", + "studyToFolderRequested": "qx.event.type.Data", + "folderToFolderRequested": "qx.event.type.Data", }, properties: { @@ -219,22 +221,18 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.addListener("drop", e => { if (e.supportsType("osparc-moveStudy")) { const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; - const params = { - url: { - studyId: studyData["uuid"], - folderId: this.getFolderId(), - } + const studyToFolderData = { + studyId: studyData["uuid"], + destFolderId: this.getFolderId(), }; - osparc.data.Resources.fetch("studies", "moveToFolder", params) - .then(() => { - studyData["folderId"] = this.getFolderId(); - osparc.FlashMessenger.logAs("Study moved", "INFO"); - this.fireDataEvent("studyDroppedToFolder", studyData["uuid"]); - }) - .catch(err => { - console.error(err); - osparc.FlashMessenger.logAs(err.message, "ERROR"); - }); + this.fireDataEvent("studyToFolderRequested", studyToFolderData); + } else if (e.supportsType("osparc-moveFolder")) { + const folder = e.getData("osparc-moveFolder")["folderOrigin"]; + const folderToFolderData = { + folderId: folder.getFolderId(), + destFolderId: this.getFolderId(), + }; + this.fireDataEvent("folderToFolderRequested", folderToFolderData); } }); }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index c007ca05f7e..8c3cfd23637 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -279,6 +279,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { resourcesContainer.addListener("trashFolderRequested", e => this._trashFolderRequested(e.getData())); resourcesContainer.addListener("untrashFolderRequested", e => this._untrashFolderRequested(e.getData())); resourcesContainer.addListener("deleteFolderRequested", e => this._deleteFolderRequested(e.getData())); + resourcesContainer.addListener("studyToFolderRequested", e => this._studyToFolderRequested(e.getData())); + resourcesContainer.addListener("folderToFolderRequested", e => this._folderToFolderRequested(e.getData())); resourcesContainer.addListener("folderSelected", e => { const folderId = e.getData(); this._folderSelected(folderId); @@ -524,6 +526,14 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { throw new Error("Abstract method called!"); }, + _studyToFolderRequested: function(studyId) { + throw new Error("Abstract method called!"); + }, + + _folderToFolderRequested: function(folderId) { + throw new Error("Abstract method called!"); + }, + _workspaceSelected: function(workspaceId) { throw new Error("Abstract method called!"); }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 258916eefbb..55ac1f85697 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -83,6 +83,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { "untrashWorkspaceRequested": "qx.event.type.Data", "deleteWorkspaceRequested": "qx.event.type.Data", "changeContext": "qx.event.type.Data", + "studyToFolderRequested": "qx.event.type.Data", + "folderToFolderRequested": "qx.event.type.Data", }, statics: { @@ -429,6 +431,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { "untrashFolderRequested", "deleteFolderRequested", "changeContext", + "studyToFolderRequested", + "folderToFolderRequested", ].forEach(eName => card.addListener(eName, e => this.fireDataEvent(eName, e.getData()))); return card; }, 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 98153e7937f..384a19046be 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -635,6 +635,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, // /FOLDERS + _studyToFolderRequested: function(data) { + console.log("studyToFolderRequested", data); + }, + + _folderToFolderRequested: function(data) { + console.log("folderToFolderRequested", data); + }, + __configureStudyCards: function(cards) { cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); @@ -654,9 +662,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { "studyDataOrigin": card.getResourceData(), }); }); - card.addListener("droprequest", e => { - console.log("Related of droprequest: " + e.getRelatedTarget()); - }); }, __studyCardClicked: function(item, isShiftPressed) {