From 565681c9f659691e759e6ffbb8f1b510856790b3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 11:03:42 +0100 Subject: [PATCH 01/71] set layout first --- .../source/class/osparc/dashboard/GridButtonBase.js | 5 ++--- .../source/class/osparc/dashboard/ListButtonBase.js | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js index ad0a78c20c1..e1b7c72ff71 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js @@ -28,6 +28,8 @@ qx.Class.define("osparc.dashboard.GridButtonBase", { construct: function() { this.base(arguments); + this._setLayout(new qx.ui.layout.Canvas()); + this.set({ width: this.self().ITEM_WIDTH, height: this.self().ITEM_HEIGHT, @@ -35,8 +37,6 @@ qx.Class.define("osparc.dashboard.GridButtonBase", { allowGrowX: false }); - this._setLayout(new qx.ui.layout.Canvas()); - this.getChildControl("main-layout"); }, @@ -107,7 +107,6 @@ qx.Class.define("osparc.dashboard.GridButtonBase", { }, members: { - // overridden _createChildControlImpl: function(id) { let layout; diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonBase.js index 86decb00157..d99d33f6608 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonBase.js @@ -27,16 +27,17 @@ qx.Class.define("osparc.dashboard.ListButtonBase", { construct: function() { this.base(arguments); - this.set({ - minHeight: osparc.dashboard.ListButtonBase.ITEM_HEIGHT, - allowGrowX: true - }); const layout = new qx.ui.layout.Grid(); layout.setSpacing(10); layout.setColumnFlex(osparc.dashboard.ListButtonBase.POS.SPACER, 1); this._setLayout(layout); + this.set({ + minHeight: osparc.dashboard.ListButtonBase.ITEM_HEIGHT, + allowGrowX: true + }); + this.getChildControl("spacer"); }, From 20e3f3da71fd0c7a9b9d29f1ede53a4b81f40599 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 11:16:15 +0100 Subject: [PATCH 02/71] isValidWidget --- .../osparc/dashboard/ResourceContainerManager.js | 4 ++-- .../class/osparc/dashboard/ToggleButtonContainer.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) 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 679c2b45cf1..eebcfc98b86 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -118,7 +118,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { __groupedContainers: null, addNonResourceCard: function(card) { - if (card instanceof qx.ui.form.ToggleButton) { + if (osparc.dashboard.ToggleButtonContainer.isValidWidget(card)) { if (this.getGroupBy()) { // it will always go to the no-group group const noGroupContainer = this.__getGroupContainer("no-group"); @@ -134,7 +134,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, removeNonResourceCard: function(card) { - if (card instanceof qx.ui.form.ToggleButton) { + if (osparc.dashboard.ToggleButtonContainer.isValidWidget(card)) { if (this.getGroupBy()) { const noGroupContainer = this.__getGroupContainer("no-group"); if (noGroupContainer.getContentContainer().getChildren().indexOf(card) > -1) { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js index bbabe433161..846624f88e4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js @@ -22,12 +22,22 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { "changeVisibility": "qx.event.type.Data" }, + static: { + isValidWidget: function(widget) { + // return (card instanceof qx.ui.form.ToggleButton); + return ( + widget instanceof osparc.dashboard.CardBase || + widget instanceof osparc.dashboard.FolderButtonBase + ); + }, + }, + members: { __lastSelectedIdx: null, // overridden add: function(child, options) { - if (child instanceof qx.ui.form.ToggleButton) { + if (this.self().isValidWidget(child)) { if (osparc.dashboard.ResourceContainerManager.cardExists(this, child)) { return; } From 955bf5df73845df2524af05ca1be51e16a750575 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 11:19:48 +0100 Subject: [PATCH 03/71] [skip ci] ToggleButton -> Widget --- .../source/class/osparc/dashboard/CardBase.js | 23 ++++++++++++++++++- .../osparc/dashboard/FolderButtonBase.js | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 0d058644bce..56a8ebb0e56 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -16,7 +16,7 @@ ************************************************************************ */ qx.Class.define("osparc.dashboard.CardBase", { - extend: qx.ui.form.ToggleButton, + extend: qx.ui.core.Widget, implement: [qx.ui.form.IModel, osparc.filter.IFilterable], include: [qx.ui.form.MModelProperty, osparc.filter.MFilterable], type: "abstract", @@ -237,6 +237,19 @@ qx.Class.define("osparc.dashboard.CardBase", { nullable: true }, + selected: { + check: "Boolean", + init: false, + nullable: false, + }, + + icon: { + check: "String", + init: null, + nullable: true, + apply: "_applyIcon", + }, + resourceData: { check: "Object", nullable: false, @@ -886,6 +899,14 @@ qx.Class.define("osparc.dashboard.CardBase", { return control; }, + setValue: function(value) { + this.setSelected(value); + }, + + getValue: function() { + this.getSelected(); + }, + /** * Event handler for the pointer over event. */ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonBase.js index ff567a659cb..435e63b2129 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonBase.js @@ -16,7 +16,7 @@ ************************************************************************ */ qx.Class.define("osparc.dashboard.FolderButtonBase", { - extend: qx.ui.form.ToggleButton, + extend: qx.ui.core.Widget, implement: [qx.ui.form.IModel, osparc.filter.IFilterable], include: [qx.ui.form.MModelProperty, osparc.filter.MFilterable], type: "abstract", From be05ce1cd8df1645d9913348d0f0a189d564fe93 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 11:20:40 +0100 Subject: [PATCH 04/71] [skip ci] minor --- .../source/class/osparc/dashboard/ToggleButtonContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js index 846624f88e4..1c9c23f84d5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js @@ -22,7 +22,7 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { "changeVisibility": "qx.event.type.Data" }, - static: { + statics: { isValidWidget: function(widget) { // return (card instanceof qx.ui.form.ToggleButton); return ( From e5affe506608cff7cefbd63d8f9150c9fcb763c2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 12:29:02 +0100 Subject: [PATCH 05/71] [skip ci] tap service button --- .../client/source/class/osparc/dashboard/ServiceBrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js index 5fbaa4ebaf7..7ae65ff0bd1 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js @@ -86,7 +86,7 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", { const cards = this._resourcesContainer.reloadCards("services"); cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); - card.addListener("execute", () => this.__itemClicked(card), this); + card.addListener("tap", () => this.__itemClicked(card), this); this._populateCardMenu(card); }); osparc.filter.UIFilterController.dispatch("searchBarFilter"); From 011f9de8661d1a944d1c253fe75579cf890e9b63 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 12:47:40 +0100 Subject: [PATCH 06/71] [skip ci] don't listen to change value --- .../source/class/osparc/dashboard/CardBase.js | 1 + .../osparc/dashboard/FolderButtonItem.js | 3 +-- .../class/osparc/dashboard/FolderButtonNew.js | 3 +-- .../class/osparc/dashboard/GridButtonItem.js | 6 ++--- .../osparc/dashboard/GridButtonLoadMore.js | 4 --- .../class/osparc/dashboard/GridButtonNew.js | 4 --- .../osparc/dashboard/GridButtonPlaceholder.js | 7 ----- .../class/osparc/dashboard/ListButtonItem.js | 6 ++--- .../osparc/dashboard/ListButtonLoadMore.js | 4 --- .../class/osparc/dashboard/ListButtonNew.js | 4 --- .../osparc/dashboard/ListButtonPlaceholder.js | 7 ----- .../class/osparc/dashboard/StudyBrowser.js | 26 +++++++++---------- .../class/osparc/dashboard/TemplateBrowser.js | 1 - .../osparc/dashboard/ToggleButtonContainer.js | 15 ++++++----- .../osparc/dashboard/WorkspaceButtonBase.js | 13 +++++++--- .../osparc/dashboard/WorkspaceButtonItem.js | 3 +-- .../osparc/dashboard/WorkspaceButtonNew.js | 3 +-- 17 files changed, 41 insertions(+), 69 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 56a8ebb0e56..5a8a66df13a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -241,6 +241,7 @@ qx.Class.define("osparc.dashboard.CardBase", { check: "Boolean", init: false, nullable: false, + event: "changeSelected", }, icon: { 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 ac919b73579..b54d45be542 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -33,7 +33,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { appearance: "pb-study" }); - this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); @@ -246,7 +246,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { if (studyBrowserContext !== "trash" && newVal) { this.fireDataEvent("folderSelected", this.getFolderId()); } - this.setValue(false); }, __editFolder: function() { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js index 6fe4c7d9bba..0a637e8d5b3 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js @@ -30,7 +30,7 @@ qx.Class.define("osparc.dashboard.FolderButtonNew", { appearance: "pb-new" }); - this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); @@ -92,7 +92,6 @@ qx.Class.define("osparc.dashboard.FolderButtonNew", { }); folderEditor.addListener("cancel", () => win.close()); } - this.setValue(false); } } }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js index e9019262342..764be022f22 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js @@ -32,7 +32,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); - this.addListener("changeValue", this.__itemSelected, this); + this.addListener("tap", this.__itemSelected, this); }, statics: { @@ -189,12 +189,12 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { __itemSelected: function() { if (this.isItemNotClickable()) { - this.setValue(false); + this.setSelected(false); return; } if (this.isResourceType("study") && this.isMultiSelectionMode()) { - const selected = this.getValue(); + const selected = this.getSelected(); const tick = this.getChildControl("tick-selected"); tick.setVisibility(selected ? "visible" : "excluded"); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonLoadMore.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonLoadMore.js index a10d57dcaa2..af3bf1ae666 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonLoadMore.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonLoadMore.js @@ -50,10 +50,6 @@ qx.Class.define("osparc.dashboard.GridButtonLoadMore", { this.setEnabled(!value); }, - _onToggleChange: function(e) { - this.setValue(false); - }, - _shouldApplyFilter: function() { return false; }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonNew.js index 4a2a3577e31..3cb8a8c92b7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonNew.js @@ -67,10 +67,6 @@ qx.Class.define("osparc.dashboard.GridButtonNew", { }, members: { - _onToggleChange: function(e) { - this.setValue(false); - }, - _shouldApplyFilter: function(data) { return false; }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonPlaceholder.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonPlaceholder.js index 89f9c94270a..b6eb9906ef7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonPlaceholder.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonPlaceholder.js @@ -23,9 +23,6 @@ qx.Class.define("osparc.dashboard.GridButtonPlaceholder", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.PLACEHOLDER); - // make unselectable - this.addListener("changeValue", () => this.setValue(false), this); - this.set({ cursor: "not-allowed" }); @@ -122,10 +119,6 @@ qx.Class.define("osparc.dashboard.GridButtonPlaceholder", { return true; }, - _onToggleChange: function() { - this.setValue(false); - }, - _shouldApplyFilter: function(data) { if (data.text) { const checks = [ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js index 9c433550185..390019015d0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js @@ -29,7 +29,7 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); - this.addListener("changeValue", this.__itemSelected, this); + this.addListener("tap", this.__itemSelected, this); }, statics: { @@ -275,12 +275,12 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { __itemSelected: function() { if (this.isItemNotClickable()) { - this.setValue(false); + this.setSelected(false); return; } if (this.isResourceType("study") && this.isMultiSelectionMode()) { - const selected = this.getValue(); + const selected = this.getSelected(); const tick = this.getChildControl("tick-selected"); tick.setVisibility(selected ? "visible" : "excluded"); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonLoadMore.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonLoadMore.js index cbf818c8cdc..1f0fad3e4a6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonLoadMore.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonLoadMore.js @@ -49,10 +49,6 @@ qx.Class.define("osparc.dashboard.ListButtonLoadMore", { this.setEnabled(!value); }, - _onToggleChange: function(e) { - this.setValue(false); - }, - _shouldApplyFilter: function() { return false; }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonNew.js index d9bb0679f46..7ae28a96cf4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonNew.js @@ -51,10 +51,6 @@ qx.Class.define("osparc.dashboard.ListButtonNew", { }, members: { - _onToggleChange: function(e) { - this.setValue(false); - }, - _shouldApplyFilter: function(data) { return false; }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonPlaceholder.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonPlaceholder.js index 7074ded3194..d813261ef3c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonPlaceholder.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonPlaceholder.js @@ -23,9 +23,6 @@ qx.Class.define("osparc.dashboard.ListButtonPlaceholder", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.PLACEHOLDER); - // make unselectable - this.addListener("changeValue", () => this.setValue(false), this); - this.__layout = this.getChildControl("progress-layout") this.set({ appearance: "pb-new", @@ -108,10 +105,6 @@ qx.Class.define("osparc.dashboard.ListButtonPlaceholder", { return true; }, - _onToggleChange: function() { - this.setValue(false); - }, - _shouldApplyFilter: function(data) { if (data.text) { const checks = [ 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 0a25257f247..c1c4339efd6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -640,16 +640,16 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { card.setMultiSelectionMode(this.getMultiSelection()); card.addListener("tap", e => { if (card.isItemNotClickable()) { - card.setValue(false); + card.setSelected(false); } else { - this.__itemClicked(card, e.getNativeEvent().shiftKey); + this.__studyCardClicked(card, e.getNativeEvent().shiftKey); } }, this); this._populateCardMenu(card); }); }, - __itemClicked: function(item, isShiftPressed) { + __studyCardClicked: function(item, isShiftPressed) { const studiesCont = this._resourcesContainer.getFlatList(); if (isShiftPressed) { @@ -659,13 +659,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { for (let i=minMax[0]; i<=minMax[1]; i++) { const card = studiesCont.getChildren()[i]; if (card.isVisible()) { - card.setValue(true); + card.setSelected(true); } } } studiesCont.setLastSelectedIndex(studiesCont.getIndex(item)); - if (!item.isMultiSelectionMode()) { + if (item.isMultiSelectionMode()) { + item.setSelected(true); + } else { const studyData = this.__getStudyData(item.getUuid(), false); this._openResourceDetails(studyData); this.resetSelection(); @@ -860,7 +862,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { newStudyBtn.setCardKey("new-study"); newStudyBtn.subscribeToFilterGroup("searchBarFilter"); osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn"); - newStudyBtn.addListener("execute", () => this.__newStudyBtnClicked(newStudyBtn)); + newStudyBtn.addListener("tap", () => this.__newStudyBtnClicked(newStudyBtn)); this._resourcesContainer.addNonResourceCard(newStudyBtn); }, @@ -880,8 +882,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (product in newStudiesData) { newStudyBtn.setEnabled(true); - newStudyBtn.addListener("execute", () => { - newStudyBtn.setValue(false); + newStudyBtn.addListener("tap", () => { osparc.data.Resources.get("templates") .then(templates => { if (templates) { @@ -930,7 +931,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const newStudyFromServiceButton = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title, desc) : new osparc.dashboard.ListButtonNew(title, desc); newStudyFromServiceButton.setCardKey("new-"+key); osparc.utils.Utils.setIdToWidget(newStudyFromServiceButton, newButtonInfo.idToWidget); - newStudyFromServiceButton.addListener("execute", () => this.__newStudyFromServiceBtnClicked(newStudyFromServiceButton, latestMetadata["key"], latestMetadata["version"], newButtonInfo.newStudyLabel)); + newStudyFromServiceButton.addListener("tap", () => this.__newStudyFromServiceBtnClicked(newStudyFromServiceButton, latestMetadata["key"], latestMetadata["version"], newButtonInfo.newStudyLabel)); this._resourcesContainer.addNonResourceCard(newStudyFromServiceButton); }) } @@ -1153,8 +1154,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const loadMoreBtn = this._loadingResourcesBtn = (mode === "grid") ? new osparc.dashboard.GridButtonLoadMore() : new osparc.dashboard.ListButtonLoadMore(); loadMoreBtn.setCardKey("load-more"); osparc.utils.Utils.setIdToWidget(loadMoreBtn, "studiesLoading"); - loadMoreBtn.addListener("execute", () => { - loadMoreBtn.setValue(false); + loadMoreBtn.addListener("tap", () => { this._moreResourcesRequired(); }); return loadMoreBtn; @@ -1324,7 +1324,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (osparc.dashboard.ResourceBrowserBase.isCardButtonItem(studyItem)) { studyItem.setMultiSelectionMode(value); if (value === false) { - studyItem.setValue(false); + studyItem.setSelected(false); } } }); @@ -1347,7 +1347,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __newStudyBtnClicked: function(button) { - button.setValue(false); const minStudyData = osparc.data.model.Study.createMinStudyObject(); const existingNames = this._resourcesList.map(study => study["name"]); const title = osparc.utils.Utils.getUniqueName(minStudyData.name, existingNames); @@ -1388,7 +1387,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __newStudyFromServiceBtnClicked: function(button, key, version, newStudyLabel) { - button.setValue(false); this._showLoadingPage(this.tr("Creating ") + osparc.product.Utils.getStudyAlias()); const contextProps = { workspaceId: this.getCurrentWorkspaceId(), diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js index 0b6fc8ccd26..fab2dc1eb94 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js @@ -125,7 +125,6 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", { __itemClicked: function(card) { if (!card.getBlocked()) { - card.setValue(false); const templateData = this.__getTemplateData(card.getUuid()); this._openResourceDetails(templateData); } diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js index 1c9c23f84d5..258303b7532 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js @@ -27,7 +27,8 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { // return (card instanceof qx.ui.form.ToggleButton); return ( widget instanceof osparc.dashboard.CardBase || - widget instanceof osparc.dashboard.FolderButtonBase + widget instanceof osparc.dashboard.FolderButtonBase || + widget instanceof osparc.dashboard.WorkspaceButtonBase ); }, }, @@ -42,7 +43,7 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { return; } this.base(arguments, child, options); - child.addListener("changeValue", () => this.fireDataEvent("changeSelection", this.getSelection()), this); + child.addListener("changeSelected", () => this.fireDataEvent("changeSelection", this.getSelection()), this); child.addListener("changeVisibility", () => this.fireDataEvent("changeVisibility", this.__getVisibles()), this); } else { console.error("ToggleButtonContainer only allows ToggleButton as its children."); @@ -53,7 +54,7 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { * Resets the selection so no toggle button is checked. */ resetSelection: function() { - this.getChildren().map(button => button.setValue(false)); + this.getChildren().map(button => button.setSelected(false)); this.__lastSelectedIdx = null; this.fireDataEvent("changeSelection", this.getSelection()); }, @@ -62,7 +63,7 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { * Returns an array that contains all buttons that are checked. */ getSelection: function() { - return this.getChildren().filter(button => button.getValue()); + return this.getChildren().filter(button => button.getSelected()); }, /** @@ -73,12 +74,12 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { }, /** - * Sets the given button's value to true (checks it) and unchecks all other buttons. If the given button is not present, - * every button in the container will get a false value (unchecked). + * Sets the given button's select prop to true (checks it) and unchecks all other buttons. If the given button is not present, + * every button in the container will get a unselected (unchecked). * @param {qx.ui.form.ToggleButton} child Button that will be checked */ selectOne: function(child) { - this.getChildren().map(button => button.setValue(button === child)); + this.getChildren().map(button => button.setSelected(button === child)); this.setLastSelectedIndex(this.getIndex(child)); }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index c0c93cc9508..a6fb451fc2d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -16,7 +16,7 @@ ************************************************************************ */ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { - extend: qx.ui.form.ToggleButton, + extend: qx.ui.core.Widget, implement: [qx.ui.form.IModel, osparc.filter.IFilterable], include: [qx.ui.form.MModelProperty, osparc.filter.MFilterable], type: "abstract", @@ -24,14 +24,14 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { construct: function() { this.base(arguments); + this._setLayout(new qx.ui.layout.Canvas()); + this.set({ width: this.self().ITEM_WIDTH, height: this.self().ITEM_HEIGHT, padding: 0 }); - this._setLayout(new qx.ui.layout.Canvas()); - this.getChildControl("main-layout"); [ @@ -51,6 +51,13 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { nullable: true }, + icon: { + check: "String", + init: null, + nullable: true, + apply: "_applyIcon", + }, + resourceType: { check: ["workspace"], init: "workspace", diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index eb777ca5dd7..f6d6f53909f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -33,7 +33,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { appearance: "pb-listitem" }); - this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); @@ -259,7 +259,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { if (studyBrowserContext !== "trash" && newVal) { this.fireDataEvent("workspaceSelected", this.getWorkspaceId()); } - this.setValue(false); }, __openShareWith: function() { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index dd65702503b..b2ba2a74eb1 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -30,7 +30,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { appearance: "pb-new" }); - this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); @@ -72,7 +72,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { win.getChildControl("close-button").addListener("tap", () => workspaceEditor.cancel()); workspaceEditor.addListener("cancel", () => win.close()); } - this.setValue(false); } } }); From 84ba8f79e60038b42295e07b49aac4d546d2edbe Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 14:17:59 +0100 Subject: [PATCH 07/71] [skip ci] __evalSelectedButton --- .../class/osparc/dashboard/GridButtonItem.js | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js index 764be022f22..36f13117e2b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js @@ -33,6 +33,8 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); this.addListener("tap", this.__itemSelected, this); + + this.addListener("changeSelected", this.__evalSelectedButton, this); }, statics: { @@ -179,11 +181,9 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { // overridden _applyMultiSelectionMode: function(value) { if (value) { - const menuButton = this.getChildControl("menu-button"); - menuButton.setVisibility("excluded"); - this.__itemSelected(); + this.__evalSelectedButton(); } else { - this.__showMenuOnly(); + this.setSelected(false); } }, @@ -193,26 +193,23 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { return; } - if (this.isResourceType("study") && this.isMultiSelectionMode()) { - const selected = this.getSelected(); - - const tick = this.getChildControl("tick-selected"); - tick.setVisibility(selected ? "visible" : "excluded"); - - const untick = this.getChildControl("tick-unselected"); - untick.setVisibility(selected ? "excluded" : "visible"); - } else { - this.__showMenuOnly(); - } + this.setSelected(!this.getSelected()); }, - __showMenuOnly: function() { + __evalSelectedButton: function() { + const selected = this.getSelected(); const menuButton = this.getChildControl("menu-button"); - menuButton.setVisibility("visible"); const tick = this.getChildControl("tick-selected"); - tick.setVisibility("excluded"); const untick = this.getChildControl("tick-unselected"); - untick.setVisibility("excluded"); + if (this.isResourceType("study") && this.isMultiSelectionMode()) { + menuButton.setVisibility("excluded"); + tick.setVisibility(selected ? "visible" : "excluded"); + untick.setVisibility(selected ? "excluded" : "visible"); + } else { + menuButton.setVisibility("visible"); + tick.setVisibility("excluded"); + untick.setVisibility("excluded"); + } }, // overridden From 23a0aae1f4203ff3d48ce76cbec6d744b8beff0f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 15:33:03 +0100 Subject: [PATCH 08/71] empty specific-info by default --- .../client/source/class/osparc/pricing/UnitEditor.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/pricing/UnitEditor.js b/services/static-webserver/client/source/class/osparc/pricing/UnitEditor.js index 26469666570..38f9022172e 100644 --- a/services/static-webserver/client/source/class/osparc/pricing/UnitEditor.js +++ b/services/static-webserver/client/source/class/osparc/pricing/UnitEditor.js @@ -36,7 +36,6 @@ qx.Class.define("osparc.pricing.UnitEditor", { const manager = this.__validator = new qx.ui.form.validation.Manager(); unitName.setRequired(true); costPerUnit.setRequired(true); - specificInfo.setRequired(true); unitExtraInfoCPU.setRequired(true); unitExtraInfoRAM.setRequired(true); unitExtraInfoVRAM.setRequired(true); @@ -114,8 +113,8 @@ qx.Class.define("osparc.pricing.UnitEditor", { specificInfo: { check: "String", - init: "t2.medium", - nullable: false, + init: null, + nullable: true, event: "changeSpecificInfo" }, @@ -307,7 +306,11 @@ qx.Class.define("osparc.pricing.UnitEditor", { const unitName = this.getUnitName(); const costPerUnit = this.getCostPerUnit(); const comment = this.getComment(); + const awsEc2Instances = []; const specificInfo = this.getSpecificInfo(); + if (specificInfo) { + awsEc2Instances.push(specificInfo); + } const extraInfo = {}; extraInfo["CPU"] = this.getUnitExtraInfoCPU(); extraInfo["RAM"] = this.getUnitExtraInfoRAM(); @@ -323,7 +326,7 @@ qx.Class.define("osparc.pricing.UnitEditor", { "costPerUnit": costPerUnit, "comment": comment, "specificInfo": { - "aws_ec2_instances": [specificInfo] + "aws_ec2_instances": awsEc2Instances }, "unitExtraInfo": extraInfo, "default": isDefault From 4302f5d7e2725e2123bb9e04c91bffc55f7960c2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:05:43 +0100 Subject: [PATCH 09/71] not needed --- .../client/source/class/osparc/dashboard/CardBase.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 5a8a66df13a..a919f13e311 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -900,14 +900,6 @@ qx.Class.define("osparc.dashboard.CardBase", { return control; }, - setValue: function(value) { - this.setSelected(value); - }, - - getValue: function() { - this.getSelected(); - }, - /** * Event handler for the pointer over event. */ From b0e51d55fdd827b0f8f01448f9c81f39fe7c8b87 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:13:22 +0100 Subject: [PATCH 10/71] [skip ci] minor --- .../source/class/osparc/dashboard/GridButtonItem.js | 1 - .../client/source/class/osparc/dashboard/StudyBrowser.js | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js index 36f13117e2b..1825b3f684a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js @@ -189,7 +189,6 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { __itemSelected: function() { if (this.isItemNotClickable()) { - this.setSelected(false); return; } 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 c1c4339efd6..98dea1ee205 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -650,6 +650,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __studyCardClicked: function(item, isShiftPressed) { + if (item.isItemNotClickable()) { + item.setSelected(false); + return; + } + const studiesCont = this._resourcesContainer.getFlatList(); if (isShiftPressed) { @@ -665,9 +670,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } studiesCont.setLastSelectedIndex(studiesCont.getIndex(item)); - if (item.isMultiSelectionMode()) { - item.setSelected(true); - } else { + if (!item.isMultiSelectionMode()) { const studyData = this.__getStudyData(item.getUuid(), false); this._openResourceDetails(studyData); this.resetSelection(); From 8719ce83e942a2ea576db3e4e5c8c32ed1229bed Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:25:59 +0100 Subject: [PATCH 11/71] simpler --- .../class/osparc/dashboard/GridButtonItem.js | 10 ------ .../class/osparc/dashboard/ListButtonItem.js | 34 +++++++------------ .../class/osparc/dashboard/StudyBrowser.js | 8 +---- 3 files changed, 13 insertions(+), 39 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js index 1825b3f684a..537c55aa676 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js @@ -32,8 +32,6 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); - this.addListener("tap", this.__itemSelected, this); - this.addListener("changeSelected", this.__evalSelectedButton, this); }, @@ -187,14 +185,6 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { } }, - __itemSelected: function() { - if (this.isItemNotClickable()) { - return; - } - - this.setSelected(!this.getSelected()); - }, - __evalSelectedButton: function() { const selected = this.getSelected(); const menuButton = this.getChildControl("menu-button"); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js index 390019015d0..f701758eade 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js @@ -29,7 +29,7 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); - this.addListener("tap", this.__itemSelected, this); + this.addListener("changeSelected", this.__evalSelectedButton, this); }, statics: { @@ -265,38 +265,28 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { // overridden _applyMultiSelectionMode: function(value) { if (value) { - const menuButton = this.getChildControl("menu-button"); - menuButton.setVisibility("excluded"); - this.__itemSelected(); + this.__evalSelectedButton(); } else { - this.__showMenuOnly(); - } - }, - - __itemSelected: function() { - if (this.isItemNotClickable()) { this.setSelected(false); - return; } + }, + __evalSelectedButton: function() { + const selected = this.getSelected(); + const menuButton = this.getChildControl("menu-button"); + const tick = this.getChildControl("tick-selected"); + const untick = this.getChildControl("tick-unselected"); if (this.isResourceType("study") && this.isMultiSelectionMode()) { - const selected = this.getSelected(); - - const tick = this.getChildControl("tick-selected"); + menuButton.setVisibility("excluded"); tick.setVisibility(selected ? "visible" : "excluded"); - - const untick = this.getChildControl("tick-unselected"); untick.setVisibility(selected ? "excluded" : "visible"); } else { - this.__showMenuOnly(); + menuButton.setVisibility("visible"); + tick.setVisibility("excluded"); + untick.setVisibility("excluded"); } }, - __showMenuOnly: function() { - const menu = this.getChildControl("menu-button"); - this.getChildControl("menu-selection-stack").setSelection([menu]); - }, - _applyMenu: function(value, old) { const menuButton = this.getChildControl("menu-button"); if (value) { 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 98dea1ee205..6b457bc794d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -638,13 +638,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __configureStudyCards: function(cards) { cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); - card.addListener("tap", e => { - if (card.isItemNotClickable()) { - card.setSelected(false); - } else { - this.__studyCardClicked(card, e.getNativeEvent().shiftKey); - } - }, this); + card.addListener("tap", e => this.__studyCardClicked(card, e.getNativeEvent().shiftKey), this); this._populateCardMenu(card); }); }, From 63d496b85a63d6dc8e45bc4b81a613847ca752a2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:52:39 +0100 Subject: [PATCH 12/71] minors --- .../class/osparc/dashboard/FolderButtonNew.js | 28 +++++++-------- .../osparc/dashboard/WorkspaceButtonNew.js | 36 +++++++++---------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js index 0a637e8d5b3..42bdb7128b4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonNew.js @@ -30,7 +30,7 @@ qx.Class.define("osparc.dashboard.FolderButtonNew", { appearance: "pb-new" }); - this.addListener("tap", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", this.__itemSelected, this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); @@ -77,21 +77,19 @@ qx.Class.define("osparc.dashboard.FolderButtonNew", { this.getChildControl("title"); }, - __itemSelected: function(newVal) { - if (newVal) { - const newFolder = true; - const folderEditor = new osparc.editor.FolderEditor(newFolder); - const title = this.tr("New Folder"); - const win = osparc.ui.window.Window.popUpInWindow(folderEditor, title, 300, 120); - folderEditor.addListener("createFolder", () => { - const name = folderEditor.getLabel(); - this.fireDataEvent("createFolder", { - name, - }); - win.close(); + __itemSelected: function() { + const newFolder = true; + const folderEditor = new osparc.editor.FolderEditor(newFolder); + const title = this.tr("New Folder"); + const win = osparc.ui.window.Window.popUpInWindow(folderEditor, title, 300, 120); + folderEditor.addListener("createFolder", () => { + const name = folderEditor.getLabel(); + this.fireDataEvent("createFolder", { + name, }); - folderEditor.addListener("cancel", () => win.close()); - } + win.close(); + }); + folderEditor.addListener("cancel", () => win.close()); } } }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index b2ba2a74eb1..aa8425858a8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -30,7 +30,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { appearance: "pb-new" }); - this.addListener("tap", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", this.__itemSelected, this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); @@ -54,24 +54,22 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { }, members: { - __itemSelected: function(newVal) { - if (newVal) { - const workspaceEditor = new osparc.editor.WorkspaceEditor(); - const title = this.tr("New Workspace"); - const win = osparc.ui.window.Window.popUpInWindow(workspaceEditor, title, 500, 500).set({ - modal: true, - clickAwayClose: false, - }); - workspaceEditor.addListener("workspaceCreated", () => this.fireEvent("workspaceCreated")); - workspaceEditor.addListener("workspaceDeleted", () => this.fireEvent("workspaceDeleted")); - workspaceEditor.addListener("workspaceUpdated", () => { - win.close(); - this.fireEvent("workspaceUpdated"); - }, this); - workspaceEditor.addListener("updateAccessRights", () => this.fireEvent("workspaceUpdated")); - win.getChildControl("close-button").addListener("tap", () => workspaceEditor.cancel()); - workspaceEditor.addListener("cancel", () => win.close()); - } + __itemSelected: function() { + const workspaceEditor = new osparc.editor.WorkspaceEditor(); + const title = this.tr("New Workspace"); + const win = osparc.ui.window.Window.popUpInWindow(workspaceEditor, title, 500, 500).set({ + modal: true, + clickAwayClose: false, + }); + workspaceEditor.addListener("workspaceCreated", () => this.fireEvent("workspaceCreated")); + workspaceEditor.addListener("workspaceDeleted", () => this.fireEvent("workspaceDeleted")); + workspaceEditor.addListener("workspaceUpdated", () => { + win.close(); + this.fireEvent("workspaceUpdated"); + }, this); + workspaceEditor.addListener("updateAccessRights", () => this.fireEvent("workspaceUpdated")); + win.getChildControl("close-button").addListener("tap", () => workspaceEditor.cancel()); + workspaceEditor.addListener("cancel", () => win.close()); } } }); From dea32d27bb260ad8e03034414a2f98e47111b042 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:53:23 +0100 Subject: [PATCH 13/71] refactor --- .../source/class/osparc/dashboard/CardBase.js | 32 +++++++++++++++++-- .../class/osparc/dashboard/GridButtonItem.js | 27 ---------------- .../class/osparc/dashboard/ListButtonItem.js | 27 ---------------- .../class/osparc/dashboard/StudyBrowser.js | 4 ++- 4 files changed, 33 insertions(+), 57 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index a919f13e311..6419ff08c41 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -33,6 +33,8 @@ qx.Class.define("osparc.dashboard.CardBase", { "pointerout", "focusout" ].forEach(e => this.addListener(e, this._onPointerOut, this)); + + this.addListener("changeSelected", this.__evalSelectedButton, this); }, events: { @@ -260,7 +262,8 @@ qx.Class.define("osparc.dashboard.CardBase", { resourceType: { check: ["study", "template", "service"], - nullable: false, + init: true, + nullable: true, event: "changeResourceType" }, @@ -379,7 +382,7 @@ qx.Class.define("osparc.dashboard.CardBase", { check: "Boolean", init: false, nullable: false, - apply: "_applyMultiSelectionMode" + apply: "__applyMultiSelectionMode" }, fetching: { @@ -458,6 +461,31 @@ qx.Class.define("osparc.dashboard.CardBase", { }); }, + __applyMultiSelectionMode: function(value) { + if (!value) { + this.setSelected(false); + } + this.__evalSelectedButton(); + }, + + __evalSelectedButton: function() { + if ("getResourceType" in this && this.isResourceType("study")) { + const menuButton = this.getChildControl("menu-button"); + const tick = this.getChildControl("tick-selected"); + const untick = this.getChildControl("tick-unselected"); + if (this.isMultiSelectionMode()) { + const selected = this.getSelected(); + menuButton.setVisibility("excluded"); + tick.setVisibility(selected ? "visible" : "excluded"); + untick.setVisibility(selected ? "excluded" : "visible"); + } else { + menuButton.setVisibility("visible"); + tick.setVisibility("excluded"); + untick.setVisibility("excluded"); + } + } + }, + __applyUuid: function(value, old) { const resourceType = this.getResourceType() || "study"; osparc.utils.Utils.setIdToWidget(this, resourceType + "BrowserListItem_" + value); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js index 537c55aa676..5b2778349a1 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js @@ -31,8 +31,6 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { this.base(arguments); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); - - this.addListener("changeSelected", this.__evalSelectedButton, this); }, statics: { @@ -176,31 +174,6 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { return control || this.base(arguments, id); }, - // overridden - _applyMultiSelectionMode: function(value) { - if (value) { - this.__evalSelectedButton(); - } else { - this.setSelected(false); - } - }, - - __evalSelectedButton: function() { - const selected = this.getSelected(); - const menuButton = this.getChildControl("menu-button"); - const tick = this.getChildControl("tick-selected"); - const untick = this.getChildControl("tick-unselected"); - if (this.isResourceType("study") && this.isMultiSelectionMode()) { - menuButton.setVisibility("excluded"); - tick.setVisibility(selected ? "visible" : "excluded"); - untick.setVisibility(selected ? "excluded" : "visible"); - } else { - menuButton.setVisibility("visible"); - tick.setVisibility("excluded"); - untick.setVisibility("excluded"); - } - }, - // overridden _applyLastChangeDate: function(value, old) { if (value && (this.isResourceType("study") || this.isResourceType("template"))) { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js index f701758eade..01557d8947c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js @@ -28,8 +28,6 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { this.base(arguments); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); - - this.addListener("changeSelected", this.__evalSelectedButton, this); }, statics: { @@ -262,31 +260,6 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { }); }, - // overridden - _applyMultiSelectionMode: function(value) { - if (value) { - this.__evalSelectedButton(); - } else { - this.setSelected(false); - } - }, - - __evalSelectedButton: function() { - const selected = this.getSelected(); - const menuButton = this.getChildControl("menu-button"); - const tick = this.getChildControl("tick-selected"); - const untick = this.getChildControl("tick-unselected"); - if (this.isResourceType("study") && this.isMultiSelectionMode()) { - menuButton.setVisibility("excluded"); - tick.setVisibility(selected ? "visible" : "excluded"); - untick.setVisibility(selected ? "excluded" : "visible"); - } else { - menuButton.setVisibility("visible"); - tick.setVisibility("excluded"); - untick.setVisibility("excluded"); - } - }, - _applyMenu: function(value, old) { const menuButton = this.getChildControl("menu-button"); if (value) { 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 6b457bc794d..0d7a18a4be6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -664,7 +664,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } studiesCont.setLastSelectedIndex(studiesCont.getIndex(item)); - if (!item.isMultiSelectionMode()) { + if (item.isMultiSelectionMode()) { + item.setSelected(!item.getSelected()); + } else { const studyData = this.__getStudyData(item.getUuid(), false); this._openResourceDetails(studyData); this.resetSelection(); From 4f6f2b596cf960d79e49e4c993312f93b39009ee Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:54:28 +0100 Subject: [PATCH 14/71] [skip ci] minor --- .../client/source/class/osparc/dashboard/CardBase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 6419ff08c41..f7c2c9dffcb 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -469,7 +469,7 @@ qx.Class.define("osparc.dashboard.CardBase", { }, __evalSelectedButton: function() { - if ("getResourceType" in this && this.isResourceType("study")) { + if (this.isResourceType("study")) { const menuButton = this.getChildControl("menu-button"); const tick = this.getChildControl("tick-selected"); const untick = this.getChildControl("tick-unselected"); From fdc8a5c5ea1e31557009d66cef1d050c335526c7 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 16:56:19 +0100 Subject: [PATCH 15/71] [skip ci] cleanup --- .../source/class/osparc/dashboard/FolderButtonItem.js | 6 +++--- .../source/class/osparc/dashboard/WorkspaceButtonItem.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) 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 b54d45be542..3badcacb564 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -33,7 +33,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { appearance: "pb-study" }); - this.addListener("tap", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", this.__itemSelected, this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); @@ -240,10 +240,10 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { menuButton.setMenu(menu); }, - __itemSelected: function(newVal) { + __itemSelected: function() { const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext(); // do not allow selecting workspace - if (studyBrowserContext !== "trash" && newVal) { + if (studyBrowserContext !== "trash") { this.fireDataEvent("folderSelected", this.getFolderId()); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index f6d6f53909f..01de40e62ca 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -33,7 +33,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { appearance: "pb-listitem" }); - this.addListener("tap", e => this.__itemSelected(e.getData()), this); + this.addListener("tap", this.__itemSelected, this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); @@ -253,10 +253,10 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { }) }, - __itemSelected: function(newVal) { + __itemSelected: function() { const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext(); // do not allow selecting workspace - if (studyBrowserContext !== "trash" && newVal) { + if (studyBrowserContext !== "trash") { this.fireDataEvent("workspaceSelected", this.getWorkspaceId()); } }, From 7850d4ff42d9d51223769841046e9f95c9eef18b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 17:02:39 +0100 Subject: [PATCH 16/71] rename files --- ...ToggleButtonContainer.js => CardContainer.js} | 4 ++-- ...uttonContainer.js => GroupedCardContainer.js} | 6 +++--- .../source/class/osparc/dashboard/NewStudies.js | 6 +++--- .../osparc/dashboard/ResourceContainerManager.js | 16 ++++++++-------- .../class/osparc/dashboard/StudyBrowser.js | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) rename services/static-webserver/client/source/class/osparc/dashboard/{ToggleButtonContainer.js => CardContainer.js} (96%) rename services/static-webserver/client/source/class/osparc/dashboard/{GroupedToggleButtonContainer.js => GroupedCardContainer.js} (96%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js similarity index 96% rename from services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js rename to services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js index 258303b7532..b02ba7a1cd9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ToggleButtonContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js @@ -8,7 +8,7 @@ /** * Container for GridButtonItems and ListButtonItems (ToggleButtons), with some convenient methods. */ -qx.Class.define("osparc.dashboard.ToggleButtonContainer", { +qx.Class.define("osparc.dashboard.CardContainer", { extend: qx.ui.container.Composite, construct: function() { @@ -46,7 +46,7 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", { child.addListener("changeSelected", () => this.fireDataEvent("changeSelection", this.getSelection()), this); child.addListener("changeVisibility", () => this.fireDataEvent("changeVisibility", this.__getVisibles()), this); } else { - console.error("ToggleButtonContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows ToggleButton as its children."); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GroupedToggleButtonContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js similarity index 96% rename from services/static-webserver/client/source/class/osparc/dashboard/GroupedToggleButtonContainer.js rename to services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js index d5dc5505d09..10b7cf8a585 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GroupedToggleButtonContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js @@ -15,7 +15,7 @@ ************************************************************************ */ -qx.Class.define("osparc.dashboard.GroupedToggleButtonContainer", { +qx.Class.define("osparc.dashboard.GroupedCardContainer", { extend: qx.ui.core.Widget, construct: function() { @@ -118,7 +118,7 @@ qx.Class.define("osparc.dashboard.GroupedToggleButtonContainer", { const expanded = this.isExpanded(); const showAllBtn = this.__showAllButton; if (expanded) { - contentContainer = new osparc.dashboard.ToggleButtonContainer(); + contentContainer = new osparc.dashboard.CardContainer(); showAllBtn.show(); } else { const spacing = osparc.dashboard.GridButtonBase.SPACING; @@ -189,7 +189,7 @@ qx.Class.define("osparc.dashboard.GroupedToggleButtonContainer", { } this.__childVisibilityChanged(); } else { - console.error("ToggleButtonContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows ToggleButton as its children."); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/NewStudies.js b/services/static-webserver/client/source/class/osparc/dashboard/NewStudies.js index 7c01ff5c74d..0e0d92b61b6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/NewStudies.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/NewStudies.js @@ -27,7 +27,7 @@ qx.Class.define("osparc.dashboard.NewStudies", { this._setLayout(new qx.ui.layout.VBox(10)); - const flatList = this.__flatList = new osparc.dashboard.ToggleButtonContainer(); + const flatList = this.__flatList = new osparc.dashboard.CardContainer(); [ "changeSelection", "changeVisibility" @@ -86,7 +86,7 @@ qx.Class.define("osparc.dashboard.NewStudies", { this._add(groupContainer); }); } else { - const flatList = this.__flatList = new osparc.dashboard.ToggleButtonContainer(); + const flatList = this.__flatList = new osparc.dashboard.CardContainer(); osparc.utils.Utils.setIdToWidget(flatList, listId); [ "changeSelection", @@ -138,7 +138,7 @@ qx.Class.define("osparc.dashboard.NewStudies", { }, __createGroupContainer: function(groupId, headerLabel, headerColor = "text") { - const groupContainer = new osparc.dashboard.GroupedToggleButtonContainer().set({ + const groupContainer = new osparc.dashboard.GroupedCardContainer().set({ groupId: groupId.toString(), headerLabel, headerIcon: "", 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 eebcfc98b86..5f142b52ec0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -33,10 +33,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__groupedContainersList = []; if (resourceType === "study") { - const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer(); + const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.CardContainer(); this._add(workspacesContainer); - const foldersContainer = this.__foldersContainer = new osparc.dashboard.ToggleButtonContainer(); + const foldersContainer = this.__foldersContainer = new osparc.dashboard.CardContainer(); this._add(foldersContainer); } @@ -118,7 +118,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { __groupedContainers: null, addNonResourceCard: function(card) { - if (osparc.dashboard.ToggleButtonContainer.isValidWidget(card)) { + if (osparc.dashboard.CardContainer.isValidWidget(card)) { if (this.getGroupBy()) { // it will always go to the no-group group const noGroupContainer = this.__getGroupContainer("no-group"); @@ -129,12 +129,12 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.self().sortListByPriority(this.__nonGroupedContainer); } } else { - console.error("ToggleButtonContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows ToggleButton as its children."); } }, removeNonResourceCard: function(card) { - if (osparc.dashboard.ToggleButtonContainer.isValidWidget(card)) { + if (osparc.dashboard.CardContainer.isValidWidget(card)) { if (this.getGroupBy()) { const noGroupContainer = this.__getGroupContainer("no-group"); if (noGroupContainer.getContentContainer().getChildren().indexOf(card) > -1) { @@ -144,7 +144,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__nonGroupedContainer.remove(card); } } else { - console.error("ToggleButtonContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows ToggleButton as its children."); } }, @@ -161,7 +161,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, __createGroupContainer: function(groupId, headerLabel, headerColor = "text") { - const groupContainer = new osparc.dashboard.GroupedToggleButtonContainer().set({ + const groupContainer = new osparc.dashboard.GroupedCardContainer().set({ groupId: groupId.toString(), headerLabel, headerIcon: "", @@ -317,7 +317,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, __createFlatList: function() { - const flatList = new osparc.dashboard.ToggleButtonContainer(); + const flatList = new osparc.dashboard.CardContainer(); const setContainerSpacing = () => { const spacing = this.getMode() === "grid" ? osparc.dashboard.GridButtonBase.SPACING : osparc.dashboard.ListButtonBase.SPACING; flatList.getLayout().set({ 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 0d7a18a4be6..a4c93dbcb48 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -48,7 +48,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, events: { - "publishTemplate": "qx.event.type.Data" + "publishTemplate": "qx.event.type.Data", }, properties: { From fe218542d8ef4f2b3efae70a9dcdf94a71d3516b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 17:03:08 +0100 Subject: [PATCH 17/71] [skip ci] rename --- .../client/source/class/osparc/dashboard/CardContainer.js | 4 ++-- .../source/class/osparc/dashboard/ResourceContainerManager.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js index b02ba7a1cd9..ee7c2bc0fc9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js @@ -23,7 +23,7 @@ qx.Class.define("osparc.dashboard.CardContainer", { }, statics: { - isValidWidget: function(widget) { + isValidCard: function(widget) { // return (card instanceof qx.ui.form.ToggleButton); return ( widget instanceof osparc.dashboard.CardBase || @@ -38,7 +38,7 @@ qx.Class.define("osparc.dashboard.CardContainer", { // overridden add: function(child, options) { - if (this.self().isValidWidget(child)) { + if (this.self().isValidCard(child)) { if (osparc.dashboard.ResourceContainerManager.cardExists(this, child)) { return; } 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 5f142b52ec0..d5cbb386f05 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -118,7 +118,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { __groupedContainers: null, addNonResourceCard: function(card) { - if (osparc.dashboard.CardContainer.isValidWidget(card)) { + if (osparc.dashboard.CardContainer.isValidCard(card)) { if (this.getGroupBy()) { // it will always go to the no-group group const noGroupContainer = this.__getGroupContainer("no-group"); @@ -134,7 +134,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, removeNonResourceCard: function(card) { - if (osparc.dashboard.CardContainer.isValidWidget(card)) { + if (osparc.dashboard.CardContainer.isValidCard(card)) { if (this.getGroupBy()) { const noGroupContainer = this.__getGroupContainer("no-group"); if (noGroupContainer.getContentContainer().getChildren().indexOf(card) > -1) { From 0e44843c756265da6e314224ea67f55a3af36773 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 17:06:06 +0100 Subject: [PATCH 18/71] [skip ci] renaming --- .../source/class/osparc/dashboard/CardContainer.js | 9 ++++----- .../class/osparc/dashboard/GroupedCardContainer.js | 4 ++-- .../class/osparc/dashboard/ResourceContainerManager.js | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js index ee7c2bc0fc9..047b047e8f7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardContainer.js @@ -6,7 +6,7 @@ */ /** - * Container for GridButtonItems and ListButtonItems (ToggleButtons), with some convenient methods. + * Container for GridButtons and ListButtons (CardBase, FolderButtonBase and WorkspaceButtonBase), with some convenient methods. */ qx.Class.define("osparc.dashboard.CardContainer", { extend: qx.ui.container.Composite, @@ -24,7 +24,6 @@ qx.Class.define("osparc.dashboard.CardContainer", { statics: { isValidCard: function(widget) { - // return (card instanceof qx.ui.form.ToggleButton); return ( widget instanceof osparc.dashboard.CardBase || widget instanceof osparc.dashboard.FolderButtonBase || @@ -46,7 +45,7 @@ qx.Class.define("osparc.dashboard.CardContainer", { child.addListener("changeSelected", () => this.fireDataEvent("changeSelection", this.getSelection()), this); child.addListener("changeVisibility", () => this.fireDataEvent("changeVisibility", this.__getVisibles()), this); } else { - console.error("CardContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows CardBase as its children."); } }, @@ -76,7 +75,7 @@ qx.Class.define("osparc.dashboard.CardContainer", { /** * Sets the given button's select prop to true (checks it) and unchecks all other buttons. If the given button is not present, * every button in the container will get a unselected (unchecked). - * @param {qx.ui.form.ToggleButton} child Button that will be checked + * @param {qx.ui.form.CardBase} child Button that will be checked */ selectOne: function(child) { this.getChildren().map(button => button.setSelected(button === child)); @@ -85,7 +84,7 @@ qx.Class.define("osparc.dashboard.CardContainer", { /** * Gets the index in the container of the given button. - * @param {qx.ui.form.ToggleButton} child Button that will be checked + * @param {qx.ui.form.CardBase} child Button that will be checked */ getIndex: function(child) { return this.getChildren().findIndex(button => button === child); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js b/services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js index 10b7cf8a585..2223517302c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GroupedCardContainer.js @@ -176,7 +176,7 @@ qx.Class.define("osparc.dashboard.GroupedCardContainer", { // overridden add: function(child, idx) { - if (child instanceof qx.ui.form.ToggleButton) { + if (osparc.dashboard.CardContainer.isValidCard(child)) { const container = this.getContentContainer(); if (osparc.dashboard.ResourceContainerManager.cardExists(container, child)) { return; @@ -189,7 +189,7 @@ qx.Class.define("osparc.dashboard.GroupedCardContainer", { } this.__childVisibilityChanged(); } else { - console.error("CardContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows CardBase as its children."); } }, 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 d5cbb386f05..258916eefbb 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -129,7 +129,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.self().sortListByPriority(this.__nonGroupedContainer); } } else { - console.error("CardContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows CardBase as its children."); } }, @@ -144,7 +144,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__nonGroupedContainer.remove(card); } } else { - console.error("CardContainer only allows ToggleButton as its children."); + console.error("CardContainer only allows CardBase as its children."); } }, From 44713c9cc1bd98faf512eb78cd58c98d2a802ea4 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 12 Dec 2024 17:09:51 +0100 Subject: [PATCH 19/71] prettifyMenus --- .../source/class/osparc/dashboard/FolderButtonItem.js | 6 +++--- .../source/class/osparc/dashboard/WorkspaceButtonItem.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) 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 3badcacb564..9699e6f3c4a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -188,9 +188,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { const menuButton = this.getChildControl("menu-button"); menuButton.setVisibility("visible"); - const menu = new qx.ui.menu.Menu().set({ - position: "bottom-right" - }); + const menu = new qx.ui.menu.Menu(); + menu.setPosition("bottom-right"); + osparc.utils.Utils.prettifyMenu(menu); const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext(); if ( diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 01de40e62ca..91ab3a26233 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -181,9 +181,9 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { const menuButton = this.getChildControl("menu-button"); menuButton.setVisibility("visible"); - const menu = new qx.ui.menu.Menu().set({ - position: "bottom-right" - }); + const menu = new qx.ui.menu.Menu(); + menu.setPosition("bottom-right"); + osparc.utils.Utils.prettifyMenu(menu); const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext(); if ( From 288ef496e1aa1360726232c4b0e3126556c5cfe2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 10:14:56 +0100 Subject: [PATCH 20/71] [skip ci] multiselection working --- .../source/class/osparc/dashboard/CardBase.js | 8 ++++-- .../class/osparc/dashboard/StudyBrowser.js | 28 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index f7c2c9dffcb..d8c6d7f4d92 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -469,11 +469,15 @@ qx.Class.define("osparc.dashboard.CardBase", { }, __evalSelectedButton: function() { - if (this.isResourceType("study")) { + if ( + this.isResourceType("study") || + this.isResourceType("template") || + this.isResourceType("service") + ) { const menuButton = this.getChildControl("menu-button"); const tick = this.getChildControl("tick-selected"); const untick = this.getChildControl("tick-unselected"); - if (this.isMultiSelectionMode()) { + if (this.isResourceType("study") && this.isMultiSelectionMode()) { const selected = this.getSelected(); menuButton.setVisibility("excluded"); tick.setVisibility(selected ? "visible" : "excluded"); 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 a4c93dbcb48..eb74c16ebbc 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -649,23 +649,21 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { return; } - const studiesCont = this._resourcesContainer.getFlatList(); - - if (isShiftPressed) { - const lastIdx = studiesCont.getLastSelectedIndex(); - const currentIdx = studiesCont.getIndex(item); - const minMax = [Math.min(lastIdx, currentIdx), Math.max(lastIdx, currentIdx)]; - for (let i=minMax[0]; i<=minMax[1]; i++) { - const card = studiesCont.getChildren()[i]; - if (card.isVisible()) { - card.setSelected(true); - } - } - } - studiesCont.setLastSelectedIndex(studiesCont.getIndex(item)); - if (item.isMultiSelectionMode()) { item.setSelected(!item.getSelected()); + const studiesCont = this._resourcesContainer.getFlatList(); + if (isShiftPressed) { + const lastIdx = studiesCont.getLastSelectedIndex(); + const currentIdx = studiesCont.getIndex(item); + const minMax = [Math.min(lastIdx, currentIdx), Math.max(lastIdx, currentIdx)]; + for (let i=minMax[0]; i<=minMax[1]; i++) { + const card = studiesCont.getChildren()[i]; + if (card.isVisible()) { + card.setSelected(true); + } + } + } + studiesCont.setLastSelectedIndex(studiesCont.getIndex(item)); } else { const studyData = this.__getStudyData(item.getUuid(), false); this._openResourceDetails(studyData); From a51fc687c7cf2254460f6ec9d9078018713a4154 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 10:28:28 +0100 Subject: [PATCH 21/71] support null first and last name --- .../class/osparc/desktop/account/MyAccount.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js index 40a3e5b5918..1d19d05f390 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js +++ b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js @@ -64,17 +64,24 @@ qx.Class.define("osparc.desktop.account.MyAccount", { authData.bind("username", usernameLabel, "value"); layout.add(usernameLabel); - const name = new qx.ui.basic.Label().set({ + const nameLabel = new qx.ui.basic.Label().set({ font: "text-13", alignX: "center" }); - layout.add(name); - authData.bind("firstName", name, "value", { - converter: firstName => firstName + " " + authData.getLastName() - }); - authData.bind("lastName", name, "value", { - converter: lastName => authData.getFirstName() + " " + lastName - }); + layout.add(nameLabel); + const updateName = () => { + let name = ""; + if (authData.getFirstName()) { + name += authData.getFirstName(); + } + if (authData.getLastName()) { + name += " " + authData.getLastName(); + } + nameLabel.setValue(name); + } + updateName(); + authData.addListener("changeFirstName", updateName); + authData.addListener("changeLastName", updateName); if (authData.getRole() !== "user") { const role = authData.getFriendlyRole(); From 744d96fd23522595db1804e3cc027d810d7439eb Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 11:30:12 +0100 Subject: [PATCH 22/71] [skip ci] attachDragHandlers and attachDropHandlers --- .../osparc/dashboard/FolderButtonItem.js | 24 +++++++++++++++++++ .../class/osparc/dashboard/StudyBrowser.js | 16 +++++++++++++ 2 files changed, 40 insertions(+) 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 9699e6f3c4a..c4822e946a8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -152,6 +152,30 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { osparc.utils.Utils.setIdToWidget(this, "folderItem_" + folder.getFolderId()); this.__addMenuButton(); + + this.__attachDragHandlers(); + this.__attachDropHandlers(); + }, + + __attachDragHandlers: function() { + this.setDraggable(true); + this.addListener("dragstart", e => { + e.addType("moveFolder"); + }); + }, + + __attachDropHandlers: function() { + this.setDroppable(true); + this.addListener("dragover", e => { + if (e.supportsType("moveStudy")) { + console.log("dragover", "moveStudy", e); + return; + } else if (e.supportsType("moveFolder")) { + console.log("dragover", "moveFolder", e); + return; + } + e.preventDefault(); + }); }, __applyWorkspaceId: function(workspaceId) { 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 eb74c16ebbc..0361eaece8e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -640,6 +640,22 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { card.setMultiSelectionMode(this.getMultiSelection()); card.addListener("tap", e => this.__studyCardClicked(card, e.getNativeEvent().shiftKey), this); this._populateCardMenu(card); + + this.__attachDragHandlers(card); + }); + }, + + __attachDragHandlers: function(card) { + card.setDraggable(true); + card.addListener("dragstart", e => { + // Register supported types + e.addType("moveStudy"); + + // Register supported actions + e.addAction("move"); + }); + card.addListener("droprequest", e => { + console.log("Related of droprequest: " + e.getRelatedTarget()); }); }, From 1f68f7cf68d3e8d952117a1ee6107d488d195121 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 12:44:11 +0100 Subject: [PATCH 23/71] [skip ci] minor --- .../client/source/class/osparc/file/FileLabelWithActions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/file/FileLabelWithActions.js b/services/static-webserver/client/source/class/osparc/file/FileLabelWithActions.js index 15eec413914..35837fff2c7 100644 --- a/services/static-webserver/client/source/class/osparc/file/FileLabelWithActions.js +++ b/services/static-webserver/client/source/class/osparc/file/FileLabelWithActions.js @@ -198,7 +198,7 @@ qx.Class.define("osparc.file.FileLabelWithActions", { request .then(data => { this.fireDataEvent("fileDeleted", data); - osparc.FlashMessenger.getInstance().logAs(this.tr("File successfully deleted"), "ERROR"); + osparc.FlashMessenger.getInstance().logAs(this.tr("File successfully deleted"), "INFO"); }); } } From b5605852bd33ec69ba95013db8001aafdbc39859 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 13:02:42 +0100 Subject: [PATCH 24/71] [skip ci] pass ordingin info in drag event --- .../osparc/dashboard/FolderButtonItem.js | 25 +++++++++++++------ .../class/osparc/dashboard/StudyBrowser.js | 8 +++--- 2 files changed, 21 insertions(+), 12 deletions(-) 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 c4822e946a8..c8dfbb7bb95 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -160,21 +160,30 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { __attachDragHandlers: function() { this.setDraggable(true); this.addListener("dragstart", e => { - e.addType("moveFolder"); + e.addAction("move"); + e.addType("osparc-moveFolder"); + e.addData("osparc-moveFolder", { + "folderOrigin": this.getFolder(), + }); }); }, __attachDropHandlers: function() { this.setDroppable(true); this.addListener("dragover", e => { - if (e.supportsType("moveStudy")) { - console.log("dragover", "moveStudy", e); - return; - } else if (e.supportsType("moveFolder")) { - console.log("dragover", "moveFolder", e); - return; + let compatible = false; + if (e.supportsType("osparc-moveStudy")) { + compatible = true; + const data = e.getData("osparc-moveStudy"); + console.log("osparc-moveStudy", data["studyDataOrigin"]); + } else if (e.supportsType("osparc-moveFolder")) { + compatible = true; + const data = e.getData("osparc-moveFolder"); + console.log("osparc-moveFolder", data["folderOrigin"]); + } + if (!compatible) { + e.preventDefault(); } - e.preventDefault(); }); }, 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 0361eaece8e..98153e7937f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -648,11 +648,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __attachDragHandlers: function(card) { card.setDraggable(true); card.addListener("dragstart", e => { - // Register supported types - e.addType("moveStudy"); - - // Register supported actions e.addAction("move"); + e.addType("osparc-moveStudy"); + e.addData("osparc-moveStudy", { + "studyDataOrigin": card.getResourceData(), + }); }); card.addListener("droprequest", e => { console.log("Related of droprequest: " + e.getRelatedTarget()); From 3a5bd4a6a4f1b9c8a0650287c85ad8d70918b698 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 13:15:24 +0100 Subject: [PATCH 25/71] [skip ci] compatibility checks --- .../osparc/dashboard/FolderButtonItem.js | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) 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 c8dfbb7bb95..8c1336ce1a5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -173,13 +173,42 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.addListener("dragover", e => { let compatible = false; if (e.supportsType("osparc-moveStudy")) { - compatible = true; - const data = e.getData("osparc-moveStudy"); - console.log("osparc-moveStudy", data["studyDataOrigin"]); + const studyData = e.getData("osparc-moveStudy"); + // Compatibility checks: + // - My workspace + // - None + // - Shared workspace + // - write access on workspace + const workspaceId = studyData["workspaceId"]; + if (workspaceId) { + const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); + if (workspace) { + compatible = workspace.getMyAccessRights()["write"]; + } + } else { + compatible = true; + } } else if (e.supportsType("osparc-moveFolder")) { - compatible = true; const data = e.getData("osparc-moveFolder"); - console.log("osparc-moveFolder", data["folderOrigin"]); + const folder = data["folderOrigin"]; + // Compatibility checks: + // - It's not the same folder + // - My workspace + // - None + // - Shared workspace + // - write access on workspace + compatible = this.getFolder() !== folder; + const workspaceId = folder.getWorkspaceId(); + if (compatible) { + if (workspaceId) { + const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); + if (workspace) { + compatible = workspace.getMyAccessRights()["write"]; + } + } else { + compatible = true; + } + } } if (!compatible) { e.preventDefault(); From c3622d09366f3c410c10a3bf08a1635f490d96e1 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 13:51:29 +0100 Subject: [PATCH 26/71] move working --- .../osparc/dashboard/FolderButtonItem.js | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) 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 8c1336ce1a5..cb3cd9b4c07 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -170,10 +170,11 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { __attachDropHandlers: function() { this.setDroppable(true); + this.addListener("dragover", e => { let compatible = false; if (e.supportsType("osparc-moveStudy")) { - const studyData = e.getData("osparc-moveStudy"); + const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; // Compatibility checks: // - My workspace // - None @@ -189,14 +190,13 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { compatible = true; } } else if (e.supportsType("osparc-moveFolder")) { - const data = e.getData("osparc-moveFolder"); - const folder = data["folderOrigin"]; // Compatibility checks: // - It's not the same folder // - My workspace // - None // - Shared workspace // - write access on workspace + const folder = e.getData("osparc-moveFolder")["folderOrigin"]; compatible = this.getFolder() !== folder; const workspaceId = folder.getWorkspaceId(); if (compatible) { @@ -211,9 +211,32 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { } } if (!compatible) { + // do not allow e.preventDefault(); } }); + + 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(), + } + }; + 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"); + }); + } + }); }, __applyWorkspaceId: function(workspaceId) { From b3833b54bce323ebd0100595b98c1026bf986197 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 16:40:37 +0100 Subject: [PATCH 27/71] wire signals --- .../osparc/dashboard/FolderButtonItem.js | 28 +++++++++---------- .../osparc/dashboard/ResourceBrowserBase.js | 10 +++++++ .../dashboard/ResourceContainerManager.js | 4 +++ .../class/osparc/dashboard/StudyBrowser.js | 11 ++++++-- 4 files changed, 35 insertions(+), 18 deletions(-) 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) { From 1ff160af05972f985f4b036b186030d41b5cf03f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 16:45:05 +0100 Subject: [PATCH 28/71] [skip ci] minor --- .../class/osparc/dashboard/StudyBrowser.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 384a19046be..676e690c4f8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -433,6 +433,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.filter.UIFilterController.dispatch("searchBarFilter"); }, + _studyToFolderRequested: function(data) { + console.log("studyToFolderRequested", data); + }, + // WORKSPACES __reloadWorkspaceCards: function() { this._resourcesContainer.setWorkspacesToList(this.__workspacesList); @@ -595,6 +599,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { moveFolderTo.addListener("cancel", () => win.close()); }, + _folderToFolderRequested: function(data) { + console.log("folderToFolderRequested", data); + }, + _trashFolderRequested: function(folderId) { osparc.store.Folders.getInstance().trashFolder(folderId, this.getCurrentWorkspaceId()) .then(() => { @@ -635,14 +643,6 @@ 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()); From 10ebce48b5cac6e6460637a7e84c53e2925d4bce Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 16:58:38 +0100 Subject: [PATCH 29/71] move study working --- .../osparc/dashboard/FolderButtonItem.js | 2 +- .../class/osparc/dashboard/StudyBrowser.js | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) 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 ec55b646712..9c9de365572 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -222,7 +222,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { if (e.supportsType("osparc-moveStudy")) { const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; const studyToFolderData = { - studyId: studyData["uuid"], + studyData, destFolderId: this.getFolderId(), }; this.fireDataEvent("studyToFolderRequested", studyToFolderData); 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 676e690c4f8..bd962e0d636 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -433,10 +433,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.filter.UIFilterController.dispatch("searchBarFilter"); }, - _studyToFolderRequested: function(data) { - console.log("studyToFolderRequested", data); - }, - // WORKSPACES __reloadWorkspaceCards: function() { this._resourcesContainer.setWorkspacesToList(this.__workspacesList); @@ -600,7 +596,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, _folderToFolderRequested: function(data) { - console.log("folderToFolderRequested", data); + const { + folderId, + destFolderId, + } = data; + osparc.store.Folders.getInstance().moveFolderToFolder(folderId, destFolderId) + .then(() => this.__reloadFolders()) + .catch(err => console.error(err)); }, _trashFolderRequested: function(folderId) { @@ -1229,7 +1231,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const studyData = button.getResourceData(); this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace .then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder - .then(() => this.__removeFromStudyList(studyData["uuid"])) .catch(err => { console.error(err); osparc.FlashMessenger.logAs(err.message, "ERROR"); @@ -1649,7 +1650,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const moveStudy = () => { this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace .then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder - .then(() => this.__removeFromStudyList(studyData["uuid"])) .catch(err => { console.error(err); osparc.FlashMessenger.logAs(err.message, "ERROR"); @@ -1703,6 +1703,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }; return osparc.data.Resources.fetch("studies", "moveToFolder", params) .then(() => studyData["folderId"] = destFolderId) + .then(() => this.__removeFromStudyList(studyData["uuid"])); + }, + + _studyToFolderRequested: function(data) { + const { + studyData, + destFolderId, + } = data; + this.__moveStudyToFolder(studyData, destFolderId) .catch(err => { console.error(err); osparc.FlashMessenger.logAs(err.message, "ERROR"); From 451f3bb58c46f5f0696c5d5b1d054e523e8d9898 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 18:28:29 +0100 Subject: [PATCH 30/71] minor --- .../client/source/class/osparc/dashboard/CardBase.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index d8c6d7f4d92..c9171ebc2e2 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -470,9 +470,9 @@ qx.Class.define("osparc.dashboard.CardBase", { __evalSelectedButton: function() { if ( - this.isResourceType("study") || - this.isResourceType("template") || - this.isResourceType("service") + this.hasChildControl("menu-button") && + this.hasChildControl("tick-selected") && + this.hasChildControl("tick-unselected") ) { const menuButton = this.getChildControl("menu-button"); const tick = this.getChildControl("tick-selected"); From 884f8338180d88767aa0210dc0b83c70c578e01b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 18:28:42 +0100 Subject: [PATCH 31/71] not needed --- .../client/source/class/osparc/service/ServiceListItem.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js index c970c2df3a9..dc239da7c93 100644 --- a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js +++ b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js @@ -35,14 +35,6 @@ qx.Class.define("osparc.service.ServiceListItem", { } this.subscribeToFilterGroup("serviceCatalog"); - - /** - * The idea here is to show some extra options when a service is selected: - * - Version selection - * - Pricing unit selection if applies - */ - // But the toggle button consumes all the events, I believe that the trick is to use the anonymous property - // this.addListener("changeValue", e => this.__itemSelected(e.getData())); }, properties: { From afe48e5af0fd0893e39dfdd5473644c578676c4e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 18:30:54 +0100 Subject: [PATCH 32/71] list items are not toggle buttons --- .../class/osparc/service/ServiceList.js | 59 +++++++++---------- .../class/osparc/workbench/ServiceCatalog.js | 2 +- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/service/ServiceList.js b/services/static-webserver/client/source/class/osparc/service/ServiceList.js index 06ca9bca1e7..72d1164f6dd 100644 --- a/services/static-webserver/client/source/class/osparc/service/ServiceList.js +++ b/services/static-webserver/client/source/class/osparc/service/ServiceList.js @@ -36,7 +36,7 @@ qx.Class.define("osparc.service.ServiceList", { }, events: { - "changeValue": "qx.event.type.Data", + "changeSelected": "qx.event.type.Data", "serviceAdd": "qx.event.type.Data" }, @@ -53,33 +53,26 @@ qx.Class.define("osparc.service.ServiceList", { }, members: { - __buttonGroup: null, __filterGroup: null, _applyModel: function(model) { this._removeAll(); - const group = this.__buttonGroup = new qx.ui.form.RadioGroup().set({ - allowEmptySelection: true - }); + this.__serviceListItem = []; model.toArray().forEach(service => { - const button = new osparc.service.ServiceListItem(service); + const item = new osparc.service.ServiceListItem(service); if (this.__filterGroup !== null) { - button.subscribeToFilterGroup(this.__filterGroup); + item.subscribeToFilterGroup(this.__filterGroup); } - group.add(button); - this._add(button); - button.addListener("dbltap", () => { - this.fireDataEvent("serviceAdd", button.getService()); - }, this); - button.addListener("keypress", e => { + this._add(item); + item.addListener("tap", () => this.__setSelected(item)); + item.addListener("dbltap", () => this.fireDataEvent("serviceAdd", item.getService()), this); + item.addListener("keypress", e => { if (e.getKeyIdentifier() === "Enter") { - this.fireDataEvent("serviceAdd", button.getService()); + this.fireDataEvent("serviceAdd", item.getService()); } }, this); }); - - group.addListener("changeValue", e => this.dispatchEvent(e.clone()), this); }, /** @@ -88,37 +81,41 @@ qx.Class.define("osparc.service.ServiceList", { * @return Returns the model of the selected service or null if selection is empty. */ getSelected: function() { - if (this.__buttonGroup && this.__buttonGroup.getSelection().length) { - return this.__buttonGroup.getSelection()[0].getService(); + const items = this._getChildren(); + for (let i=0; i item.setSelected(item === selectedItem)); + this.fireDataEvent("changeSelected", selectedItem); + }, + /** * Function checking if the selection is empty or not * * @return True if no item is selected, false if there one or more item selected. */ isSelectionEmpty: function() { - if (this.__buttonGroup == null) { - return true; - } - return this.__buttonGroup.getSelection().length === 0; + const selecetedItems = this._getChildren().filter(item => item.getSelected()); + selecetedItems.length === 0; }, /** * Function that selects the first visible button. */ selectFirstVisible: function() { - if (this._hasChildren()) { - const buttons = this._getChildren(); - let current = buttons[0]; - let i = 1; - while (i { + this.__serviceList.addListener("changeSelected", e => { if (e.getData() && e.getData().getService()) { const selectedService = e.getData().getService(); this.__changedSelection(selectedService.getKey()); From ed57fb4bc8aa80c956a838e1e064307cb51bb3d9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 10:17:53 +0100 Subject: [PATCH 33/71] smaller TIP disclaimer --- .../client/source/class/osparc/auth/ui/LoginView.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js index 56972d7eb6f..fdbcebeaec2 100644 --- a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js +++ b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js @@ -140,6 +140,8 @@ qx.Class.define("osparc.auth.ui.LoginView", { `; } const disclaimer = osparc.announcement.AnnouncementUIFactory.createLoginAnnouncement(this.tr("Disclaimer"), text); + disclaimer.getChildren()[0].setFont("text-14"); // title + disclaimer.getChildren()[1].setFont("text-12"); // description this.add(disclaimer); this.add(new qx.ui.core.Spacer(), { From 0513e3e09a71262716a213a3065033202718d427 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 10:30:18 +0100 Subject: [PATCH 34/71] prettify listbuttonitem menu --- .../source/class/osparc/dashboard/GridButtonItem.js | 2 +- .../source/class/osparc/dashboard/ListButtonItem.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js index 5b2778349a1..003648f7629 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js @@ -236,7 +236,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", { const menuButton = this.getChildControl("menu-button"); if (menu) { menuButton.setMenu(menu); - menu.setPosition("top-left"); + menu.setPosition("bottom-left"); osparc.utils.Utils.prettifyMenu(menu); osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu"); this.evaluateMenuButtons(); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js index 01557d8947c..5a80947d803 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js @@ -260,13 +260,16 @@ qx.Class.define("osparc.dashboard.ListButtonItem", { }); }, - _applyMenu: function(value, old) { + _applyMenu: function(menu, old) { const menuButton = this.getChildControl("menu-button"); - if (value) { - menuButton.setMenu(value); - osparc.utils.Utils.setIdToWidget(value, "studyItemMenuMenu"); + if (menu) { + menuButton.setMenu(menu); + menu.setPosition("bottom-left"); + osparc.utils.Utils.prettifyMenu(menu); + osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu"); + this.evaluateMenuButtons(); } - menuButton.setVisibility(value ? "visible" : "excluded"); + menuButton.setVisibility(menu ? "visible" : "excluded"); } } }); From 97cc262e3457571a686acdbe2bb0013330d95e66 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 10:45:21 +0100 Subject: [PATCH 35/71] bgColor --- .../client/source/class/osparc/service/ServiceListItem.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js index dc239da7c93..9363fbb19a2 100644 --- a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js +++ b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js @@ -35,6 +35,10 @@ qx.Class.define("osparc.service.ServiceListItem", { } this.subscribeToFilterGroup("serviceCatalog"); + + this.bind("selected", this, "backgroundColor", { + converter: selected => selected ? "strong-main" : "info" + }); }, properties: { From d61362f0d38196f42274314a1855086fcc7bc568 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 11:07:13 +0100 Subject: [PATCH 36/71] minor --- .../client/source/class/osparc/dashboard/MoveResourceTo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/MoveResourceTo.js b/services/static-webserver/client/source/class/osparc/dashboard/MoveResourceTo.js index ecd26def377..aefa81ef810 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/MoveResourceTo.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/MoveResourceTo.js @@ -73,7 +73,7 @@ qx.Class.define("osparc.dashboard.MoveResourceTo", { switch (id) { case "current-location": { control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); - const intro = new qx.ui.basic.Label(this.tr("Current location")); + const intro = new qx.ui.basic.Label(this.tr("Current location:")); control.add(intro); const workspace = osparc.store.Workspaces.getInstance().getWorkspace(this.__currentWorkspaceId); const workspaceText = workspace ? workspace.getName() : "My Workspace"; From 60037a2906202f0c5683c2d99e981f436c6e18e5 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 11:08:28 +0100 Subject: [PATCH 37/71] dragIndicator --- .../class/osparc/dashboard/StudyBrowser.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) 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 bd962e0d636..76cf5024f6b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -100,6 +100,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __foldersList: null, __loadingFolders: null, __loadingWorkspaces: null, + __dragIndicator: null, // overridden initResources: function() { @@ -646,6 +647,19 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // /FOLDERS __configureStudyCards: function(cards) { + // Create drag indicator + this.__dragIndicator = new qx.ui.basic.Atom().set({ + opacity: 0.9, + padding: 10, + zIndex: 1000, + font: "text-14", + backgroundColor: "strong-main", + decorator: "rounded", + visibility: "excluded", + }); + const root = qx.core.Init.getApplication().getRoot(); + root.add(this.__dragIndicator); + cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); card.addListener("tap", e => this.__studyCardClicked(card, e.getNativeEvent().shiftKey), this); @@ -656,13 +670,41 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __attachDragHandlers: function(card) { + const onMouseMoveDragging = e => { + const dragWidget = this.__dragIndicator.getContentElement().getDomElement(); + dragWidget.style.left = `${e.pageX + 10}px`; // Offset for better visibility + dragWidget.style.top = `${e.pageY + 10}px`; + }; + card.setDraggable(true); + card.addListener("dragstart", e => { e.addAction("move"); e.addType("osparc-moveStudy"); e.addData("osparc-moveStudy", { "studyDataOrigin": card.getResourceData(), }); + + // make it semi transparent while being dragged + card.setOpacity(0.2); + // init drag indicator + this.__dragIndicator.set({ + label: card.getTitle(), + visibility: "visible", + }); + // listen to mousemove while dragging + document.addEventListener("mousemove", onMouseMoveDragging, false); + }); + + card.addListener("dragend", () => { + // bring back opacity after drag + card.setOpacity(1); + // hide drag indicator + this.__dragIndicator.set({ + visibility: "excluded", + }); + // remove listener + document.removeEventListener("mousemove", onMouseMoveDragging, false); }); }, From 1f8f1b938a4a9412f7b15342bd3df4edcd87c985 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 11:39:40 +0100 Subject: [PATCH 38/71] DragWidget --- .../class/osparc/dashboard/DragWidget.js | 55 +++++++++++++++++++ .../class/osparc/dashboard/StudyBrowser.js | 28 +--------- 2 files changed, 58 insertions(+), 25 deletions(-) create mode 100644 services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js new file mode 100644 index 00000000000..57cedbc5ff1 --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -0,0 +1,55 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +qx.Class.define("osparc.dashboard.DragWidget", { + extend: qx.ui.basic.Atom, + + construct: function() { + this.base(arguments); + + this.set({ + opacity: 0.9, + padding: 10, + zIndex: 1000, + font: "text-14", + backgroundColor: "strong-main", + decorator: "rounded", + visibility: "excluded", + }); + + const root = qx.core.Init.getApplication().getRoot(); + root.add(this); + }, + + members: { + __onMouseMoveDragging: function(e) { + const domEl = this.getContentElement().getDomElement(); + domEl.style.left = `${e.pageX + 15}px`; // Offset for better visibility + domEl.style.top = `${e.pageY + 15}px`; + }, + + start: function() { + this.show(); + document.addEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); + }, + + end: function() { + this.exclude(); + document.removeEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); + }, + } +}); 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 76cf5024f6b..44d784222e2 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -648,17 +648,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __configureStudyCards: function(cards) { // Create drag indicator - this.__dragIndicator = new qx.ui.basic.Atom().set({ - opacity: 0.9, - padding: 10, - zIndex: 1000, - font: "text-14", - backgroundColor: "strong-main", - decorator: "rounded", - visibility: "excluded", - }); - const root = qx.core.Init.getApplication().getRoot(); - root.add(this.__dragIndicator); + this.__dragIndicator = new osparc.dashboard.DragWidget(); cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); @@ -670,12 +660,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __attachDragHandlers: function(card) { - const onMouseMoveDragging = e => { - const dragWidget = this.__dragIndicator.getContentElement().getDomElement(); - dragWidget.style.left = `${e.pageX + 10}px`; // Offset for better visibility - dragWidget.style.top = `${e.pageY + 10}px`; - }; - card.setDraggable(true); card.addListener("dragstart", e => { @@ -690,21 +674,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // init drag indicator this.__dragIndicator.set({ label: card.getTitle(), - visibility: "visible", }); - // listen to mousemove while dragging - document.addEventListener("mousemove", onMouseMoveDragging, false); + this.__dragIndicator.start(); }); card.addListener("dragend", () => { // bring back opacity after drag card.setOpacity(1); // hide drag indicator - this.__dragIndicator.set({ - visibility: "excluded", - }); - // remove listener - document.removeEventListener("mousemove", onMouseMoveDragging, false); + this.__dragIndicator.end(); }); }, From 2b775c8c2e2fec406aad5aa2c9f1c131810216c7 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 11:58:27 +0100 Subject: [PATCH 39/71] folders also use dragWidget --- .../class/osparc/dashboard/DragWidget.js | 8 ++++--- .../osparc/dashboard/FolderButtonItem.js | 21 +++++++++++++++++++ .../class/osparc/dashboard/StudyBrowser.js | 17 ++++++++------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index 57cedbc5ff1..fe7a3f7b6f8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -37,9 +37,11 @@ qx.Class.define("osparc.dashboard.DragWidget", { members: { __onMouseMoveDragging: function(e) { - const domEl = this.getContentElement().getDomElement(); - domEl.style.left = `${e.pageX + 15}px`; // Offset for better visibility - domEl.style.top = `${e.pageY + 15}px`; + if (this.getContentElement()) { + const domEl = this.getContentElement().getDomElement(); + domEl.style.left = `${e.pageX + 15}px`; + domEl.style.top = `${e.pageY + 15}px`; + } }, start: function() { 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 9c9de365572..b6b17b1aa89 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -161,12 +161,33 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { __attachDragHandlers: function() { this.setDraggable(true); + this.addListener("dragstart", e => { e.addAction("move"); e.addType("osparc-moveFolder"); e.addData("osparc-moveFolder", { "folderOrigin": this.getFolder(), }); + + this.__dragWidget = new osparc.dashboard.DragWidget(); + // make it semi transparent while being dragged + this.setOpacity(0.2); + // init drag indicator + this.__dragWidget.set({ + label: this.getTitle(), + icon: "@FontAwesome5Solid/folder/16", + }); + this.__dragWidget.start(); + }); + + this.addListener("dragend", () => { + // bring back opacity after drag + this.setOpacity(1); + // hide drag indicator + this.__dragWidget.end(); + // dispose drag indicator + this.__dragWidget.dispose(); + this.__dragWidget = null; }); }, 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 44d784222e2..14c188d5ac9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -100,7 +100,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __foldersList: null, __loadingFolders: null, __loadingWorkspaces: null, - __dragIndicator: null, + __dragWidget: null, // overridden initResources: function() { @@ -647,9 +647,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // /FOLDERS __configureStudyCards: function(cards) { - // Create drag indicator - this.__dragIndicator = new osparc.dashboard.DragWidget(); - cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); card.addListener("tap", e => this.__studyCardClicked(card, e.getNativeEvent().shiftKey), this); @@ -669,20 +666,26 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { "studyDataOrigin": card.getResourceData(), }); + // Create drag indicator + this.__dragWidget = new osparc.dashboard.DragWidget(); // make it semi transparent while being dragged card.setOpacity(0.2); // init drag indicator - this.__dragIndicator.set({ + this.__dragWidget.set({ label: card.getTitle(), + icon: "@FontAwesome5Solid/file/16", }); - this.__dragIndicator.start(); + this.__dragWidget.start(); }); card.addListener("dragend", () => { // bring back opacity after drag card.setOpacity(1); // hide drag indicator - this.__dragIndicator.end(); + this.__dragWidget.end(); + // dispose drag indicator + this.__dragWidget.dispose(); + this.__dragWidget = null; }); }, From 63fdfdb04388aef86501839c6125b4b6bcf63cf1 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 12:20:09 +0100 Subject: [PATCH 40/71] highlight folder icon --- .../source/class/osparc/dashboard/FolderButtonItem.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 b6b17b1aa89..ce002c022d0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -233,12 +233,19 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { } } } - if (!compatible) { + if (compatible) { + this.getChildControl("icon").setTextColor("strong-main"); + } else { // do not allow + this.getChildControl("icon").setTextColor("danger-red"); e.preventDefault(); } }); + this.addListener("dragleave", () => { + this.getChildControl("icon").resetTextColor(); + }); + this.addListener("drop", e => { if (e.supportsType("osparc-moveStudy")) { const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; From da61500615558fcf320f29d9a2f23f01f10c2b6b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 12:40:40 +0100 Subject: [PATCH 41/71] no cursor --- .../source/class/osparc/dashboard/DragWidget.js | 12 ++++++++++-- .../client/source/class/osparc/theme/Appearance.js | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index fe7a3f7b6f8..b6f0c32ac00 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -39,19 +39,27 @@ qx.Class.define("osparc.dashboard.DragWidget", { __onMouseMoveDragging: function(e) { if (this.getContentElement()) { const domEl = this.getContentElement().getDomElement(); - domEl.style.left = `${e.pageX + 15}px`; - domEl.style.top = `${e.pageY + 15}px`; + domEl.style.left = `${e.pageX + 12}px`; + domEl.style.top = `${e.pageY + 12}px`; } }, start: function() { this.show(); document.addEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); + + // this widget will give the drop validity feedback + const cursor = qx.ui.core.DragDropCursor.getInstance(); + cursor.setAppearance("dragdrop-no-cursor"); }, end: function() { this.exclude(); document.removeEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); + + // reset to default + const cursor = qx.ui.core.DragDropCursor.getInstance(); + cursor.setAppearance("dragdrop-cursor"); }, } }); diff --git a/services/static-webserver/client/source/class/osparc/theme/Appearance.js b/services/static-webserver/client/source/class/osparc/theme/Appearance.js index 16facaa2949..8ae0db75329 100644 --- a/services/static-webserver/client/source/class/osparc/theme/Appearance.js +++ b/services/static-webserver/client/source/class/osparc/theme/Appearance.js @@ -19,6 +19,14 @@ qx.Theme.define("osparc.theme.Appearance", { extend: osparc.theme.common.Appearance, appearances: { + "dragdrop-no-cursor": { + style: states => { + return { + source: "", + } + } + }, + "material-button-invalid": {}, "pb-list": { include: "list", From c9926b78e9ac171227d1500f62adea0e88bdc1da Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 12:57:03 +0100 Subject: [PATCH 42/71] dragdrop-own-cursor --- .../source/class/osparc/dashboard/DragWidget.js | 6 ++---- .../client/source/class/osparc/theme/Appearance.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index b6f0c32ac00..e5ca281309c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -40,7 +40,7 @@ qx.Class.define("osparc.dashboard.DragWidget", { if (this.getContentElement()) { const domEl = this.getContentElement().getDomElement(); domEl.style.left = `${e.pageX + 12}px`; - domEl.style.top = `${e.pageY + 12}px`; + domEl.style.top = `${e.pageY + 16}px`; } }, @@ -48,16 +48,14 @@ qx.Class.define("osparc.dashboard.DragWidget", { this.show(); document.addEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); - // this widget will give the drop validity feedback const cursor = qx.ui.core.DragDropCursor.getInstance(); - cursor.setAppearance("dragdrop-no-cursor"); + cursor.setAppearance("dragdrop-own-cursor"); }, end: function() { this.exclude(); document.removeEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); - // reset to default const cursor = qx.ui.core.DragDropCursor.getInstance(); cursor.setAppearance("dragdrop-cursor"); }, diff --git a/services/static-webserver/client/source/class/osparc/theme/Appearance.js b/services/static-webserver/client/source/class/osparc/theme/Appearance.js index 8ae0db75329..3e542838d35 100644 --- a/services/static-webserver/client/source/class/osparc/theme/Appearance.js +++ b/services/static-webserver/client/source/class/osparc/theme/Appearance.js @@ -19,10 +19,18 @@ qx.Theme.define("osparc.theme.Appearance", { extend: osparc.theme.common.Appearance, appearances: { - "dragdrop-no-cursor": { + "dragdrop-own-cursor": { style: states => { + let icon = ""; + if (states.move) { + icon = "@FontAwesome5Solid/check/14"; + } else { + icon = "@FontAwesome5Solid/times/14"; + } return { - source: "", + source: icon, + position: "right-top", + offset: [0, 0, 0, 12], } } }, From 56b097b763a62734b0dedd54571ca8abfbde44b3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 13:00:57 +0100 Subject: [PATCH 43/71] minor aesthetics --- .../client/source/class/osparc/dashboard/DragWidget.js | 5 +++-- .../client/source/class/osparc/theme/Appearance.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index e5ca281309c..0aa59fc2312 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -38,9 +38,10 @@ qx.Class.define("osparc.dashboard.DragWidget", { members: { __onMouseMoveDragging: function(e) { if (this.getContentElement()) { + // place it next to the "dragdrop-own-cursor" indicator const domEl = this.getContentElement().getDomElement(); - domEl.style.left = `${e.pageX + 12}px`; - domEl.style.top = `${e.pageY + 16}px`; + domEl.style.left = `${e.pageX + 30}px`; + domEl.style.top = `${e.pageY + 0}px`; } }, diff --git a/services/static-webserver/client/source/class/osparc/theme/Appearance.js b/services/static-webserver/client/source/class/osparc/theme/Appearance.js index 3e542838d35..e27549ade26 100644 --- a/services/static-webserver/client/source/class/osparc/theme/Appearance.js +++ b/services/static-webserver/client/source/class/osparc/theme/Appearance.js @@ -30,7 +30,7 @@ qx.Theme.define("osparc.theme.Appearance", { return { source: icon, position: "right-top", - offset: [0, 0, 0, 12], + offset: [12, 0, 0, 12], } } }, From eafb08e3d295306c4911eed10e49db710d9f0f95 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 13:11:04 +0100 Subject: [PATCH 44/71] dragend resetTextColor --- .../client/source/class/osparc/dashboard/FolderButtonItem.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 ce002c022d0..df5dff8e20d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -236,8 +236,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { if (compatible) { this.getChildControl("icon").setTextColor("strong-main"); } else { - // do not allow this.getChildControl("icon").setTextColor("danger-red"); + // do not allow e.preventDefault(); } }); @@ -245,6 +245,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.addListener("dragleave", () => { this.getChildControl("icon").resetTextColor(); }); + this.addListener("dragend", () => { + this.getChildControl("icon").resetTextColor(); + }); this.addListener("drop", e => { if (e.supportsType("osparc-moveStudy")) { From a830adda76983441c3d0476ade79c787dd406d93 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 13:30:46 +0100 Subject: [PATCH 45/71] minor --- .../client/source/class/osparc/dashboard/FolderButtonItem.js | 3 +-- .../client/source/class/osparc/dashboard/StudyBrowser.js | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) 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 df5dff8e20d..db2d1f4b5ff 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -169,11 +169,10 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { "folderOrigin": this.getFolder(), }); - this.__dragWidget = new osparc.dashboard.DragWidget(); // make it semi transparent while being dragged this.setOpacity(0.2); // init drag indicator - this.__dragWidget.set({ + this.__dragWidget = new osparc.dashboard.DragWidget(); label: this.getTitle(), icon: "@FontAwesome5Solid/folder/16", }); 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 14c188d5ac9..991abbad9da 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -666,12 +666,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { "studyDataOrigin": card.getResourceData(), }); - // Create drag indicator - this.__dragWidget = new osparc.dashboard.DragWidget(); // make it semi transparent while being dragged card.setOpacity(0.2); // init drag indicator - this.__dragWidget.set({ + this.__dragWidget = new osparc.dashboard.DragWidget(); label: card.getTitle(), icon: "@FontAwesome5Solid/file/16", }); From a8471640ff73dce6d8ea429dddf05f42568d826e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 13:56:16 +0100 Subject: [PATCH 46/71] setDropAllowed --- .../class/osparc/dashboard/DragWidget.js | 45 +++++++++++++++++-- .../osparc/dashboard/FolderButtonItem.js | 17 ++++--- .../class/osparc/dashboard/StudyBrowser.js | 11 +++-- .../source/class/osparc/theme/Appearance.js | 8 ++++ 4 files changed, 66 insertions(+), 15 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index 0aa59fc2312..58b56125da3 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -16,16 +16,20 @@ ************************************************************************ */ qx.Class.define("osparc.dashboard.DragWidget", { - extend: qx.ui.basic.Atom, + extend: qx.ui.core.Widget, + type: "singleton", construct: function() { this.base(arguments); + this._setLayout(new qx.ui.layout.HBox(10).set({ + alignY: "middle", + })); + this.set({ opacity: 0.9, padding: 10, zIndex: 1000, - font: "text-14", backgroundColor: "strong-main", decorator: "rounded", visibility: "excluded", @@ -33,9 +37,44 @@ qx.Class.define("osparc.dashboard.DragWidget", { const root = qx.core.Init.getApplication().getRoot(); root.add(this); + + this.initDropAllowed(); + }, + + properties: { + dropAllowed: { + check: "Boolean", + nullable: false, + init: null, + apply: "__dropAllowed", + }, }, members: { + _createChildControlImpl: function(id) { + let control; + switch (id) { + case "allowed-icon": + control = new qx.ui.basic.Image(); + this._add(control); + break; + case "dragged-resource": + control = new qx.ui.basic.Atom().set({ + font: "text-14", + }); + this._add(control); + break; + } + return control || this.base(arguments, id); + }, + + __dropAllowed: function(allowed) { + this.getChildControl("allowed-icon").set({ + source: allowed ? "@FontAwesome5Solid/check/14" : "@FontAwesome5Solid/times/14", + textColor: allowed ? "text" : "danger-red", + }); + }, + __onMouseMoveDragging: function(e) { if (this.getContentElement()) { // place it next to the "dragdrop-own-cursor" indicator @@ -50,7 +89,7 @@ qx.Class.define("osparc.dashboard.DragWidget", { document.addEventListener("mousemove", this.__onMouseMoveDragging.bind(this), false); const cursor = qx.ui.core.DragDropCursor.getInstance(); - cursor.setAppearance("dragdrop-own-cursor"); + cursor.setAppearance("dragdrop-no-cursor"); }, end: function() { 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 db2d1f4b5ff..a3a8877fe7b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -172,21 +172,20 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { // make it semi transparent while being dragged this.setOpacity(0.2); // init drag indicator - this.__dragWidget = new osparc.dashboard.DragWidget(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.getChildControl("dragged-resource").set({ label: this.getTitle(), icon: "@FontAwesome5Solid/folder/16", }); - this.__dragWidget.start(); + dragWidget.start(); }); this.addListener("dragend", () => { // bring back opacity after drag this.setOpacity(1); // hide drag indicator - this.__dragWidget.end(); - // dispose drag indicator - this.__dragWidget.dispose(); - this.__dragWidget = null; + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.end(); }); }, @@ -239,13 +238,19 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { // do not allow e.preventDefault(); } + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(compatible); }); this.addListener("dragleave", () => { this.getChildControl("icon").resetTextColor(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(false); }); this.addListener("dragend", () => { this.getChildControl("icon").resetTextColor(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(false); }); this.addListener("drop", e => { 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 991abbad9da..07eca44822b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -669,21 +669,20 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // make it semi transparent while being dragged card.setOpacity(0.2); // init drag indicator - this.__dragWidget = new osparc.dashboard.DragWidget(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.getChildControl("dragged-resource").set({ label: card.getTitle(), icon: "@FontAwesome5Solid/file/16", }); - this.__dragWidget.start(); + dragWidget.start(); }); card.addListener("dragend", () => { // bring back opacity after drag card.setOpacity(1); // hide drag indicator - this.__dragWidget.end(); - // dispose drag indicator - this.__dragWidget.dispose(); - this.__dragWidget = null; + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.end(); }); }, diff --git a/services/static-webserver/client/source/class/osparc/theme/Appearance.js b/services/static-webserver/client/source/class/osparc/theme/Appearance.js index e27549ade26..7f6f8ccfe51 100644 --- a/services/static-webserver/client/source/class/osparc/theme/Appearance.js +++ b/services/static-webserver/client/source/class/osparc/theme/Appearance.js @@ -19,6 +19,14 @@ qx.Theme.define("osparc.theme.Appearance", { extend: osparc.theme.common.Appearance, appearances: { + "dragdrop-no-cursor": { + style: () => { + return { + source: "", + } + } + }, + "dragdrop-own-cursor": { style: states => { let icon = ""; From 1b7d5b8a29891e8219e20d2648b194da41c130b9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 14:09:39 +0100 Subject: [PATCH 47/71] minor --- .../client/source/class/osparc/dashboard/DragWidget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index 58b56125da3..64a1c188f1f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -79,8 +79,8 @@ qx.Class.define("osparc.dashboard.DragWidget", { if (this.getContentElement()) { // place it next to the "dragdrop-own-cursor" indicator const domEl = this.getContentElement().getDomElement(); - domEl.style.left = `${e.pageX + 30}px`; - domEl.style.top = `${e.pageY + 0}px`; + domEl.style.left = `${e.pageX + 15}px`; + domEl.style.top = `${e.pageY + 5}px`; } }, From 3d2361e31595c5a9700bc54ac2f17b6e7e3720a6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 14:21:25 +0100 Subject: [PATCH 48/71] renaming --- .../source/class/osparc/dashboard/FolderButtonItem.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 a3a8877fe7b..489fd0bf6ad 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -217,9 +217,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { // - None // - Shared workspace // - write access on workspace - const folder = e.getData("osparc-moveFolder")["folderOrigin"]; - compatible = this.getFolder() !== folder; - const workspaceId = folder.getWorkspaceId(); + const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; + compatible = this.getFolder() !== folderOrigin; + const workspaceId = folderOrigin.getWorkspaceId(); if (compatible) { if (workspaceId) { const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); @@ -262,9 +262,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { }; this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folder = e.getData("osparc-moveFolder")["folderOrigin"]; + const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; const folderToFolderData = { - folderId: folder.getFolderId(), + folderId: folderOrigin.getFolderId(), destFolderId: this.getFolderId(), }; this.fireDataEvent("folderToFolderRequested", folderToFolderData); From 0f3635529ffad178688a336a21f265f88f069072 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 14:35:33 +0100 Subject: [PATCH 49/71] dragStartFolder and dragEnd --- .../class/osparc/dashboard/DragWidget.js | 24 ++++ .../dashboard/WorkspacesAndFoldersTreeItem.js | 133 +++++++++++++++++- 2 files changed, 156 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index 64a1c188f1f..dd6b7ede54d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -50,6 +50,30 @@ qx.Class.define("osparc.dashboard.DragWidget", { }, }, + statics: { + dragStartFolder: function(event, folder) { + event.addAction("move"); + event.addType("osparc-moveFolder"); + event.addData("osparc-moveFolder", { + "folderOrigin": folder, + }); + + // init drag indicator + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.getChildControl("dragged-resource").set({ + label: folder.getName(), + icon: "@FontAwesome5Solid/folder/16", + }); + dragWidget.start(); + }, + + dragEnd: function() { + // hide drag indicator + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.end(); + } + }, + members: { _createChildControlImpl: function(id) { let control; 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 75f120a86c5..650bd68f6de 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -30,6 +30,9 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.setNotHoveredStyle(); this.__attachEventHandlers(); + + this.__attachDragHandlers(); + this.__attachDropHandlers(); }, members: { @@ -48,6 +51,134 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { setNotHoveredStyle: function() { osparc.utils.Utils.hideBorder(this); - } + }, + + __getFolder: function() { + const folderId = this.getModel().getFolderId(); + if (folderId === null) { + return null; + } + return osparc.store.Folders.getInstance().getFolder(folderId); + }, + + __attachDragHandlers: function() { + this.setDraggable(true); + + this.addListener("dragstart", e => { + const folder = this.__getFolder(); + // only folders can be dragged + if (folder == null) { + e.preventDefault(); + return; + } + + // make it semi transparent while being dragged + this.setOpacity(0.2); + + osparc.dashboard.DragWidget.dragStartFolder(e, folder); + }); + + this.addListener("dragend", () => { + // bring back opacity after drag + this.setOpacity(1); + + osparc.dashboard.DragWidget.dragEnd(); + }); + }, + + __attachDropHandlers: function() { + this.setDroppable(true); + + this.addListener("dragover", e => { + let compatible = false; + if (e.supportsType("osparc-moveStudy")) { + const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; + // Compatibility checks: + // - My workspace + // - None + // - Shared workspace + // - write access on workspace + const workspaceId = studyData["workspaceId"]; + if (workspaceId) { + const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); + if (workspace) { + compatible = workspace.getMyAccessRights()["write"]; + } + } else { + compatible = true; + } + } else if (e.supportsType("osparc-moveFolder")) { + const folder = this.__getFolder(); + if (folder == null) { + e.preventDefault(); + return; + } + + // Compatibility checks: + // - It's not the same folder + // - My workspace + // - None + // - Shared workspace + // - write access on workspace + const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; + compatible = folder !== folderOrigin; + const workspaceId = folderOrigin.getWorkspaceId(); + if (compatible) { + if (workspaceId) { + const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); + if (workspace) { + compatible = workspace.getMyAccessRights()["write"]; + } + } else { + compatible = true; + } + } + } + if (compatible) { + this.getChildControl("icon").setTextColor("strong-main"); + } else { + this.getChildControl("icon").setTextColor("danger-red"); + // do not allow + e.preventDefault(); + } + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(compatible); + }); + + this.addListener("dragleave", () => { + this.getChildControl("icon").resetTextColor(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(false); + }); + this.addListener("dragend", () => { + this.getChildControl("icon").resetTextColor(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(false); + }); + + this.addListener("drop", e => { + if (e.supportsType("osparc-moveStudy")) { + const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; + const studyToFolderData = { + studyData, + destFolderId: this.getFolderId(), + }; + this.fireDataEvent("studyToFolderRequested", studyToFolderData); + } else if (e.supportsType("osparc-moveFolder")) { + const folder = this.__getFolder(); + if (folder == null) { + e.preventDefault(); + return; + } + + const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; + const folderToFolderData = { + folderId: folderOrigin.getFolderId(), + destFolderId: folder.getFolderId(), + }; + this.fireDataEvent("folderToFolderRequested", folderToFolderData); + } + }); + }, }, }); From b5b579ee1fbee000bfadc19ff10d701809242c74 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 14:39:46 +0100 Subject: [PATCH 50/71] DragDropHelpers --- .../class/osparc/dashboard/DragDropHelpers.js | 46 +++++++++++++++++++ .../class/osparc/dashboard/DragWidget.js | 24 ---------- .../dashboard/WorkspacesAndFoldersTreeItem.js | 4 +- 3 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js new file mode 100644 index 00000000000..e4e4102c43c --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -0,0 +1,46 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +qx.Class.define("osparc.dashboard.DragDropHelpers", { + type: "static", + + statics: { + moveFolder: { + dragStart: function(event, folderOrigin) { + event.addAction("move"); + event.addType("osparc-moveFolder"); + event.addData("osparc-moveFolder", { + "folderOrigin": folderOrigin, + }); + + // init drag indicator + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.getChildControl("dragged-resource").set({ + label: folderOrigin.getName(), + icon: "@FontAwesome5Solid/folder/16", + }); + dragWidget.start(); + }, + }, + + dragEnd: function() { + // hide drag indicator + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.end(); + } + } +}); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js index dd6b7ede54d..64a1c188f1f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragWidget.js @@ -50,30 +50,6 @@ qx.Class.define("osparc.dashboard.DragWidget", { }, }, - statics: { - dragStartFolder: function(event, folder) { - event.addAction("move"); - event.addType("osparc-moveFolder"); - event.addData("osparc-moveFolder", { - "folderOrigin": folder, - }); - - // init drag indicator - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.getChildControl("dragged-resource").set({ - label: folder.getName(), - icon: "@FontAwesome5Solid/folder/16", - }); - dragWidget.start(); - }, - - dragEnd: function() { - // hide drag indicator - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.end(); - } - }, - members: { _createChildControlImpl: function(id) { let control; 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 650bd68f6de..34045662594 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -75,14 +75,14 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { // make it semi transparent while being dragged this.setOpacity(0.2); - osparc.dashboard.DragWidget.dragStartFolder(e, folder); + osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, folder); }); this.addListener("dragend", () => { // bring back opacity after drag this.setOpacity(1); - osparc.dashboard.DragWidget.dragEnd(); + osparc.dashboard.DragDropHelpers.dragEnd(); }); }, From 4a280289427a2cd156c9d1a9de7ab6711c4b3831 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 14:52:17 +0100 Subject: [PATCH 51/71] refactor --- .../class/osparc/dashboard/DragDropHelpers.js | 43 ++++++++++++++ .../dashboard/WorkspacesAndFoldersTreeItem.js | 56 ++++++------------- 2 files changed, 59 insertions(+), 40 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 e4e4102c43c..02f07d9ec0f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -35,6 +35,49 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { }); dragWidget.start(); }, + + dragOver: function(event, folderDest, folderItem) { + let compatible = false; + // Compatibility checks: + // - It's not the same folder + // - My workspace + // - None + // - Shared workspace + // - write access on workspace + const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"]; + compatible = folderDest !== folderOrigin; + const workspaceId = folderOrigin.getWorkspaceId(); + if (compatible) { + if (workspaceId) { + const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); + if (workspace) { + compatible = workspace.getMyAccessRights()["write"]; + } + } else { + compatible = true; + } + } + + if (compatible) { + folderItem.getChildControl("icon").setTextColor("strong-main"); + } else { + folderItem.getChildControl("icon").setTextColor("danger-red"); + // do not allow + event.preventDefault(); + } + + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(compatible); + }, + + drop: function(event, folderDest) { + const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"]; + const folderToFolderData = { + folderId: folderOrigin.getFolderId(), + destFolderId: folderDest.getFolderId(), + }; + return folderToFolderData; + }, }, dragEnd: function() { 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 34045662594..922ef2c5d42 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -90,8 +90,8 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.setDroppable(true); this.addListener("dragover", e => { - let compatible = false; if (e.supportsType("osparc-moveStudy")) { + let compatible = false; const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; // Compatibility checks: // - My workspace @@ -107,42 +107,23 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { } else { compatible = true; } + if (compatible) { + this.getChildControl("icon").setTextColor("strong-main"); + } else { + this.getChildControl("icon").setTextColor("danger-red"); + // do not allow + e.preventDefault(); + } + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(compatible); } else if (e.supportsType("osparc-moveFolder")) { - const folder = this.__getFolder(); - if (folder == null) { + const folderDest = this.__getFolder(); + if (folderDest == null) { e.preventDefault(); return; } - - // Compatibility checks: - // - It's not the same folder - // - My workspace - // - None - // - Shared workspace - // - write access on workspace - const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; - compatible = folder !== folderOrigin; - const workspaceId = folderOrigin.getWorkspaceId(); - if (compatible) { - if (workspaceId) { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - if (workspace) { - compatible = workspace.getMyAccessRights()["write"]; - } - } else { - compatible = true; - } - } + osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, folderDest, this); } - if (compatible) { - this.getChildControl("icon").setTextColor("strong-main"); - } else { - this.getChildControl("icon").setTextColor("danger-red"); - // do not allow - e.preventDefault(); - } - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(compatible); }); this.addListener("dragleave", () => { @@ -165,17 +146,12 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { }; this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folder = this.__getFolder(); - if (folder == null) { + const folderDest = this.__getFolder(); + if (folderDest == null) { e.preventDefault(); return; } - - const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; - const folderToFolderData = { - folderId: folderOrigin.getFolderId(), - destFolderId: folder.getFolderId(), - }; + const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } }); From 839410d2aa4bf6a21f6163be898da69d06e08146 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 15:05:25 +0100 Subject: [PATCH 52/71] refactoring --- .../class/osparc/dashboard/DragDropHelpers.js | 16 +++- .../osparc/dashboard/FolderButtonItem.js | 78 +++++-------------- .../dashboard/WorkspacesAndFoldersTreeItem.js | 23 ++---- 3 files changed, 39 insertions(+), 78 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 02f07d9ec0f..1c113153084 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -20,7 +20,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { statics: { moveFolder: { - dragStart: function(event, folderOrigin) { + dragStart: function(event, folderOrigin, folderItem) { event.addAction("move"); event.addType("osparc-moveFolder"); event.addData("osparc-moveFolder", { @@ -34,6 +34,9 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { icon: "@FontAwesome5Solid/folder/16", }); dragWidget.start(); + + // make it semi transparent while being dragged + folderItem.setOpacity(0.2); }, dragOver: function(event, folderDest, folderItem) { @@ -80,7 +83,16 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { }, }, - dragEnd: function() { + dragLeave: function(item) { + item.getChildControl("icon").resetTextColor(); + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(false); + }, + + dragEnd: function(draggedItem) { + // bring back opacity after drag + draggedItem.setOpacity(1); + // hide drag indicator const dragWidget = osparc.dashboard.DragWidget.getInstance(); dragWidget.end(); 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 489fd0bf6ad..e946ef0fdb3 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -163,29 +163,12 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.setDraggable(true); this.addListener("dragstart", e => { - e.addAction("move"); - e.addType("osparc-moveFolder"); - e.addData("osparc-moveFolder", { - "folderOrigin": this.getFolder(), - }); - - // make it semi transparent while being dragged - this.setOpacity(0.2); - // init drag indicator - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.getChildControl("dragged-resource").set({ - label: this.getTitle(), - icon: "@FontAwesome5Solid/folder/16", - }); - dragWidget.start(); + const folderOrigin = this.getFolder(); + osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, folderOrigin, this); }); this.addListener("dragend", () => { - // bring back opacity after drag - this.setOpacity(1); - // hide drag indicator - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.end(); + osparc.dashboard.DragDropHelpers.dragEnd(this); }); }, @@ -193,8 +176,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.setDroppable(true); this.addListener("dragover", e => { - let compatible = false; if (e.supportsType("osparc-moveStudy")) { + let compatible = false; const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; // Compatibility checks: // - My workspace @@ -210,47 +193,27 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { } else { compatible = true; } - } else if (e.supportsType("osparc-moveFolder")) { - // Compatibility checks: - // - It's not the same folder - // - My workspace - // - None - // - Shared workspace - // - write access on workspace - const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; - compatible = this.getFolder() !== folderOrigin; - const workspaceId = folderOrigin.getWorkspaceId(); if (compatible) { - if (workspaceId) { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - if (workspace) { - compatible = workspace.getMyAccessRights()["write"]; - } - } else { - compatible = true; - } + this.getChildControl("icon").setTextColor("strong-main"); + } else { + this.getChildControl("icon").setTextColor("danger-red"); + // do not allow + e.preventDefault(); } + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(compatible); + } else if (e.supportsType("osparc-moveFolder")) { + const folderDest = this.getFolder(); + osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, folderDest, this); } - if (compatible) { - this.getChildControl("icon").setTextColor("strong-main"); - } else { - this.getChildControl("icon").setTextColor("danger-red"); - // do not allow - e.preventDefault(); - } - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(compatible); }); this.addListener("dragleave", () => { - this.getChildControl("icon").resetTextColor(); - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(false); + osparc.dashboard.DragDropHelpers.dragLeave(this); }); + this.addListener("dragend", () => { - this.getChildControl("icon").resetTextColor(); - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(false); + osparc.dashboard.DragDropHelpers.dragLeave(this); }); this.addListener("drop", e => { @@ -262,11 +225,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { }; this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderOrigin = e.getData("osparc-moveFolder")["folderOrigin"]; - const folderToFolderData = { - folderId: folderOrigin.getFolderId(), - destFolderId: this.getFolderId(), - }; + const folderDest = this.getFolder(); + const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } }); 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 922ef2c5d42..982027718fd 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -65,24 +65,17 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.setDraggable(true); this.addListener("dragstart", e => { - const folder = this.__getFolder(); + const folderOrigin = this.__getFolder(); // only folders can be dragged - if (folder == null) { + if (folderOrigin == null) { e.preventDefault(); return; } - - // make it semi transparent while being dragged - this.setOpacity(0.2); - - osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, folder); + osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, folderOrigin, this); }); this.addListener("dragend", () => { - // bring back opacity after drag - this.setOpacity(1); - - osparc.dashboard.DragDropHelpers.dragEnd(); + osparc.dashboard.DragDropHelpers.dragEnd(this); }); }, @@ -127,14 +120,10 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { }); this.addListener("dragleave", () => { - this.getChildControl("icon").resetTextColor(); - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(false); + osparc.dashboard.DragDropHelpers.dragLeave(this); }); this.addListener("dragend", () => { - this.getChildControl("icon").resetTextColor(); - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(false); + osparc.dashboard.DragDropHelpers.dragLeave(this); }); this.addListener("drop", e => { From be5def7e9e1cbc1c989a55b2efc17ba47514e40d Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 15:14:33 +0100 Subject: [PATCH 53/71] refactor --- .../class/osparc/dashboard/DragDropHelpers.js | 21 +++++++++++++++++ .../class/osparc/dashboard/StudyBrowser.js | 23 +++---------------- .../dashboard/WorkspacesAndFoldersTreeItem.js | 7 +++++- 3 files changed, 30 insertions(+), 21 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 1c113153084..aa2cfc860a9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -19,6 +19,27 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { type: "static", statics: { + moveStudy: { + dragStart: function(event, studyDataOrigin, studyItem) { + event.addAction("move"); + event.addType("osparc-moveStudy"); + event.addData("osparc-moveStudy", { + "studyDataOrigin": studyDataOrigin, + }); + + // init drag indicator + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.getChildControl("dragged-resource").set({ + label: studyDataOrigin["name"], + icon: "@FontAwesome5Solid/file/16", + }); + dragWidget.start(); + + // make it semi transparent while being dragged + studyItem.setOpacity(0.2); + }, + }, + moveFolder: { dragStart: function(event, folderOrigin, folderItem) { event.addAction("move"); 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 07eca44822b..4df827e7c81 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -660,29 +660,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { card.setDraggable(true); card.addListener("dragstart", e => { - e.addAction("move"); - e.addType("osparc-moveStudy"); - e.addData("osparc-moveStudy", { - "studyDataOrigin": card.getResourceData(), - }); - - // make it semi transparent while being dragged - card.setOpacity(0.2); - // init drag indicator - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.getChildControl("dragged-resource").set({ - label: card.getTitle(), - icon: "@FontAwesome5Solid/file/16", - }); - dragWidget.start(); + const studyDataOrigin = card.getResourceData(); + osparc.dashboard.DragDropHelpers.moveStudy.dragStart(e, studyDataOrigin, card); }); card.addListener("dragend", () => { - // bring back opacity after drag - card.setOpacity(1); - // hide drag indicator - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.end(); + osparc.dashboard.DragDropHelpers.dragEnd(card); }); }, 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 982027718fd..0da9f0d344f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -128,10 +128,15 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.addListener("drop", e => { if (e.supportsType("osparc-moveStudy")) { + const folderDest = this.__getFolder(); + if (folderDest == null) { + e.preventDefault(); + return; + } const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; const studyToFolderData = { studyData, - destFolderId: this.getFolderId(), + destFolderId: folderDest.getFolderId(), }; this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { From a7e87c05d8ed2a6bae649dbd8b93b00bc7db2e76 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 15:27:55 +0100 Subject: [PATCH 54/71] dragOver and drop --- .../class/osparc/dashboard/DragDropHelpers.js | 37 +++++++++++++++++++ .../osparc/dashboard/FolderButtonItem.js | 36 ++---------------- 2 files changed, 41 insertions(+), 32 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 aa2cfc860a9..c6e2027a4c8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -38,6 +38,43 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { // make it semi transparent while being dragged studyItem.setOpacity(0.2); }, + + dragOver: function(event, folderDest, folderItem) { + let compatible = false; + const studyDataOrigin = event.getData("osparc-moveStudy")["studyDataOrigin"]; + // Compatibility checks: + // - My workspace + // - None + // - Shared workspace + // - write access on workspace + const workspaceId = studyDataOrigin["workspaceId"]; + if (workspaceId) { + const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); + if (workspace) { + compatible = workspace.getMyAccessRights()["write"]; + } + } else { + compatible = true; + } + if (compatible) { + folderItem.getChildControl("icon").setTextColor("strong-main"); + } else { + folderItem.getChildControl("icon").setTextColor("danger-red"); + // do not allow + event.preventDefault(); + } + const dragWidget = osparc.dashboard.DragWidget.getInstance(); + dragWidget.setDropAllowed(compatible); + }, + + drop: function(event, folderDest) { + const studyData = event.getData("osparc-moveStudy")["studyDataOrigin"]; + const studyToFolderData = { + studyData, + destFolderId: folderDest.getFolderId(), + }; + return studyToFolderData; + }, }, moveFolder: { 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 e946ef0fdb3..bef5bbc35ab 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -176,34 +176,10 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.setDroppable(true); this.addListener("dragover", e => { + const folderDest = this.getFolder(); if (e.supportsType("osparc-moveStudy")) { - let compatible = false; - const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; - // Compatibility checks: - // - My workspace - // - None - // - Shared workspace - // - write access on workspace - const workspaceId = studyData["workspaceId"]; - if (workspaceId) { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - if (workspace) { - compatible = workspace.getMyAccessRights()["write"]; - } - } else { - compatible = true; - } - if (compatible) { - this.getChildControl("icon").setTextColor("strong-main"); - } else { - this.getChildControl("icon").setTextColor("danger-red"); - // do not allow - e.preventDefault(); - } - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(compatible); + osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, folderDest, this); } else if (e.supportsType("osparc-moveFolder")) { - const folderDest = this.getFolder(); osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, folderDest, this); } }); @@ -217,15 +193,11 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { }); this.addListener("drop", e => { + const folderDest = this.getFolder(); if (e.supportsType("osparc-moveStudy")) { - const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; - const studyToFolderData = { - studyData, - destFolderId: this.getFolderId(), - }; + const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, folderDest); this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderDest = this.getFolder(); const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } From 4cd636e058dd4c1712cb4501b5d1cbcbf5f036fb Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 15:31:57 +0100 Subject: [PATCH 55/71] more refactoring --- .../dashboard/WorkspacesAndFoldersTreeItem.js | 48 ++++--------------- 1 file changed, 10 insertions(+), 38 deletions(-) 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 0da9f0d344f..4329d26afcb 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -84,31 +84,12 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.addListener("dragover", e => { if (e.supportsType("osparc-moveStudy")) { - let compatible = false; - const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; - // Compatibility checks: - // - My workspace - // - None - // - Shared workspace - // - write access on workspace - const workspaceId = studyData["workspaceId"]; - if (workspaceId) { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - if (workspace) { - compatible = workspace.getMyAccessRights()["write"]; - } - } else { - compatible = true; - } - if (compatible) { - this.getChildControl("icon").setTextColor("strong-main"); - } else { - this.getChildControl("icon").setTextColor("danger-red"); - // do not allow + const folderDest = this.__getFolder(); + if (folderDest == null) { e.preventDefault(); + return; } - const dragWidget = osparc.dashboard.DragWidget.getInstance(); - dragWidget.setDropAllowed(compatible); + osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, folderDest, this); } else if (e.supportsType("osparc-moveFolder")) { const folderDest = this.__getFolder(); if (folderDest == null) { @@ -127,24 +108,15 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { }); this.addListener("drop", e => { + const folderDest = this.__getFolder(); + if (folderDest == null) { + e.preventDefault(); + return; + } if (e.supportsType("osparc-moveStudy")) { - const folderDest = this.__getFolder(); - if (folderDest == null) { - e.preventDefault(); - return; - } - const studyData = e.getData("osparc-moveStudy")["studyDataOrigin"]; - const studyToFolderData = { - studyData, - destFolderId: folderDest.getFolderId(), - }; + const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, folderDest); this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderDest = this.__getFolder(); - if (folderDest == null) { - e.preventDefault(); - return; - } const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } From fbc0e42f0b27a273668c13f7792ed44d5cde095c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 15:42:50 +0100 Subject: [PATCH 56/71] wirte resourceToFolderRequested --- .../source/class/osparc/dashboard/StudyBrowser.js | 11 +++++++++++ .../osparc/dashboard/WorkspacesAndFoldersTree.js | 10 +++++++++- .../osparc/dashboard/WorkspacesAndFoldersTreeItem.js | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) 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 4df827e7c81..302ce40f915 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -1011,6 +1011,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this._addResourceFilter(); this.__connectContexts(); + this.__connectDropHandlers(); this.__addNewStudyButtons(); @@ -1158,6 +1159,16 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this._resourceFilter.contextChanged(context, workspaceId, folderId); }, + __connectDropHandlers: function() { + const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); + workspacesAndFoldersTree.addListener("studyToFolderRequested", e => { + this._studyToFolderRequested(e.getData()); + }); + workspacesAndFoldersTree.addListener("folderToFolderRequested", e => { + this._folderToFolderRequested(e.getData()); + }); + }, + __addSortByButton: function() { const sortByButton = new osparc.dashboard.SortedByMenuButton(); sortByButton.set({ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js index 01cea4d878c..604d5e2e7b0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js @@ -85,6 +85,8 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { events: { "openChanged": "qx.event.type.Event", "locationChanged": "qx.event.type.Data", + "studyToFolderRequested": "qx.event.type.Data", + "folderToFolderRequested": "qx.event.type.Data", }, properties: { @@ -133,7 +135,13 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { item.addListener("changeModel", e => { const model = e.getData(); osparc.utils.Utils.setIdToWidget(item, `workspacesAndFoldersTreeItem_${model.getWorkspaceId()}_${model.getFolderId()}`); - }) + }); + [ + "studyToFolderRequested", + "folderToFolderRequested", + ].forEach(ev => { + item.addListener(ev, e => this.fireDataEvent(ev, e.getData())); + }); } }); 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 4329d26afcb..49263a37b8d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -35,6 +35,11 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.__attachDropHandlers(); }, + events: { + "studyToFolderRequested": "qx.event.type.Data", + "folderToFolderRequested": "qx.event.type.Data", + }, + members: { __attachEventHandlers: function() { this.addListener("mouseover", () => { From 623a396faf912c4d8c2c47a3b39fe4d54967811c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:22:23 +0100 Subject: [PATCH 57/71] dragOver logic --- .../class/osparc/dashboard/DragDropHelpers.js | 37 +++++++++++++------ .../osparc/dashboard/FolderButtonItem.js | 4 +- .../dashboard/WorkspacesAndFoldersTreeItem.js | 10 ++--- 3 files changed, 30 insertions(+), 21 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 c6e2027a4c8..bb591cb720c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -39,22 +39,35 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { studyItem.setOpacity(0.2); }, - dragOver: function(event, folderDest, folderItem) { + dragOver: function(event, folderItem, workspaceDestId) { let compatible = false; const studyDataOrigin = event.getData("osparc-moveStudy")["studyDataOrigin"]; + const workspaceIdOrigin = studyDataOrigin["workspaceId"]; + const workspaceOrigin = osparc.store.Workspaces.getInstance().getWorkspace(workspaceIdOrigin); + const workspaceDest = osparc.store.Workspaces.getInstance().getWorkspace(workspaceDestId); // Compatibility checks: - // - My workspace + // - Drag over "Shared Workspaces" (0) + // - No + // - My Workspace -> My Workspace (1) // - None - // - Shared workspace - // - write access on workspace - const workspaceId = studyDataOrigin["workspaceId"]; - if (workspaceId) { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - if (workspace) { - compatible = workspace.getMyAccessRights()["write"]; - } - } else { + // - My Workspace -> Shared Workspace (2) + // - Delete on Study + // - Write on dest Workspace + // - Shared Workspace -> My Workspace (3) + // - Delete on origin Workspace + // - Shared Workspace -> Shared Workspace (4) + // - Delete on origin Workspace + // - Write on dest Workspace + if (workspaceDestId === -1) { // (0) + compatible = false; + } else if (studyDataOrigin["workspaceId"] === null && workspaceDest === null) { // (1) compatible = true; + } else if (studyDataOrigin["workspaceId"] === null && workspaceDest) { // (2) + compatible = osparc.data.model.Study.canIDelete(studyDataOrigin["accessRights"]) && workspaceDest.getMyAccessRights()["write"]; + } else if (workspaceOrigin && workspaceDest === null) { // (3) + compatible = workspaceOrigin.getMyAccessRights()["delete"]; + } else if (workspaceOrigin && workspaceDest) { // (4) + compatible = workspaceOrigin.getMyAccessRights()["delete"] && workspaceDest.getMyAccessRights()["write"]; } if (compatible) { folderItem.getChildControl("icon").setTextColor("strong-main"); @@ -97,7 +110,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { folderItem.setOpacity(0.2); }, - dragOver: function(event, folderDest, folderItem) { + dragOver: function(event, folderItem, folderDest) { let compatible = false; // Compatibility checks: // - It's not the same folder 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 bef5bbc35ab..938e5003d03 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, folderDest, this); + osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, folderDest); } else if (e.supportsType("osparc-moveFolder")) { - osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, folderDest, this); + osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest); } }); 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 49263a37b8d..40dcfaa4b0c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -88,20 +88,16 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { this.setDroppable(true); this.addListener("dragover", e => { + const workspaceDestId = this.getModel().getWorkspaceId(); if (e.supportsType("osparc-moveStudy")) { - const folderDest = this.__getFolder(); - if (folderDest == null) { - e.preventDefault(); - return; - } - osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, folderDest, this); + osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, workspaceDestId); } else if (e.supportsType("osparc-moveFolder")) { const folderDest = this.__getFolder(); if (folderDest == null) { e.preventDefault(); return; } - osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, folderDest, this); + osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest); } }); From 30313921a091772b6d2165ea255273c9bfad80e9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:24:53 +0100 Subject: [PATCH 58/71] checks correct --- .../client/source/class/osparc/dashboard/DragDropHelpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 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 bb591cb720c..9c942889d3e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -60,11 +60,11 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { // - Write on dest Workspace if (workspaceDestId === -1) { // (0) compatible = false; - } else if (studyDataOrigin["workspaceId"] === null && workspaceDest === null) { // (1) + } else if (studyDataOrigin["workspaceId"] === null && workspaceDestId === null) { // (1) compatible = true; } else if (studyDataOrigin["workspaceId"] === null && workspaceDest) { // (2) compatible = osparc.data.model.Study.canIDelete(studyDataOrigin["accessRights"]) && workspaceDest.getMyAccessRights()["write"]; - } else if (workspaceOrigin && workspaceDest === null) { // (3) + } else if (workspaceOrigin && workspaceDestId === null) { // (3) compatible = workspaceOrigin.getMyAccessRights()["delete"]; } else if (workspaceOrigin && workspaceDest) { // (4) compatible = workspaceOrigin.getMyAccessRights()["delete"] && workspaceDest.getMyAccessRights()["write"]; From 5f51f8770db5dfbfe8f5effe4f07f99731cfab4a Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:26:04 +0100 Subject: [PATCH 59/71] minor --- .../client/source/class/osparc/dashboard/FolderButtonItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 938e5003d03..dee4ee880f5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -178,7 +178,7 @@ 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); + osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, folderDest.getWorkspaceId()); } else if (e.supportsType("osparc-moveFolder")) { osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest); } From 06cef92b02c220a46eebab30ed1735f9101c628e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:26:59 +0100 Subject: [PATCH 60/71] minor --- .../client/source/class/osparc/dashboard/DragDropHelpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 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 9c942889d3e..ef8960610c6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -60,9 +60,9 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { // - Write on dest Workspace if (workspaceDestId === -1) { // (0) compatible = false; - } else if (studyDataOrigin["workspaceId"] === null && workspaceDestId === null) { // (1) + } else if (workspaceIdOrigin === null && workspaceDestId === null) { // (1) compatible = true; - } else if (studyDataOrigin["workspaceId"] === null && workspaceDest) { // (2) + } else if (workspaceIdOrigin === null && workspaceDest) { // (2) compatible = osparc.data.model.Study.canIDelete(studyDataOrigin["accessRights"]) && workspaceDest.getMyAccessRights()["write"]; } else if (workspaceOrigin && workspaceDestId === null) { // (3) compatible = workspaceOrigin.getMyAccessRights()["delete"]; From f0a305e86b159014b1263e7829be8647f351a438 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:27:41 +0100 Subject: [PATCH 61/71] minor --- .../client/source/class/osparc/dashboard/DragDropHelpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ef8960610c6..74ded3c5a90 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { // - Drag over "Shared Workspaces" (0) // - No // - My Workspace -> My Workspace (1) - // - None + // - Yes // - My Workspace -> Shared Workspace (2) // - Delete on Study // - Write on dest Workspace From 4652068d66173cfd594b23821f83908ca78bcb55 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:32:46 +0100 Subject: [PATCH 62/71] minor --- .../client/source/class/osparc/dashboard/DragDropHelpers.js | 2 ++ 1 file changed, 2 insertions(+) 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 74ded3c5a90..b3f36c04705 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -69,6 +69,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { } else if (workspaceOrigin && workspaceDest) { // (4) compatible = workspaceOrigin.getMyAccessRights()["delete"] && workspaceDest.getMyAccessRights()["write"]; } + if (compatible) { folderItem.getChildControl("icon").setTextColor("strong-main"); } else { @@ -76,6 +77,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { // do not allow event.preventDefault(); } + const dragWidget = osparc.dashboard.DragWidget.getInstance(); dragWidget.setDropAllowed(compatible); }, From 2bfd6d90aa6b11b4e98d0d42f57877dbe9e2ab96 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:37:50 +0100 Subject: [PATCH 63/71] signature --- .../class/osparc/dashboard/DragDropHelpers.js | 49 +++++++++++-------- .../osparc/dashboard/FolderButtonItem.js | 4 +- .../class/osparc/dashboard/StudyBrowser.js | 2 +- .../dashboard/WorkspacesAndFoldersTreeItem.js | 9 +--- 4 files changed, 34 insertions(+), 30 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 b3f36c04705..3d77ac9b9fb 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -20,7 +20,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { statics: { moveStudy: { - dragStart: function(event, studyDataOrigin, studyItem) { + dragStart: function(event, studyItem, studyDataOrigin) { event.addAction("move"); event.addType("osparc-moveStudy"); event.addData("osparc-moveStudy", { @@ -93,7 +93,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { }, moveFolder: { - dragStart: function(event, folderOrigin, folderItem) { + dragStart: function(event, folderItem, folderOrigin) { event.addAction("move"); event.addType("osparc-moveFolder"); event.addData("osparc-moveFolder", { @@ -112,26 +112,35 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { folderItem.setOpacity(0.2); }, - dragOver: function(event, folderItem, folderDest) { + dragOver: function(event, folderItem, workspaceDestId) { let compatible = false; - // Compatibility checks: - // - It's not the same folder - // - My workspace - // - None - // - Shared workspace - // - write access on workspace const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"]; - compatible = folderDest !== folderOrigin; - const workspaceId = folderOrigin.getWorkspaceId(); - if (compatible) { - if (workspaceId) { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - if (workspace) { - compatible = workspace.getMyAccessRights()["write"]; - } - } else { - compatible = true; - } + const workspaceIdOrigin = folderOrigin.getWorkspaceId(); + const workspaceOrigin = osparc.store.Workspaces.getInstance().getWorkspace(workspaceIdOrigin); + const workspaceDest = osparc.store.Workspaces.getInstance().getWorkspace(workspaceDestId); + // Compatibility checks: + // - Drag over "Shared Workspaces" (0) + // - No + // - My Workspace -> My Workspace (1) + // - Yes + // - My Workspace -> Shared Workspace (2) + // - ~~Delete on Study~~ + // - Write on dest Workspace + // - Shared Workspace -> My Workspace (3) + // - Delete on origin Workspace + // - Shared Workspace -> Shared Workspace (4) + // - Delete on origin Workspace + // - Write on dest Workspace + if (workspaceDestId === -1) { // (0) + compatible = false; + } else if (workspaceIdOrigin === null && workspaceDestId === null) { // (1) + compatible = true; + } else if (workspaceIdOrigin === null && workspaceDest) { // (2) + compatible = workspaceDest.getMyAccessRights()["write"]; + } else if (workspaceOrigin && workspaceDestId === null) { // (3) + compatible = workspaceOrigin.getMyAccessRights()["delete"]; + } else if (workspaceOrigin && workspaceDest) { // (4) + compatible = workspaceOrigin.getMyAccessRights()["delete"] && workspaceDest.getMyAccessRights()["write"]; } if (compatible) { 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 dee4ee880f5..829c973aa95 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -164,7 +164,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.addListener("dragstart", e => { const folderOrigin = this.getFolder(); - osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, folderOrigin, this); + osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, this, folderOrigin); }); this.addListener("dragend", () => { @@ -180,7 +180,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { if (e.supportsType("osparc-moveStudy")) { osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, folderDest.getWorkspaceId()); } else if (e.supportsType("osparc-moveFolder")) { - osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest); + osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest.getWorkspaceId()); } }); 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 302ce40f915..45d46bcfa05 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -661,7 +661,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { card.addListener("dragstart", e => { const studyDataOrigin = card.getResourceData(); - osparc.dashboard.DragDropHelpers.moveStudy.dragStart(e, studyDataOrigin, card); + osparc.dashboard.DragDropHelpers.moveStudy.dragStart(e, card, studyDataOrigin); }); card.addListener("dragend", () => { 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 40dcfaa4b0c..4efe1068cec 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -76,7 +76,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { e.preventDefault(); return; } - osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, folderOrigin, this); + osparc.dashboard.DragDropHelpers.moveFolder.dragStart(e, this, folderOrigin); }); this.addListener("dragend", () => { @@ -92,12 +92,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { if (e.supportsType("osparc-moveStudy")) { osparc.dashboard.DragDropHelpers.moveStudy.dragOver(e, this, workspaceDestId); } else if (e.supportsType("osparc-moveFolder")) { - const folderDest = this.__getFolder(); - if (folderDest == null) { - e.preventDefault(); - return; - } - osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, folderDest); + osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, workspaceDestId); } }); From 88ed670b33b180748e3204b3166fd229854ea412 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 16:53:13 +0100 Subject: [PATCH 64/71] __doMoveFolder --- .../class/osparc/dashboard/DragDropHelpers.js | 1 + .../class/osparc/dashboard/StudyBrowser.js | 22 +++++++++---------- 2 files changed, 12 insertions(+), 11 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 3d77ac9b9fb..1cbda218905 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -159,6 +159,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"]; const folderToFolderData = { folderId: folderOrigin.getFolderId(), + destWorkspaceId: folderDest.getWorkspaceId(), destFolderId: folderDest.getFolderId(), }; return folderToFolderData; 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 45d46bcfa05..9873126ebe9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -565,6 +565,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { return win; }, + __doMoveFolder: function(folderId, destWorkspaceId, destFolderId) { + osparc.store.Folders.getInstance().moveFolderToWorkspace(folderId, destWorkspaceId) // first move to workspace + .then(() => osparc.store.Folders.getInstance().moveFolderToFolder(folderId, destFolderId)) // then move to folder + .then(() => this.__reloadFolders()) + .catch(err => console.error(err)); + }, + _moveFolderToRequested: function(folderId) { const currentWorkspaceId = this.getCurrentWorkspaceId(); const currentFolderId = this.getCurrentFolderId(); @@ -576,19 +583,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const data = e.getData(); const destWorkspaceId = data["workspaceId"]; const destFolderId = data["folderId"]; - const moveFolder = () => { - osparc.store.Folders.getInstance().moveFolderToWorkspace(folderId, destWorkspaceId) // first move to workspace - .then(() => osparc.store.Folders.getInstance().moveFolderToFolder(folderId, destFolderId)) // then move to folder - .then(() => this.__reloadFolders()) - .catch(err => console.error(err)); - } if (destWorkspaceId === currentWorkspaceId) { - moveFolder(); + this.__doMoveFolder(folderId, destWorkspaceId, destFolderId); } else { const confirmationWin = this.__showMoveToWorkspaceWarningMessage(); confirmationWin.addListener("close", () => { if (confirmationWin.getConfirmed()) { - moveFolder(); + this.__doMoveFolder(folderId, destWorkspaceId, destFolderId); } }, this); } @@ -599,11 +600,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { _folderToFolderRequested: function(data) { const { folderId, + destWorkspaceId, destFolderId, } = data; - osparc.store.Folders.getInstance().moveFolderToFolder(folderId, destFolderId) - .then(() => this.__reloadFolders()) - .catch(err => console.error(err)); + this.__doMoveFolder(folderId, destWorkspaceId, destFolderId); }, _trashFolderRequested: function(folderId) { From 1de0288fa4f1ba4bc7366364ee4586d00ecbbc91 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:03:45 +0100 Subject: [PATCH 65/71] moving folders --- .../class/osparc/dashboard/DragDropHelpers.js | 21 +++++++------------ .../osparc/dashboard/FolderButtonItem.js | 4 ++-- .../dashboard/WorkspacesAndFoldersTreeItem.js | 11 ++++------ 3 files changed, 14 insertions(+), 22 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 1cbda218905..d8382a07903 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -70,10 +70,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { compatible = workspaceOrigin.getMyAccessRights()["delete"] && workspaceDest.getMyAccessRights()["write"]; } - if (compatible) { - folderItem.getChildControl("icon").setTextColor("strong-main"); - } else { - folderItem.getChildControl("icon").setTextColor("danger-red"); + if (!compatible) { // do not allow event.preventDefault(); } @@ -82,11 +79,12 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { dragWidget.setDropAllowed(compatible); }, - drop: function(event, folderDest) { + drop: function(event, destWorkspaceId, destFolderId) { const studyData = event.getData("osparc-moveStudy")["studyDataOrigin"]; const studyToFolderData = { studyData, - destFolderId: folderDest.getFolderId(), + destWorkspaceId, + destFolderId, }; return studyToFolderData; }, @@ -143,10 +141,7 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { compatible = workspaceOrigin.getMyAccessRights()["delete"] && workspaceDest.getMyAccessRights()["write"]; } - if (compatible) { - folderItem.getChildControl("icon").setTextColor("strong-main"); - } else { - folderItem.getChildControl("icon").setTextColor("danger-red"); + if (!compatible) { // do not allow event.preventDefault(); } @@ -155,12 +150,12 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { dragWidget.setDropAllowed(compatible); }, - drop: function(event, folderDest) { + drop: function(event, destWorkspaceId, destFolderId) { const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"]; const folderToFolderData = { folderId: folderOrigin.getFolderId(), - destWorkspaceId: folderDest.getWorkspaceId(), - destFolderId: folderDest.getFolderId(), + destWorkspaceId, + destFolderId, }; return folderToFolderData; }, 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 829c973aa95..643ffc0de37 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -195,10 +195,10 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.addListener("drop", e => { const folderDest = this.getFolder(); if (e.supportsType("osparc-moveStudy")) { - const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, folderDest); + const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, folderDest.getWorkspaceId(), folderDest.getFolderId()); this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest); + const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest.getWorkspaceId(), folderDest.getFolderId()); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } }); 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 4efe1068cec..ca1e22e62b3 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -104,16 +104,13 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { }); this.addListener("drop", e => { - const folderDest = this.__getFolder(); - if (folderDest == null) { - e.preventDefault(); - return; - } + const workspaceDestId = this.getModel().getWorkspaceId(); + const folderDestId = this.getModel().getFolderId(); if (e.supportsType("osparc-moveStudy")) { - const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, folderDest); + const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, workspaceDestId, folderDestId); this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest); + const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, workspaceDestId, folderDestId); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } }); From 96d937ed28dbd09381c3b9b76056a34e762a3ce9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:12:38 +0100 Subject: [PATCH 66/71] 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); } }); From 8148f7268efa1cf899559fb5d560dd505ff6b5db Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:21:18 +0100 Subject: [PATCH 67/71] doMoveStudy --- .../class/osparc/dashboard/StudyBrowser.js | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) 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 9873126ebe9..b872437fc54 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -1243,12 +1243,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const selection = this._resourcesContainer.getSelection(); selection.forEach(button => { const studyData = button.getResourceData(); - this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace - .then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder - .catch(err => { - console.error(err); - osparc.FlashMessenger.logAs(err.message, "ERROR"); - }); + this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); }); this.resetSelection(); this.setMultiSelection(false); @@ -1647,6 +1642,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { return studyBillingSettingsButton; }, + __doMoveStudy: function(studyData, destWorkspaceId, destFolderId) { + this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace + .then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder + .catch(err => { + console.error(err); + osparc.FlashMessenger.logAs(err.message, "ERROR"); + }); + }, + __getMoveStudyToMenuButton: function(studyData) { const moveToButton = new qx.ui.menu.Button(this.tr("Move to..."), "@FontAwesome5Solid/folder/12"); moveToButton["moveToButton"] = true; @@ -1661,21 +1665,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const data = e.getData(); const destWorkspaceId = data["workspaceId"]; const destFolderId = data["folderId"]; - const moveStudy = () => { - this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace - .then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder - .catch(err => { - console.error(err); - osparc.FlashMessenger.logAs(err.message, "ERROR"); - }); - }; + if (destWorkspaceId === currentWorkspaceId) { - moveStudy(); + this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); } else { const confirmationWin = this.__showMoveToWorkspaceWarningMessage(); confirmationWin.addListener("close", () => { if (confirmationWin.getConfirmed()) { - moveStudy(); + this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); } }, this); } @@ -1723,13 +1720,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { _studyToFolderRequested: function(data) { const { studyData, + destWorkspaceId, destFolderId, } = data; - this.__moveStudyToFolder(studyData, destFolderId) - .catch(err => { - console.error(err); - osparc.FlashMessenger.logAs(err.message, "ERROR"); - }); + this.__doMoveStudy(studyData, destWorkspaceId, destFolderId); }, __getDuplicateMenuButton: function(studyData) { From 5de45003a53acd70f9812aac5f26c8df4a3e3850 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:30:11 +0100 Subject: [PATCH 68/71] minor fix --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b872437fc54..081d63a2a96 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -1645,6 +1645,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __doMoveStudy: function(studyData, destWorkspaceId, destFolderId) { this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace .then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder + .then(() => this.__removeFromStudyList(studyData["uuid"])) .catch(err => { console.error(err); osparc.FlashMessenger.logAs(err.message, "ERROR"); @@ -1713,8 +1714,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } }; return osparc.data.Resources.fetch("studies", "moveToFolder", params) - .then(() => studyData["folderId"] = destFolderId) - .then(() => this.__removeFromStudyList(studyData["uuid"])); + .then(() => studyData["folderId"] = destFolderId); }, _studyToFolderRequested: function(data) { From 4bcfe9ed5ea053755caf0012a7eaf067fd5f0758 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:42:46 +0100 Subject: [PATCH 69/71] draggingOver --- .../osparc/dashboard/WorkspacesAndFoldersTreeItem.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 646b5fa7a8c..96ee093befd 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -87,6 +87,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { __attachDropHandlers: function() { this.setDroppable(true); + let draggingOver = false; this.addListener("dragover", e => { const workspaceDestId = this.getModel().getWorkspaceId(); const folderDestId = this.getModel().getFolderId(); @@ -95,13 +96,23 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { } else if (e.supportsType("osparc-moveFolder")) { osparc.dashboard.DragDropHelpers.moveFolder.dragOver(e, this, workspaceDestId, folderDestId); } + + draggingOver = true; + setTimeout(() => { + if (draggingOver) { + this.setOpen(true); + draggingOver = false; + } + }, 1000); }); this.addListener("dragleave", () => { osparc.dashboard.DragDropHelpers.dragLeave(this); + draggingOver = false; }); this.addListener("dragend", () => { osparc.dashboard.DragDropHelpers.dragLeave(this); + draggingOver = false; }); this.addListener("drop", e => { From d9260ed9186c7cea77b115e7c3e989fab13eb15c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 17:46:59 +0100 Subject: [PATCH 70/71] minor --- .../class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js | 1 + 1 file changed, 1 insertion(+) 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 96ee093befd..e05706c7d0b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -125,6 +125,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, workspaceDestId, folderDestId); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } + draggingOver = false; }); }, }, From a9b5bfc387eeb3149ffb524093f542038bfc7912 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 15 Dec 2024 18:03:32 +0100 Subject: [PATCH 71/71] highlilight compatible icons --- .../class/osparc/dashboard/DragDropHelpers.js | 13 ++++++++++--- .../class/osparc/dashboard/FolderButtonItem.js | 4 ++-- .../dashboard/WorkspacesAndFoldersTreeItem.js | 4 ++-- 3 files changed, 14 insertions(+), 7 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 2b980db4e91..83aed499cb4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/DragDropHelpers.js @@ -77,15 +77,18 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { const dragWidget = osparc.dashboard.DragWidget.getInstance(); dragWidget.setDropAllowed(compatible); + + folderItem.getChildControl("icon").setTextColor(compatible ? "strong-main" : "text"); }, - drop: function(event, destWorkspaceId, destFolderId) { + drop: function(event, folderItem, destWorkspaceId, destFolderId) { const studyData = event.getData("osparc-moveStudy")["studyDataOrigin"]; const studyToFolderData = { studyData, destWorkspaceId, destFolderId, }; + folderItem.getChildControl("icon").resetTextColor(); return studyToFolderData; }, }, @@ -150,23 +153,27 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", { const dragWidget = osparc.dashboard.DragWidget.getInstance(); dragWidget.setDropAllowed(compatible); + + folderItem.getChildControl("icon").setTextColor(compatible ? "strong-main" : "text"); }, - drop: function(event, destWorkspaceId, destFolderId) { + drop: function(event, folderItem, destWorkspaceId, destFolderId) { const folderOrigin = event.getData("osparc-moveFolder")["folderOrigin"]; const folderToFolderData = { folderId: folderOrigin.getFolderId(), destWorkspaceId, destFolderId, }; + folderItem.getChildControl("icon").resetTextColor(); return folderToFolderData; }, }, dragLeave: function(item) { - item.getChildControl("icon").resetTextColor(); const dragWidget = osparc.dashboard.DragWidget.getInstance(); dragWidget.setDropAllowed(false); + + item.getChildControl("icon").resetTextColor(); }, dragEnd: function(draggedItem) { 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 15e0827450c..4d11a423c34 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -195,10 +195,10 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.addListener("drop", e => { const folderDest = this.getFolder(); if (e.supportsType("osparc-moveStudy")) { - const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, folderDest.getWorkspaceId(), folderDest.getFolderId()); + const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, this, folderDest.getWorkspaceId(), folderDest.getFolderId()); this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, folderDest.getWorkspaceId(), folderDest.getFolderId()); + const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, this, folderDest.getWorkspaceId(), folderDest.getFolderId()); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } }); 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 e05706c7d0b..05a4e44a9c0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTreeItem.js @@ -119,10 +119,10 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", { const workspaceDestId = this.getModel().getWorkspaceId(); const folderDestId = this.getModel().getFolderId(); if (e.supportsType("osparc-moveStudy")) { - const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, workspaceDestId, folderDestId); + const studyToFolderData = osparc.dashboard.DragDropHelpers.moveStudy.drop(e, this, workspaceDestId, folderDestId); this.fireDataEvent("studyToFolderRequested", studyToFolderData); } else if (e.supportsType("osparc-moveFolder")) { - const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, workspaceDestId, folderDestId); + const folderToFolderData = osparc.dashboard.DragDropHelpers.moveFolder.drop(e, this, workspaceDestId, folderDestId); this.fireDataEvent("folderToFolderRequested", folderToFolderData); } draggingOver = false;