Skip to content

Commit 8148f72

Browse files
committed
doMoveStudy
1 parent 96d937e commit 8148f72

File tree

1 file changed

+15
-21
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+15
-21
lines changed

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,12 +1243,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
12431243
const selection = this._resourcesContainer.getSelection();
12441244
selection.forEach(button => {
12451245
const studyData = button.getResourceData();
1246-
this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace
1247-
.then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder
1248-
.catch(err => {
1249-
console.error(err);
1250-
osparc.FlashMessenger.logAs(err.message, "ERROR");
1251-
});
1246+
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
12521247
});
12531248
this.resetSelection();
12541249
this.setMultiSelection(false);
@@ -1647,6 +1642,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16471642
return studyBillingSettingsButton;
16481643
},
16491644

1645+
__doMoveStudy: function(studyData, destWorkspaceId, destFolderId) {
1646+
this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace
1647+
.then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder
1648+
.catch(err => {
1649+
console.error(err);
1650+
osparc.FlashMessenger.logAs(err.message, "ERROR");
1651+
});
1652+
},
1653+
16501654
__getMoveStudyToMenuButton: function(studyData) {
16511655
const moveToButton = new qx.ui.menu.Button(this.tr("Move to..."), "@FontAwesome5Solid/folder/12");
16521656
moveToButton["moveToButton"] = true;
@@ -1661,21 +1665,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16611665
const data = e.getData();
16621666
const destWorkspaceId = data["workspaceId"];
16631667
const destFolderId = data["folderId"];
1664-
const moveStudy = () => {
1665-
this.__moveStudyToWorkspace(studyData, destWorkspaceId) // first move to workspace
1666-
.then(() => this.__moveStudyToFolder(studyData, destFolderId)) // then move to folder
1667-
.catch(err => {
1668-
console.error(err);
1669-
osparc.FlashMessenger.logAs(err.message, "ERROR");
1670-
});
1671-
};
1668+
16721669
if (destWorkspaceId === currentWorkspaceId) {
1673-
moveStudy();
1670+
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
16741671
} else {
16751672
const confirmationWin = this.__showMoveToWorkspaceWarningMessage();
16761673
confirmationWin.addListener("close", () => {
16771674
if (confirmationWin.getConfirmed()) {
1678-
moveStudy();
1675+
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
16791676
}
16801677
}, this);
16811678
}
@@ -1723,13 +1720,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
17231720
_studyToFolderRequested: function(data) {
17241721
const {
17251722
studyData,
1723+
destWorkspaceId,
17261724
destFolderId,
17271725
} = data;
1728-
this.__moveStudyToFolder(studyData, destFolderId)
1729-
.catch(err => {
1730-
console.error(err);
1731-
osparc.FlashMessenger.logAs(err.message, "ERROR");
1732-
});
1726+
this.__doMoveStudy(studyData, destWorkspaceId, destFolderId);
17331727
},
17341728

17351729
__getDuplicateMenuButton: function(studyData) {

0 commit comments

Comments
 (0)