Skip to content

Commit 4ccc6cc

Browse files
authored
Merge branch 'master' into mai/upgrade-catalog
2 parents 6f1519e + 0c5a068 commit 4ccc6cc

File tree

10 files changed

+832
-0
lines changed

10 files changed

+832
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ qx.Class.define("osparc.dashboard.SortedByMenuButton", {
6565
field: "last_change_date",
6666
direction: "desc"
6767
},
68+
6869
getSortByOptions: function() {
6970
return [{
7071
id: "name",

services/static-webserver/client/source/class/osparc/data/Resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ qx.Class.define("osparc.data.Resources", {
9898
* added by oSPARC as compilation vars
9999
*/
100100
"appSummary": {
101+
useCache: false,
101102
endpoints: {
102103
get: {
103104
method: "GET",

services/static-webserver/client/source/class/osparc/navigation/UserMenu.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
103103
control.addListener("execute", () => osparc.cluster.Utils.popUpClustersDetails(), this);
104104
this.add(control);
105105
break;
106+
case "market":
107+
control = new qx.ui.menu.Button(this.tr("Market"));
108+
control.addListener("execute", () => osparc.vipMarket.MarketWindow.openWindow());
109+
this.add(control);
110+
break;
106111
case "about":
107112
control = new qx.ui.menu.Button(this.tr("About oSPARC"));
108113
osparc.utils.Utils.setIdToWidget(control, "userMenuAboutBtn");
@@ -178,6 +183,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
178183
this.addSeparator();
179184

180185
this.__addAnnouncements();
186+
187+
if (osparc.product.Utils.showS4LStore()) {
188+
this.getChildControl("market");
189+
}
190+
181191
this.getChildControl("about");
182192
if (osparc.product.Utils.showAboutProduct()) {
183193
this.getChildControl("about-product");
@@ -241,6 +251,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
241251
this.addSeparator();
242252

243253
this.__addAnnouncements();
254+
255+
if (osparc.product.Utils.showS4LStore()) {
256+
this.getChildControl("market");
257+
}
258+
244259
this.getChildControl("about");
245260
if (!osparc.product.Utils.isProduct("osparc")) {
246261
this.getChildControl("about-product");

services/static-webserver/client/source/class/osparc/product/Utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ qx.Class.define("osparc.product.Utils", {
270270
return true;
271271
},
272272

273+
showS4LStore: function() {
274+
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
275+
if (platformName !== "master") {
276+
return false;
277+
}
278+
return this.isS4LProduct();
279+
},
280+
273281
getProductThumbUrl: function(asset = "Default.png") {
274282
const base = "https://raw.githubusercontent.com/ZurichMedTech/s4l-assets/main/app/full/project_thumbnails"
275283
let url;
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
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.vipMarket.AnatomicalModelDetails", {
19+
extend: qx.ui.core.Widget,
20+
21+
construct: function() {
22+
this.base(arguments);
23+
24+
const layout = new qx.ui.layout.Grow();
25+
this._setLayout(layout);
26+
27+
this.__poplulateLayout();
28+
},
29+
30+
events: {
31+
"modelLeased": "qx.event.type.Event",
32+
},
33+
34+
properties: {
35+
anatomicalModelsData: {
36+
check: "Object",
37+
init: null,
38+
nullable: true,
39+
apply: "__poplulateLayout"
40+
},
41+
},
42+
43+
members: {
44+
__poplulateLayout: function() {
45+
this._removeAll();
46+
47+
const anatomicalModelsData = this.getAnatomicalModelsData();
48+
if (anatomicalModelsData) {
49+
const card = this.__createcCard(anatomicalModelsData);
50+
this._add(card);
51+
} else {
52+
const selectModelLabel = new qx.ui.basic.Label().set({
53+
value: this.tr("Select a model for more details"),
54+
font: "text-16",
55+
alignX: "center",
56+
alignY: "middle",
57+
allowGrowX: true,
58+
allowGrowY: true,
59+
});
60+
this._add(selectModelLabel);
61+
}
62+
},
63+
64+
__createcCard: function(anatomicalModelsData) {
65+
console.log(anatomicalModelsData);
66+
67+
const cardGrid = new qx.ui.layout.Grid(16, 16);
68+
const cardLayout = new qx.ui.container.Composite(cardGrid);
69+
70+
const description = anatomicalModelsData["Description"];
71+
description.split(" - ").forEach((desc, idx) => {
72+
const titleLabel = new qx.ui.basic.Label().set({
73+
value: desc,
74+
font: "text-16",
75+
alignX: "center",
76+
alignY: "middle",
77+
allowGrowX: true,
78+
allowGrowY: true,
79+
});
80+
cardLayout.add(titleLabel, {
81+
column: 0,
82+
row: idx,
83+
colSpan: 2,
84+
});
85+
});
86+
87+
const thumbnail = new qx.ui.basic.Image().set({
88+
source: anatomicalModelsData["Thumbnail"],
89+
alignY: "middle",
90+
scale: true,
91+
allowGrowX: true,
92+
allowGrowY: true,
93+
allowShrinkX: true,
94+
allowShrinkY: true,
95+
maxWidth: 256,
96+
maxHeight: 256,
97+
});
98+
cardLayout.add(thumbnail, {
99+
column: 0,
100+
row: 2,
101+
});
102+
103+
const features = anatomicalModelsData["Features"];
104+
const featuresGrid = new qx.ui.layout.Grid(8, 8);
105+
const featuresLayout = new qx.ui.container.Composite(featuresGrid);
106+
let idx = 0;
107+
[
108+
"Name",
109+
"Version",
110+
"Sex",
111+
"Age",
112+
"Weight",
113+
"Height",
114+
"Date",
115+
"Ethnicity",
116+
"Functionality",
117+
].forEach(key => {
118+
if (key.toLowerCase() in features) {
119+
const titleLabel = new qx.ui.basic.Label().set({
120+
value: key,
121+
font: "text-14",
122+
alignX: "right",
123+
});
124+
featuresLayout.add(titleLabel, {
125+
column: 0,
126+
row: idx,
127+
});
128+
129+
const nameLabel = new qx.ui.basic.Label().set({
130+
value: features[key.toLowerCase()],
131+
font: "text-14",
132+
alignX: "left",
133+
});
134+
featuresLayout.add(nameLabel, {
135+
column: 1,
136+
row: idx,
137+
});
138+
139+
idx++;
140+
}
141+
});
142+
143+
const doiTitle = new qx.ui.basic.Label().set({
144+
value: "DOI",
145+
font: "text-14",
146+
alignX: "right",
147+
marginTop: 16,
148+
});
149+
featuresLayout.add(doiTitle, {
150+
column: 0,
151+
row: idx,
152+
});
153+
154+
const doiValue = new qx.ui.basic.Label().set({
155+
value: anatomicalModelsData["DOI"] ? anatomicalModelsData["DOI"] : "-",
156+
font: "text-14",
157+
alignX: "left",
158+
marginTop: 16,
159+
});
160+
featuresLayout.add(doiValue, {
161+
column: 1,
162+
row: idx,
163+
});
164+
165+
cardLayout.add(featuresLayout, {
166+
column: 1,
167+
row: 2,
168+
});
169+
170+
const buttonsLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
171+
if (anatomicalModelsData["leased"]) {
172+
const leaseModelButton = new qx.ui.form.Button().set({
173+
label: this.tr("3 seats Leased (27 days left)"),
174+
appearance: "strong-button",
175+
center: true,
176+
enabled: false,
177+
});
178+
buttonsLayout.add(leaseModelButton, {
179+
flex: 1
180+
});
181+
}
182+
const leaseModelButton = new osparc.ui.form.FetchButton().set({
183+
label: this.tr("Lease model (2 for months)"),
184+
appearance: "strong-button",
185+
center: true,
186+
});
187+
leaseModelButton.addListener("execute", () => {
188+
leaseModelButton.setFetching(true);
189+
setTimeout(() => {
190+
leaseModelButton.setFetching(false);
191+
this.fireDataEvent("modelLeased", this.getAnatomicalModelsData()["ID"]);
192+
}, 2000);
193+
});
194+
buttonsLayout.add(leaseModelButton, {
195+
flex: 1
196+
});
197+
cardLayout.add(buttonsLayout, {
198+
column: 0,
199+
row: 3,
200+
colSpan: 2,
201+
});
202+
203+
return cardLayout;
204+
},
205+
}
206+
});

0 commit comments

Comments
 (0)