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] VIP Market PoC #6862

Merged
merged 39 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c1762e2
VIP Store
odeimaiz Nov 27, 2024
cf85791
open vip store
odeimaiz Nov 27, 2024
f5d6651
minor
odeimaiz Nov 27, 2024
52fc036
list models
odeimaiz Nov 27, 2024
2745cf6
minor
odeimaiz Nov 27, 2024
ae78894
minor
odeimaiz Nov 27, 2024
81e050c
parse Features
odeimaiz Nov 28, 2024
8d6ef13
Details
odeimaiz Nov 28, 2024
6914ccb
working
odeimaiz Nov 28, 2024
d72a8ee
sorted with thumbnail
odeimaiz Nov 28, 2024
c1c8ff4
aesthetics
odeimaiz Nov 28, 2024
59393e8
showS4LStore
odeimaiz Nov 28, 2024
8afdcae
minor
odeimaiz Nov 28, 2024
7905a98
Tabbed View
odeimaiz Nov 28, 2024
32eff5f
loading
odeimaiz Nov 28, 2024
ab2c4f6
filter and sort buttons
odeimaiz Nov 28, 2024
ed7e173
filter working
odeimaiz Nov 28, 2024
e14cd4b
sorting
odeimaiz Nov 28, 2024
860e167
leased
odeimaiz Nov 28, 2024
08500ff
leased
odeimaiz Nov 28, 2024
f6acefb
backgroundColor
odeimaiz Nov 28, 2024
b4ae1af
minor
odeimaiz Nov 28, 2024
787decf
sorting
odeimaiz Nov 28, 2024
b92d042
sort wokrs
odeimaiz Nov 28, 2024
160b190
fixed
odeimaiz Nov 28, 2024
6b24ef5
comment
odeimaiz Nov 28, 2024
52fc81c
"modelLeased"
odeimaiz Nov 28, 2024
c05ab72
aesthetics
odeimaiz Nov 28, 2024
d77c9da
minor
odeimaiz Nov 28, 2024
ec239a2
Merge branch 'master' into feature/vip-store
odeimaiz Nov 28, 2024
4c227fc
Merge branch 'master' into feature/vip-store
odeimaiz Nov 29, 2024
4b79bb0
vipStore -> vipMarket
odeimaiz Nov 29, 2024
ac98719
aesthetics
odeimaiz Nov 29, 2024
380968b
renaming
odeimaiz Nov 29, 2024
19cb202
Merge branch 'master' into feature/vip-store
odeimaiz Nov 29, 2024
641a724
minor
odeimaiz Nov 29, 2024
e91a2d3
Merge branch 'feature/vip-store' of github.com:odeimaiz/osparc-simcor…
odeimaiz Nov 29, 2024
8a317f9
Merge branch 'master' into feature/vip-store
odeimaiz Dec 2, 2024
7ca531f
Merge branch 'master' into feature/vip-store
odeimaiz Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ qx.Class.define("osparc.dashboard.SortedByMenuButton", {
field: "last_change_date",
direction: "desc"
},

getSortByOptions: function() {
return [{
id: "name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ qx.Class.define("osparc.data.Resources", {
* added by oSPARC as compilation vars
*/
"appSummary": {
useCache: false,
endpoints: {
get: {
method: "GET",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
control.addListener("execute", () => osparc.cluster.Utils.popUpClustersDetails(), this);
this.add(control);
break;
case "market":
control = new qx.ui.menu.Button(this.tr("Market"));
control.addListener("execute", () => osparc.vipMarket.MarketWindow.openWindow());
this.add(control);
break;
case "about":
control = new qx.ui.menu.Button(this.tr("About oSPARC"));
osparc.utils.Utils.setIdToWidget(control, "userMenuAboutBtn");
Expand Down Expand Up @@ -178,6 +183,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
this.addSeparator();

this.__addAnnouncements();

if (osparc.product.Utils.showS4LStore()) {
this.getChildControl("market");
}

this.getChildControl("about");
if (osparc.product.Utils.showAboutProduct()) {
this.getChildControl("about-product");
Expand Down Expand Up @@ -241,6 +251,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
this.addSeparator();

this.__addAnnouncements();

if (osparc.product.Utils.showS4LStore()) {
this.getChildControl("market");
}

this.getChildControl("about");
if (!osparc.product.Utils.isProduct("osparc")) {
this.getChildControl("about-product");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ qx.Class.define("osparc.product.Utils", {
return true;
},

showS4LStore: function() {
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
if (platformName !== "master") {
return false;
}
return this.isS4LProduct();
},

getProductThumbUrl: function(asset = "Default.png") {
const base = "https://raw.githubusercontent.com/ZurichMedTech/s4l-assets/main/app/full/project_thumbnails"
let url;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
/* ************************************************************************

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.vipMarket.AnatomicalModelDetails", {
extend: qx.ui.core.Widget,

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

const layout = new qx.ui.layout.Grow();
this._setLayout(layout);

this.__poplulateLayout();
},

events: {
"modelLeased": "qx.event.type.Event",
},

properties: {
anatomicalModelsData: {
check: "Object",
init: null,
nullable: true,
apply: "__poplulateLayout"
},
},

members: {
__poplulateLayout: function() {
this._removeAll();

const anatomicalModelsData = this.getAnatomicalModelsData();
if (anatomicalModelsData) {
const card = this.__createcCard(anatomicalModelsData);
this._add(card);
} else {
const selectModelLabel = new qx.ui.basic.Label().set({
value: this.tr("Select a model for more details"),
font: "text-16",
alignX: "center",
alignY: "middle",
allowGrowX: true,
allowGrowY: true,
});
this._add(selectModelLabel);
}
},

__createcCard: function(anatomicalModelsData) {
console.log(anatomicalModelsData);

const cardGrid = new qx.ui.layout.Grid(16, 16);
const cardLayout = new qx.ui.container.Composite(cardGrid);

const description = anatomicalModelsData["Description"];
description.split(" - ").forEach((desc, idx) => {
const titleLabel = new qx.ui.basic.Label().set({
value: desc,
font: "text-16",
alignX: "center",
alignY: "middle",
allowGrowX: true,
allowGrowY: true,
});
cardLayout.add(titleLabel, {
column: 0,
row: idx,
colSpan: 2,
});
});

const thumbnail = new qx.ui.basic.Image().set({
source: anatomicalModelsData["Thumbnail"],
alignY: "middle",
scale: true,
allowGrowX: true,
allowGrowY: true,
allowShrinkX: true,
allowShrinkY: true,
maxWidth: 256,
maxHeight: 256,
});
cardLayout.add(thumbnail, {
column: 0,
row: 2,
});

const features = anatomicalModelsData["Features"];
const featuresGrid = new qx.ui.layout.Grid(8, 8);
const featuresLayout = new qx.ui.container.Composite(featuresGrid);
let idx = 0;
[
"Name",
"Version",
"Sex",
"Age",
"Weight",
"Height",
"Date",
"Ethnicity",
"Functionality",
].forEach(key => {
if (key.toLowerCase() in features) {
const titleLabel = new qx.ui.basic.Label().set({
value: key,
font: "text-14",
alignX: "right",
});
featuresLayout.add(titleLabel, {
column: 0,
row: idx,
});

const nameLabel = new qx.ui.basic.Label().set({
value: features[key.toLowerCase()],
font: "text-14",
alignX: "left",
});
featuresLayout.add(nameLabel, {
column: 1,
row: idx,
});

idx++;
}
});

const doiTitle = new qx.ui.basic.Label().set({
value: "DOI",
font: "text-14",
alignX: "right",
marginTop: 16,
});
featuresLayout.add(doiTitle, {
column: 0,
row: idx,
});

const doiValue = new qx.ui.basic.Label().set({
value: anatomicalModelsData["DOI"] ? anatomicalModelsData["DOI"] : "-",
font: "text-14",
alignX: "left",
marginTop: 16,
});
featuresLayout.add(doiValue, {
column: 1,
row: idx,
});

cardLayout.add(featuresLayout, {
column: 1,
row: 2,
});

const buttonsLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
if (anatomicalModelsData["leased"]) {
const leaseModelButton = new qx.ui.form.Button().set({
label: this.tr("3 seats Leased (27 days left)"),
appearance: "strong-button",
center: true,
enabled: false,
});
buttonsLayout.add(leaseModelButton, {
flex: 1
});
}
const leaseModelButton = new osparc.ui.form.FetchButton().set({
label: this.tr("Lease model (2 for months)"),
appearance: "strong-button",
center: true,
});
leaseModelButton.addListener("execute", () => {
leaseModelButton.setFetching(true);
setTimeout(() => {
leaseModelButton.setFetching(false);
this.fireDataEvent("modelLeased", this.getAnatomicalModelsData()["ID"]);
}, 2000);
});
buttonsLayout.add(leaseModelButton, {
flex: 1
});
cardLayout.add(buttonsLayout, {
column: 0,
row: 3,
colSpan: 2,
});

return cardLayout;
},
}
});
Loading
Loading