Skip to content

Commit

Permalink
wire signals
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 13, 2024
1 parent c3622d0 commit b3833b5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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);
}
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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!");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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) {
Expand Down

0 comments on commit b3833b5

Please sign in to comment.