Skip to content

Commit 662030a

Browse files
authored
πŸŽ¨πŸ› [Frontend] Folders tree: improvements II (#6364)
On behalf of @odeimaiz
1 parent c21b1fb commit 662030a

File tree

8 files changed

+104
-32
lines changed

8 files changed

+104
-32
lines changed

β€Žservices/static-webserver/client/source/class/osparc/dashboard/CardBase.jsβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
780780
if (studyDataButton) {
781781
studyDataButton.setEnabled(osparc.study.Utils.canShowStudyData(resourceData));
782782
}
783+
const billingSettingsButton = menuButtons.find(menuBtn => "billingSettingsButton" in menuBtn);
784+
if (billingSettingsButton) {
785+
billingSettingsButton.setEnabled(osparc.study.Utils.canShowBillingOptions(resourceData));
786+
}
783787
const moveToFolderButton = menuButtons.find(menuBtn => "moveToFolderButton" in menuBtn);
784788
if (moveToFolderButton) {
785789
moveToFolderButton.setEnabled(osparc.study.Utils.canMoveToFolder(resourceData));

β€Žservices/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.jsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
3838

3939

4040
const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer();
41-
this._add(workspacesContainer);
4241
workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");
4342

4443

β€Žservices/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
165165
this.__tagButtons = [];
166166
layout.removeAll();
167167
osparc.store.Store.getInstance().getTags().forEach((tag, idx) => {
168-
const button = new qx.ui.form.ToggleButton(tag.name, "@FontAwesome5Solid/tag/20");
168+
const button = new qx.ui.form.ToggleButton(tag.name, "@FontAwesome5Solid/tag/18");
169169
button.id = tag.id;
170170
button.set({
171171
appearance: "filter-toggle-button",

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
444444
.then(() => {
445445
this.__reloadWorkspaces();
446446
})
447-
.catch(err => console.error(err));
447+
.catch(err => {
448+
console.error(err);
449+
osparc.FlashMessenger.logAs(err.message, "ERROR");
450+
})
448451
},
449452
// /WORKSPACES
450453

@@ -480,15 +483,16 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
480483
// If user can't write in workspace, do not show plus button
481484
return;
482485
}
483-
const newFolderCard = new osparc.dashboard.FolderButtonNew();
484-
newFolderCard.setCardKey("new-folder");
485-
newFolderCard.subscribeToFilterGroup("searchBarFilter");
486-
newFolderCard.addListener("createFolder", e => {
487-
const data = e.getData();
488-
this.__createFolder(data);
489-
}, this);
490-
this._resourcesContainer.addNewFolderCard(newFolderCard);
491486
}
487+
488+
const newFolderCard = new osparc.dashboard.FolderButtonNew();
489+
newFolderCard.setCardKey("new-folder");
490+
newFolderCard.subscribeToFilterGroup("searchBarFilter");
491+
newFolderCard.addListener("createFolder", e => {
492+
const data = e.getData();
493+
this.__createFolder(data);
494+
}, this);
495+
this._resourcesContainer.addNewFolderCard(newFolderCard);
492496
},
493497

494498
__createFolder: function(data) {
@@ -1328,6 +1332,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
13281332
__getBillingMenuButton: function(card) {
13291333
const text = osparc.utils.Utils.capitalize(this.tr("Billing Settings..."));
13301334
const studyBillingSettingsButton = new qx.ui.menu.Button(text);
1335+
studyBillingSettingsButton["billingSettingsButton"] = true;
13311336
studyBillingSettingsButton.addListener("tap", () => card.openBilling(), this);
13321337
return studyBillingSettingsButton;
13331338
},

β€Žservices/static-webserver/client/source/class/osparc/dashboard/WorkspaceHeader.jsβ€Ž

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,6 @@ qx.Class.define("osparc.dashboard.WorkspaceHeader", {
122122
}));
123123
this._add(control);
124124
break;
125-
case "share-icon": {
126-
control = new qx.ui.basic.Image().set({
127-
alignY: "middle",
128-
allowGrowX: false,
129-
allowShrinkX: false
130-
});
131-
const layout = this.getChildControl("share-layout");
132-
layout.addAt(control, 0);
133-
break;
134-
}
135125
case "share-text": {
136126
control = new qx.ui.basic.Label().set({
137127
font: "text-14"
@@ -227,8 +217,24 @@ qx.Class.define("osparc.dashboard.WorkspaceHeader", {
227217
this.__spacers.forEach(spacer => spacer.setVisibility(show ? "visible" : "excluded"));
228218
},
229219

220+
__getShareIcon: function() {
221+
// reset previous
222+
const layout = this.getChildControl("share-layout");
223+
if (this.__shareIcon) {
224+
layout.remove(this.__shareIcon);
225+
}
226+
227+
const shareIcon = this.__shareIcon = new qx.ui.basic.Image().set({
228+
alignY: "middle",
229+
allowGrowX: false,
230+
allowShrinkX: false
231+
});
232+
layout.addAt(shareIcon, 0);
233+
return shareIcon;
234+
},
235+
230236
__applyAccessRights: function(accessRights) {
231-
const shareIcon = this.getChildControl("share-icon");
237+
const shareIcon = this.__getShareIcon();
232238
const shareText = this.getChildControl("share-text");
233239
if (accessRights && Object.keys(accessRights).length) {
234240
osparc.dashboard.CardBase.populateShareIcon(shareIcon, accessRights);
@@ -248,7 +254,7 @@ qx.Class.define("osparc.dashboard.WorkspaceHeader", {
248254
const roleText = this.getChildControl("role-text");
249255
const roleIcon = this.getChildControl("role-icon");
250256
if (value && Object.keys(value).length) {
251-
editButton.show();
257+
editButton.setVisibility(value["delete"] ? "visible" : "excluded");
252258
const menu = new qx.ui.menu.Menu().set({
253259
position: "bottom-right"
254260
});

β€Žservices/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.jsβ€Ž

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
3636
decorator: "no-border",
3737
font: "text-14",
3838
hideRoot: true,
39-
paddingLeft: -10,
39+
// paddingLeft: -10,
40+
contentPadding: 0,
41+
padding: 0,
4042
});
4143

4244
this.__addMyWorkspace(rootModel);
@@ -102,6 +104,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
102104
__initTree: function() {
103105
const that = this;
104106
this.setDelegate({
107+
createItem: () => new osparc.dashboard.WorkspacesAndFoldersTreeItem(),
105108
bindItem: (c, item, id) => {
106109
c.bindDefaultProperties(item, id);
107110
c.bindProperty("", "open", {
@@ -115,12 +118,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
115118
return isOpen;
116119
},
117120
}, item, id);
118-
},
119-
configureItem: item => {
120-
item.set({
121-
indent: 12, // defaults to 19
122-
});
123-
},
121+
}
124122
});
125123

126124
this.setIconPath("icon");
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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.WorkspacesAndFoldersTreeItem", {
19+
extend: qx.ui.tree.VirtualTreeItem,
20+
21+
construct: function() {
22+
this.base(arguments);
23+
24+
this.set({
25+
indent: 12, // defaults to 19,
26+
});
27+
28+
this.getContentElement().setStyles({
29+
"border-radius": "8px"
30+
});
31+
32+
this.setNotHoveredStyle();
33+
this.__attachEventHandlers();
34+
},
35+
36+
members: {
37+
__attachEventHandlers: function() {
38+
this.addListener("mouseover", () => {
39+
this.setHoveredStyle();
40+
});
41+
this.addListener("mouseout", () => {
42+
this.setNotHoveredStyle();
43+
});
44+
},
45+
46+
setHoveredStyle: function() {
47+
osparc.utils.Utils.addBorder(this, 1, qx.theme.manager.Color.getInstance().resolve("text"));
48+
},
49+
50+
setNotHoveredStyle: function() {
51+
osparc.utils.Utils.hideBorder(this);
52+
}
53+
},
54+
});

β€Žservices/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.jsβ€Ž

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ qx.Class.define("osparc.editor.WorkspaceEditor", {
178178
};
179179
osparc.store.Workspaces.getInstance().postWorkspace(newWorkspaceData)
180180
.then(newWorkspace => this.fireDataEvent("workspaceCreated", newWorkspace))
181-
.catch(console.error)
181+
.catch(err => {
182+
console.error(err);
183+
osparc.FlashMessenger.logAs(err.message, "ERROR");
184+
})
182185
.finally(() => createButton.setFetching(false));
183186
},
184187

@@ -191,7 +194,10 @@ qx.Class.define("osparc.editor.WorkspaceEditor", {
191194
};
192195
osparc.store.Workspaces.getInstance().putWorkspace(this.__workspaceId, updateData)
193196
.then(() => this.fireEvent("workspaceUpdated"))
194-
.catch(console.error)
197+
.catch(err => {
198+
console.error(err);
199+
osparc.FlashMessenger.logAs(err.message, "ERROR");
200+
})
195201
.finally(() => editButton.setFetching(false));
196202
},
197203

0 commit comments

Comments
Β (0)