Skip to content

Commit

Permalink
doMoveStudy
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 15, 2024
1 parent 96d937e commit 8148f72
Showing 1 changed file with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8148f72

Please sign in to comment.