Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 [Frontend] Publish template UI/UX #6617

Merged
merged 15 commits into from
Oct 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ qx.Class.define("osparc.share.AddCollaborators", {

/**
* @param serializedDataCopy {Object} Object containing the Serialized Data
* @param publishingTemplate {Boolean} Wether the widget needs to be initialized for publishing template
*/
construct: function(serializedDataCopy) {
construct: function(serializedDataCopy, publishingTemplate = false) {
this.base(arguments);

this.setSerializedData(serializedDataCopy);
this.__serializedDataCopy = serializedDataCopy;
this.__publishingTemplate = publishingTemplate;

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

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

members: {
__serializedDataCopy: null,
__publishingTemplate: null,

_createChildControlImpl: function(id) {
let control;
Expand All @@ -52,22 +55,31 @@ qx.Class.define("osparc.share.AddCollaborators", {
control = new qx.ui.basic.Label(this.tr("Select from the list below and click Share"));
this._add(control);
break;
case "buttons-layout":
control = new qx.ui.container.Composite(new qx.ui.layout.HBox());
this._add(control);
break;
case "share-with":
control = new qx.ui.form.Button(this.tr("Share with...")).set({
appearance: "form-button",
alignX: "left",
allowGrowX: false
});
this._add(control);
this.getChildControl("buttons-layout").add(control);
this.getChildControl("buttons-layout").add(new qx.ui.core.Spacer(), {
flex: 1
});
break;
case "check-organizations":
control = new qx.ui.form.Button(this.tr("Check Organizations...")).set({
case "my-organizations":
control = new qx.ui.form.Button(this.tr("My Organizations...")).set({
appearance: "form-button-outlined",
allowGrowY: false,
allowGrowX: false,
alignX: "right",
icon: osparc.dashboard.CardBase.SHARED_ORGS
});
this._add(control);
this.getChildControl("buttons-layout").add(control);
break;
}
return control || this.base(arguments, id);
},
Expand All @@ -82,13 +94,16 @@ qx.Class.define("osparc.share.AddCollaborators", {
const addCollaboratorBtn = this.getChildControl("share-with");
addCollaboratorBtn.addListener("execute", () => {
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(this.__serializedDataCopy);
if (this.__publishingTemplate) {
collaboratorsManager.getActionButton().setLabel(this.tr("Publish for"));
}
collaboratorsManager.addListener("addCollaborators", e => {
collaboratorsManager.close();
this.fireDataEvent("addCollaborators", e.getData());
}, this);
}, this);

const organizations = this.getChildControl("check-organizations");
const organizations = this.getChildControl("my-organizations");
organizations.addListener("execute", () => osparc.desktop.organizations.OrganizationsWindow.openWindow(), this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
const buttons = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({
alignX: "right"
}));
const orgsButton = this.__orgsButton = new qx.ui.form.Button(this.tr("Check Organizations...")).set({
// Quick access for users that still don't belong to any organization
const orgsButton = this.__orgsButton = new qx.ui.form.Button(this.tr("My Organizations...")).set({
appearance: "form-button",
visibility: "excluded",
});
Expand Down Expand Up @@ -184,9 +185,6 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
});
},

__openOrganization: function() {
},

__shareClicked: function() {
this.__collabButtonsContainer.setEnabled(false);
this.__shareButton.setFetching(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ qx.Class.define("osparc.share.PublishTemplate", {
__buildLayout: function() {
// mark it us template, so that testers can share it with product everyone
this.__potentialTemplateData["resourceType"] = "template";
const addCollaborators = new osparc.share.AddCollaborators(this.__potentialTemplateData);
const addCollaborators = new osparc.share.AddCollaborators(this.__potentialTemplateData, true);
addCollaborators.getChildControl("intro-text").set({
value: this.tr("Make the ") + osparc.product.Utils.getTemplateAlias() + this.tr(" also accessible to:"),
font: "text-14"
});
addCollaborators.getChildControl("share-with").setLabel(this.tr("Publish for..."));
this._add(addCollaborators);

this._add(this.__selectedCollabs);
Expand Down
Loading