Skip to content

Commit 6db71c1

Browse files
authored
🎨 [Frontend] Publish template UI/UX (#6617)
1 parent 5770ecf commit 6db71c1

File tree

6 files changed

+40
-18
lines changed

6 files changed

+40
-18
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
8383

8484
statics: {
8585
sortListByPriority: function(list) {
86-
list.getChildren().sort((a, b) => {
87-
let sortingValue = a.getPriority() - b.getPriority();
88-
return sortingValue;
89-
});
86+
if (list) {
87+
list.getChildren().sort((a, b) => {
88+
let sortingValue = a.getPriority() - b.getPriority();
89+
return sortingValue;
90+
});
91+
}
9092
},
9193

9294
cardExists: function(container, newCard) {
@@ -233,6 +235,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
233235
},
234236

235237
__addCardToContainer: function(card, container) {
238+
if (container == null) {
239+
return;
240+
}
241+
236242
container.add(card);
237243

238244
if (this.getMode() === "list") {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
233233
}
234234

235235
const studies = resp["data"];
236-
this._resourcesContainer.getFlatList().nextRequest = resp["_links"]["next"];
237236
this.__addStudiesToList(studies);
237+
if (this._resourcesContainer.getFlatList()) {
238+
this._resourcesContainer.getFlatList().nextRequest = resp["_links"]["next"];
239+
}
238240

239241
// Show Quick Start if there are no studies in the root folder of the personal workspace
240242
const quickStartInfo = osparc.product.quickStart.Utils.getQuickStart();

services/static-webserver/client/source/class/osparc/service/ServiceListItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ qx.Class.define("osparc.service.ServiceListItem", {
5757
LATEST: "latest",
5858
ITEM_WIDTH: 550,
5959
ITEM_HEIGHT: 35,
60-
SERVICE_ICON: "@FontAwesome5Solid/paw/24"
60+
SERVICE_ICON: osparc.product.Utils.getProductThumbUrl()
6161
},
6262

6363
members: {

services/static-webserver/client/source/class/osparc/share/AddCollaborators.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ qx.Class.define("osparc.share.AddCollaborators", {
2727

2828
/**
2929
* @param serializedDataCopy {Object} Object containing the Serialized Data
30+
* @param publishingTemplate {Boolean} Wether the widget needs to be initialized for publishing template
3031
*/
31-
construct: function(serializedDataCopy) {
32+
construct: function(serializedDataCopy, publishingTemplate = false) {
3233
this.base(arguments);
3334

34-
this.setSerializedData(serializedDataCopy);
35+
this.__serializedDataCopy = serializedDataCopy;
36+
this.__publishingTemplate = publishingTemplate;
3537

3638
this._setLayout(new qx.ui.layout.VBox(5));
3739

@@ -44,6 +46,7 @@ qx.Class.define("osparc.share.AddCollaborators", {
4446

4547
members: {
4648
__serializedDataCopy: null,
49+
__publishingTemplate: null,
4750

4851
_createChildControlImpl: function(id) {
4952
let control;
@@ -52,22 +55,31 @@ qx.Class.define("osparc.share.AddCollaborators", {
5255
control = new qx.ui.basic.Label(this.tr("Select from the list below and click Share"));
5356
this._add(control);
5457
break;
58+
case "buttons-layout":
59+
control = new qx.ui.container.Composite(new qx.ui.layout.HBox());
60+
this._add(control);
61+
break;
5562
case "share-with":
5663
control = new qx.ui.form.Button(this.tr("Share with...")).set({
5764
appearance: "form-button",
5865
alignX: "left",
5966
allowGrowX: false
6067
});
61-
this._add(control);
68+
this.getChildControl("buttons-layout").add(control);
69+
this.getChildControl("buttons-layout").add(new qx.ui.core.Spacer(), {
70+
flex: 1
71+
});
6272
break;
63-
case "check-organizations":
64-
control = new qx.ui.form.Button(this.tr("Check Organizations...")).set({
73+
case "my-organizations":
74+
control = new qx.ui.form.Button(this.tr("My Organizations...")).set({
6575
appearance: "form-button-outlined",
6676
allowGrowY: false,
6777
allowGrowX: false,
78+
alignX: "right",
6879
icon: osparc.dashboard.CardBase.SHARED_ORGS
6980
});
70-
this._add(control);
81+
this.getChildControl("buttons-layout").add(control);
82+
break;
7183
}
7284
return control || this.base(arguments, id);
7385
},
@@ -82,13 +94,16 @@ qx.Class.define("osparc.share.AddCollaborators", {
8294
const addCollaboratorBtn = this.getChildControl("share-with");
8395
addCollaboratorBtn.addListener("execute", () => {
8496
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(this.__serializedDataCopy);
97+
if (this.__publishingTemplate) {
98+
collaboratorsManager.getActionButton().setLabel(this.tr("Publish for"));
99+
}
85100
collaboratorsManager.addListener("addCollaborators", e => {
86101
collaboratorsManager.close();
87102
this.fireDataEvent("addCollaborators", e.getData());
88103
}, this);
89104
}, this);
90105

91-
const organizations = this.getChildControl("check-organizations");
106+
const organizations = this.getChildControl("my-organizations");
92107
organizations.addListener("execute", () => osparc.desktop.organizations.OrganizationsWindow.openWindow(), this);
93108
}
94109
}

services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
8282
const buttons = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({
8383
alignX: "right"
8484
}));
85-
const orgsButton = this.__orgsButton = new qx.ui.form.Button(this.tr("Check Organizations...")).set({
85+
// Quick access for users that still don't belong to any organization
86+
const orgsButton = this.__orgsButton = new qx.ui.form.Button(this.tr("My Organizations...")).set({
8687
appearance: "form-button",
8788
visibility: "excluded",
8889
});
@@ -184,9 +185,6 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
184185
});
185186
},
186187

187-
__openOrganization: function() {
188-
},
189-
190188
__shareClicked: function() {
191189
this.__collabButtonsContainer.setEnabled(false);
192190
this.__shareButton.setFetching(true);

services/static-webserver/client/source/class/osparc/share/PublishTemplate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ qx.Class.define("osparc.share.PublishTemplate", {
4848
__buildLayout: function() {
4949
// mark it us template, so that testers can share it with product everyone
5050
this.__potentialTemplateData["resourceType"] = "template";
51-
const addCollaborators = new osparc.share.AddCollaborators(this.__potentialTemplateData);
51+
const addCollaborators = new osparc.share.AddCollaborators(this.__potentialTemplateData, true);
5252
addCollaborators.getChildControl("intro-text").set({
5353
value: this.tr("Make the ") + osparc.product.Utils.getTemplateAlias() + this.tr(" also accessible to:"),
5454
font: "text-14"
5555
});
56+
addCollaborators.getChildControl("share-with").setLabel(this.tr("Publish for..."));
5657
this._add(addCollaborators);
5758

5859
this._add(this.__selectedCollabs);

0 commit comments

Comments
 (0)