Skip to content

Commit

Permalink
Merge branch 'master' into team-black-feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jsaq007 committed Apr 2, 2024
2 parents 06751a9 + fe91a2d commit b897154
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ qx.Class.define("osparc.Application", {
if (osparc.NewRelease.firstTimeISeeThisFrontend()) {
const newRelease = new osparc.NewRelease();
const title = this.tr("New Release");
const win = osparc.ui.window.Window.popUpInWindow(newRelease, title, 350, 130).set({
const win = osparc.ui.window.Window.popUpInWindow(newRelease, title, 350, 135).set({
clickAwayClose: false,
resizable: false,
showClose: true
Expand Down
19 changes: 8 additions & 11 deletions services/static-webserver/client/source/class/osparc/NewRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,20 @@ qx.Class.define("osparc.NewRelease", {
__buildLayout: function() {
const introText = qx.locale.Manager.tr("We are pleased to announce that some new features were deployed for you!");
const introLabel = new qx.ui.basic.Label(introText).set({
font: "text-14",
rich: true,
wrap: true
});
this._add(introLabel);

const detailsText = this.tr("What's new");
// old commit link
const link = osparc.utils.LibVersions.getVcsRefUrl();
const linkLabel = new osparc.ui.basic.LinkLabel(detailsText, link);
this._add(linkLabel);
const rData = osparc.store.StaticInfo.getInstance().getReleaseData();
if (rData) {
const releaseUrl = rData["url"];
if (releaseUrl) {
linkLabel.setUrl(releaseUrl);
}
}
const url = rData["url"] || osparc.utils.LibVersions.getVcsRefUrl();
const linkLabel = new osparc.ui.basic.LinkLabel().set({
value: this.tr("What's new"),
url,
font: "link-label-14"
});
this._add(linkLabel);
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -317,28 +317,17 @@ qx.Class.define("osparc.auth.LoginPage", {
const versionLink = new osparc.ui.basic.LinkLabel().set({
textColor: "text-darker"
});
const staticInfo = osparc.store.StaticInfo.getInstance();
const rData = staticInfo.getReleaseData();
if (rData) {
const releaseDate = rData["date"];
const releaseTag = rData["tag"];
const releaseUrl = rData["url"];
if (releaseDate && releaseTag && releaseUrl) {
const date = osparc.utils.Utils.formatDate(new Date(releaseDate));
versionLink.set({
value: date + " (" + releaseTag + ")&nbsp",
url: releaseUrl
});
}
} else {
// fallback to old style
const platformVersion = osparc.utils.LibVersions.getPlatformVersion();
versionLink.setUrl(platformVersion.url);
let text = platformVersion.name + " " + platformVersion.version;
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
text += platformName.length ? ` (${platformName})` : " (production)";
versionLink.setValue(text);
}
const rData = osparc.store.StaticInfo.getInstance().getReleaseData();
const platformVersion = osparc.utils.LibVersions.getPlatformVersion();
let text = "osparc-simcore ";
text += (rData["tag"] && rData["tag"] !== "latest") ? rData["tag"] : platformVersion.version;
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
text += platformName.length ? ` (${platformName})` : "";
const url = rData["url"] || osparc.utils.LibVersions.getVcsRefUrl();
versionLink.set({
value: text,
url
});
versionLinkLayout.add(versionLink);

const organizationLink = new osparc.ui.basic.LinkLabel().set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
// add Open service button
[
this.__getInfoPage,
this.__getBillingSettings,
this.__getBillingPage,
this.__getServicesUpdatePage,
this.__getServicesBootOptionsPage,
this.__getDataPage,
Expand Down Expand Up @@ -370,25 +370,34 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
return page;
},

__getBillingSettings: function() {
const resourceData = this.__resourceData;
if (
!osparc.utils.Resources.isStudy(resourceData) ||
!osparc.desktop.credits.Utils.areWalletsEnabled()
) {
__getBillingPage: function() {
if (!osparc.desktop.credits.Utils.areWalletsEnabled()) {
return null;
}

const id = "Billing";
const title = this.tr("Billing Settings");
const iconSrc = "@FontAwesome5Solid/cogs/22";

const billingSettings = new osparc.study.BillingSettings(resourceData);
const page = this.__billingSettings = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
const billingScroll = new qx.ui.container.Scroll(billingSettings);
this.__addOpenButton(page);
page.addToContent(billingScroll);
return page;
const resourceData = this.__resourceData;
if (osparc.utils.Resources.isStudy(resourceData)) {
const id = "Billing";
const title = this.tr("Billing Settings");
const iconSrc = "@FontAwesome5Solid/cogs/22";
const billingSettings = new osparc.study.BillingSettings(resourceData);
const page = this.__billingSettings = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
const billingScroll = new qx.ui.container.Scroll(billingSettings);
this.__addOpenButton(page);
page.addToContent(billingScroll);
return page;
} else if (osparc.utils.Resources.isService(resourceData)) {
const id = "Tiers";
const title = this.tr("Tiers");
const iconSrc = "@FontAwesome5Solid/server/22";
const pricingUnitsList = new osparc.service.PricingUnitsList(resourceData);
const page = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
const pricingUnitsListScroll = new qx.ui.container.Scroll(pricingUnitsList);
this.__addOpenButton(page);
page.addToContent(pricingUnitsListScroll);
return page;
}
return null;
},

__getPreviewPage: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ qx.Class.define("osparc.info.ServiceLarge", {
_rebuildLayout: function() {
this._removeAll();

const vBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(15));

const deprecated = this.__createDeprecated();
if (deprecated) {
this._add(deprecated);
vBox.add(deprecated);
}

const title = this.__createTitle();
const titleLayout = this.__createViewWithEdit(title, this.__openTitleEditor);
this._add(titleLayout);
vBox.add(titleLayout);

const extraInfo = this.__extraInfo();
const extraInfoLayout = this.__createExtraInfo(extraInfo);
Expand All @@ -114,28 +116,27 @@ qx.Class.define("osparc.info.ServiceLarge", {
hBox.add(thumbnailLayout, {
flex: 1
});
this._add(hBox);
vBox.add(hBox);

const description = this.__createDescription();
const editInTitle = this.__createViewWithEdit(description.getChildren()[0], this.__openDescriptionEditor);
description.addAt(editInTitle, 0);
this._add(description);
vBox.add(description);

const resources = this.__createResources();
this._add(resources);
vBox.add(resources);

const rawMetadata = this.__createRawMetadata();
const more = new osparc.desktop.PanelView(this.tr("Raw metadata"), rawMetadata).set({
caretSize: 14
const copyMetadataButton = new qx.ui.form.Button(this.tr("Copy Raw metadata"), "@FontAwesome5Solid/copy/12").set({
allowGrowX: false
});
more.setCollapsed(true);
more.getChildControl("title").setFont("text-12");
this._add(more, {
copyMetadataButton.addListener("execute", () => osparc.utils.Utils.copyTextToClipboard(osparc.utils.Utils.prettifyJson(this.getService())), this);
vBox.add(copyMetadataButton);

const scrollContainer = new qx.ui.container.Scroll();
scrollContainer.add(vBox);
this._add(scrollContainer, {
flex: 1
});
const copy2Clip = osparc.utils.Utils.getCopyButton();
copy2Clip.addListener("execute", () => osparc.utils.Utils.copyTextToClipboard(osparc.utils.Utils.prettifyJson(this.getService())), this);
more.getChildControl("header").add(copy2Clip);
},

__createViewWithEdit: function(view, cb) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* ************************************************************************
osparc - the simcore frontend
https://osparc.io
Copyright:
2024 IT'IS Foundation, https://itis.swiss
License:
MIT: https://opensource.org/licenses/MIT
Authors:
* Odei Maiz (odeimaiz)
************************************************************************ */

qx.Class.define("osparc.service.PricingUnitsList", {
extend: qx.ui.core.Widget,

construct: function(serviceMetadata) {
this.base(arguments);

this.__serviceMetadata = serviceMetadata;

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

this.getChildControl("pricing-units-container");

this.__fetchUnits();
},

members: {
__serviceMetadata: null,

_createChildControlImpl: function(id) {
let control;
switch (id) {
case "pricing-units-container":
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
this._addAt(control, 0, {
flex: 1
});
break;
}
return control || this.base(arguments, id);
},

__fetchUnits: function() {
const plansParams = {
url: osparc.data.Resources.getServiceUrl(
this.__serviceMetadata["key"],
this.__serviceMetadata["version"]
)
};
osparc.data.Resources.fetch("services", "pricingPlans", plansParams)
.then(data => this.__populateList(data["pricingUnits"]))
.catch(err => {
console.error(err);
this.__populateList([]);
});
},

__populateList: function(pricingUnits) {
this.getChildControl("pricing-units-container").removeAll();

if (pricingUnits.length === 0) {
const notFound = new qx.ui.basic.Label().set({
value: this.tr("No Tiers found"),
font: "text-14"
});
this.getChildControl("pricing-units-container").add(notFound);
return;
}

pricingUnits.forEach(pricingUnit => {
const pUnit = new osparc.study.PricingUnit(pricingUnit).set({
advanced: true,
allowGrowY: false
});
this.getChildControl("pricing-units-container").add(pUnit);
});
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,14 @@ qx.Class.define("osparc.store.StaticInfo", {

getReleaseData: function() {
const rTag = this.getValue("vcsReleaseTag");
const rDate = this.getValue("vcsReleaseDate");
const rUrl = this.getValue("vcsReleaseUrl");
if (rTag && rDate && rUrl) {
return {
"tag": rTag,
"date": rDate,
"url": rUrl
};
}
return null;
return {
"tag": rTag,
"url": rUrl
};
},


getMaxNumberDyNodes: function() {
const staticKey = "webserverProjects";
const wsStaticData = this.getValue(staticKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ qx.Class.define("osparc.utils.LibVersions", {
getPlatformVersion: function() {
const name = "osparc-simcore";
const commitId = this.getVcsRef();
const remoteUrl = this.getVcsRefUrl();
const url = this.getVcsRefUrl();

return {
name: name,
version: commitId ? commitId : "",
url: remoteUrl
name,
version: commitId ? commitId.slice(0, 7) : "",
url
};
},

getUIVersion: function() {
let name = "osparc-simcore UI";
const commitId = this.getVcsRefUI();
const remoteUrl = this.getVcsRefUIUrl();
const url = this.getVcsRefUIUrl();
let status = qx.core.Environment.get("osparc.vcsStatusClient");
if (status) {
name = name + " [" + status + "]";
Expand All @@ -84,7 +84,7 @@ qx.Class.define("osparc.utils.LibVersions", {
return {
name: name,
version: commitId,
url: remoteUrl
url
};
},

Expand Down Expand Up @@ -125,21 +125,6 @@ qx.Class.define("osparc.utils.LibVersions", {
return libs;
},

getEnvLibs: function() {
let libs = [];
[
osparc.utils.LibVersions.getPlatformVersion,
osparc.utils.LibVersions.getUIVersion,
osparc.utils.LibVersions.getQxCompiler,
osparc.utils.LibVersions.getQxLibraryInfoMap,
osparc.utils.LibVersions.get3rdPartyLibs
].forEach(lib => {
libs = libs.concat(lib.call(this));
}, this);

return libs;
},

getBackendLibs: function() {
const statics = osparc.store.Store.getInstance().get("statics");
if ("thirdPartyReferences" in statics) {
Expand Down

0 comments on commit b897154

Please sign in to comment.