Skip to content

Commit 54e8174

Browse files
odeimaizmrnicegyu11
authored andcommitted
🎨 [Frontend] Move multiple studies at once (ITISFoundation#6457)
1 parent c0ba01a commit 54e8174

File tree

13 files changed

+421
-407
lines changed

13 files changed

+421
-407
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -784,13 +784,9 @@ qx.Class.define("osparc.dashboard.CardBase", {
784784
if (billingSettingsButton) {
785785
billingSettingsButton.setEnabled(osparc.study.Utils.canShowBillingOptions(resourceData));
786786
}
787-
const moveToFolderButton = menuButtons.find(menuBtn => "moveToFolderButton" in menuBtn);
788-
if (moveToFolderButton) {
789-
moveToFolderButton.setEnabled(osparc.study.Utils.canMoveToFolder(resourceData));
790-
}
791-
const moveToWorkspaceButton = menuButtons.find(menuBtn => "moveToWorkspaceButton" in menuBtn);
792-
if (moveToWorkspaceButton) {
793-
moveToWorkspaceButton.setEnabled(osparc.study.Utils.canMoveToWorkspace(resourceData));
787+
const moveToButton = menuButtons.find(menuBtn => "moveToButton" in menuBtn);
788+
if (moveToButton) {
789+
moveToButton.setEnabled(osparc.study.Utils.canMoveTo(resourceData));
794790
}
795791
const deleteButton = menuButtons.find(menuBtn => "deleteButton" in menuBtn);
796792
if (deleteButton) {

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
4545
events: {
4646
"folderSelected": "qx.event.type.Data",
4747
"folderUpdated": "qx.event.type.Data",
48-
"moveFolderToFolderRequested": "qx.event.type.Data",
49-
"moveFolderToWorkspaceRequested": "qx.event.type.Data",
48+
"moveFolderToRequested": "qx.event.type.Data",
5049
"deleteFolderRequested": "qx.event.type.Data"
5150
},
5251

@@ -191,13 +190,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
191190
editButton.addListener("execute", () => this.__editFolder(), this);
192191
menu.add(editButton);
193192

194-
const moveToFolderButton = new qx.ui.menu.Button(this.tr("Move to Folder..."), "@FontAwesome5Solid/folder/12");
195-
moveToFolderButton.addListener("execute", () => this.fireDataEvent("moveFolderToFolderRequested", this.getFolderId()), this);
196-
menu.add(moveToFolderButton);
197-
198-
const moveToWorkspaceButton = new qx.ui.menu.Button(this.tr("Move to Workspace..."), osparc.store.Workspaces.iconPath(14));
199-
moveToWorkspaceButton.addListener("execute", () => this.fireDataEvent("moveFolderToWorkspaceRequested", this.getFolderId()), this);
200-
menu.add(moveToWorkspaceButton);
193+
const moveToButton = new qx.ui.menu.Button(this.tr("Move to..."), "@FontAwesome5Solid/folder/12");
194+
moveToButton.addListener("execute", () => this.fireDataEvent("moveFolderToRequested", this.getFolderId()), this);
195+
menu.add(moveToButton);
201196

202197
menu.addSeparator();
203198

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,21 @@ qx.Class.define("osparc.dashboard.GridButtonLoadMore", {
2929

3030
this._applyFetching(false);
3131

32+
// A minimalistic spinning wheel
33+
this.getChildControl("header").exclude();
3234
this.getChildControl("footer").exclude();
35+
this.set({
36+
backgroundColor: "transparent"
37+
});
3338
},
3439

3540
members: {
3641
_applyFetching: function(value) {
37-
const title = this.getChildControl("title");
38-
const desc = this.getChildControl("subtitle-text");
3942
this.setIcon(osparc.dashboard.CardBase.LOADING_ICON);
4043
if (value) {
41-
title.setValue(this.tr("Loading..."));
42-
desc.setValue("");
4344
this.getChildControl("icon").getChildControl("image").getContentElement()
4445
.addClass("rotate");
4546
} else {
46-
title.setValue(this.tr("Load More"));
47-
desc.setValue(this.tr("Click to load more").toString());
4847
this.getChildControl("icon").getChildControl("image").getContentElement()
4948
.removeClass("rotate");
5049
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ qx.Class.define("osparc.dashboard.ListButtonLoadMore", {
3030
this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.LOADER);
3131

3232
this._applyFetching(false);
33+
34+
this.set({
35+
backgroundColor: "transparent"
36+
});
3337
},
3438

3539
members: {
3640
_applyFetching: function(value) {
37-
const title = this.getChildControl("title");
41+
this.setIcon(osparc.dashboard.CardBase.LOADING_ICON);
3842
if (value) {
39-
title.setValue(this.tr("Loading..."));
40-
this.setIcon(osparc.dashboard.CardBase.LOADING_ICON);
4143
this.getChildControl("icon").getChildControl("image").getContentElement()
4244
.addClass("rotate");
4345
} else {
44-
title.setValue(this.tr("Load More"));
45-
this.setIcon("@FontAwesome5Solid/paw/");
4646
this.getChildControl("icon").getChildControl("image").getContentElement()
4747
.removeClass("rotate");
4848
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/* ************************************************************************
2+
3+
osparc - the simcore frontend
4+
5+
https://osparc.io
6+
7+
Copyright:
8+
2024 IT'IS Foundation, https://itis.swiss
9+
10+
License:
11+
MIT: https://opensource.org/licenses/MIT
12+
13+
Authors:
14+
* Odei Maiz (odeimaiz)
15+
16+
************************************************************************ */
17+
18+
qx.Class.define("osparc.dashboard.MoveResourceTo", {
19+
extend: qx.ui.core.Widget,
20+
21+
construct: function(currentWorkspaceId, currentFolderId) {
22+
this.base(arguments);
23+
24+
this.__currentWorkspaceId = currentWorkspaceId;
25+
this.__currentFolderId = currentFolderId;
26+
27+
this._setLayout(new qx.ui.layout.VBox(10));
28+
29+
this.getChildControl("current-location");
30+
31+
const workspacesAndFoldersTree = this.getChildControl("workspaces-and-folders-tree");
32+
this.getChildControl("cancel-btn");
33+
const moveButton = this.getChildControl("move-btn");
34+
35+
moveButton.setEnabled(false);
36+
workspacesAndFoldersTree.getSelection().addListener("change", () => {
37+
const selection = workspacesAndFoldersTree.getSelection();
38+
if (selection.getLength() > 0) {
39+
const item = selection.getItem(0);
40+
this.__selectedWorkspaceId = item.getWorkspaceId();
41+
this.__selectedFolderId = item.getFolderId();
42+
moveButton.setEnabled(this.__currentWorkspaceId !== this.__selectedWorkspaceId || this.__currentFolderId !== this.__selectedFolderId);
43+
}
44+
}, this);
45+
moveButton.addListener("execute", () => {
46+
this.fireDataEvent("moveTo", {
47+
workspaceId: this.__selectedWorkspaceId,
48+
folderId: this.__selectedFolderId,
49+
});
50+
}, this);
51+
},
52+
53+
events: {
54+
"cancel": "qx.event.type.Event",
55+
"moveTo": "qx.event.type.Data"
56+
},
57+
58+
members: {
59+
__currentWorkspaceId: null,
60+
__currentFolderId: null,
61+
__selectedWorkspaceId: null,
62+
__selectedFolderId: null,
63+
64+
_createChildControlImpl: function(id) {
65+
let control;
66+
switch (id) {
67+
case "current-location": {
68+
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
69+
const intro = new qx.ui.basic.Label(this.tr("Current location"));
70+
control.add(intro);
71+
const workspace = osparc.store.Workspaces.getInstance().getWorkspace(this.__currentWorkspaceId);
72+
const workspaceText = workspace ? workspace.getName() : "My Workspace";
73+
const workspaceLabel = new qx.ui.basic.Label(this.tr("- Workspace: ") + workspaceText);
74+
control.add(workspaceLabel);
75+
const folder = osparc.store.Folders.getInstance().getFolder(this.__currentFolderId);
76+
if (folder) {
77+
const folderText = folder.getName();
78+
const folderLabel = new qx.ui.basic.Label(this.tr("- Folder: ") + folderText);
79+
control.add(folderLabel);
80+
}
81+
this._add(control);
82+
break;
83+
}
84+
case "workspaces-and-folders-tree":
85+
control = new osparc.dashboard.WorkspacesAndFoldersTree();
86+
this._add(control, {
87+
flex: 1
88+
});
89+
break;
90+
case "buttons-layout":
91+
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({
92+
alignX: "right"
93+
}));
94+
this._add(control);
95+
break;
96+
case "cancel-btn": {
97+
const buttons = this.getChildControl("buttons-layout");
98+
control = new qx.ui.form.Button(this.tr("Cancel")).set({
99+
appearance: "form-button-text"
100+
});
101+
control.addListener("execute", () => this.fireEvent("cancel"), this);
102+
buttons.add(control);
103+
break;
104+
}
105+
case "move-btn": {
106+
const buttons = this.getChildControl("buttons-layout");
107+
control = new qx.ui.form.Button(this.tr("Move")).set({
108+
appearance: "form-button"
109+
});
110+
buttons.add(control);
111+
break;
112+
}
113+
}
114+
return control || this.base(arguments, id);
115+
},
116+
117+
__getUpstreamFolders: function(childFolder, folderIds = []) {
118+
if (childFolder) {
119+
folderIds.unshift(childFolder.getFolderId());
120+
const parentFolder = osparc.store.Folders.getInstance().getFolder(childFolder.getParentFolderId());
121+
this.__getUpstreamFolders(parentFolder, folderIds);
122+
}
123+
}
124+
}
125+
});

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

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)