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] Connect Anatomical modes to Licensed items #6911

Merged
merged 121 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
80243c8
linting
odeimaiz Dec 5, 2024
52209d7
add listing resource
odeimaiz Dec 5, 2024
806f653
more props
odeimaiz Dec 5, 2024
c20f488
more curated data
odeimaiz Dec 5, 2024
3d4e446
change layout
odeimaiz Dec 5, 2024
ceecb69
refactoring
odeimaiz Dec 5, 2024
9dcd855
[skip ci] show pricing units
odeimaiz Dec 5, 2024
3a98dc5
[skip ci] Show rent buttons
odeimaiz Dec 5, 2024
7e95307
rentAnatomicalModel
odeimaiz Dec 5, 2024
228469b
minors
odeimaiz Dec 5, 2024
5b1ea18
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 6, 2024
a08f4e7
@pcrespov review
odeimaiz Dec 6, 2024
72b1e4f
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 9, 2024
e43dc57
PricingPlan and PricingUnit models
odeimaiz Dec 9, 2024
38cd47e
Pricing own store and models
odeimaiz Dec 9, 2024
cf5c35c
LICENSE
odeimaiz Dec 9, 2024
351fee5
show classification prop
odeimaiz Dec 9, 2024
0f534b9
__addPricingUnitToCache
odeimaiz Dec 9, 2024
c071a48
[skip ci] classification in unit
odeimaiz Dec 9, 2024
5f7ab7b
[skip ci] more refactoring
odeimaiz Dec 9, 2024
eac4e13
[skip ci] refactoring
odeimaiz Dec 9, 2024
c0b74ff
[skip ci] more refactoring
odeimaiz Dec 9, 2024
3339b98
[skip ci] Units List working
odeimaiz Dec 9, 2024
872117d
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 9, 2024
b53a1e2
minor
odeimaiz Dec 9, 2024
0c7a0e9
defaults
odeimaiz Dec 9, 2024
bc7cea9
[skip ci] step by step
odeimaiz Dec 9, 2024
9e4b9aa
edit to root
odeimaiz Dec 9, 2024
721863b
Unit Editor
odeimaiz Dec 9, 2024
48ca364
[skip ci] update plan
odeimaiz Dec 9, 2024
61443d7
plan editor ready
odeimaiz Dec 9, 2024
bc9e8bc
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 9, 2024
993487d
[skip ci] refactor
odeimaiz Dec 9, 2024
829eae9
db layer licensed items purchase
matusdrobuliak66 Dec 9, 2024
973e8b6
[skip ci] enh
odeimaiz Dec 9, 2024
b80e61a
[skip ci] list units
odeimaiz Dec 9, 2024
3487e47
last call to Store
odeimaiz Dec 9, 2024
660d694
fetchPricingPlansService
odeimaiz Dec 9, 2024
d76006c
last call to Store
odeimaiz Dec 9, 2024
ba99088
[skip ci] typo
odeimaiz Dec 9, 2024
2712dfe
minor
odeimaiz Dec 9, 2024
4c0e3c5
Select button
odeimaiz Dec 9, 2024
a975a63
rut part
matusdrobuliak66 Dec 10, 2024
fc62c0d
merge master
matusdrobuliak66 Dec 10, 2024
78ef2cc
renaming tests
matusdrobuliak66 Dec 10, 2024
a6f49cd
rpc interface
matusdrobuliak66 Dec 10, 2024
ff850d2
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 10, 2024
859396f
[skip ci] no hacks
odeimaiz Dec 10, 2024
13d259c
[skip ci] Not a Toggle Button
odeimaiz Dec 10, 2024
bfb0b09
[skip ci] border
odeimaiz Dec 10, 2024
e5f3648
renaming
odeimaiz Dec 10, 2024
7a6c3e4
select and unselect the rest
odeimaiz Dec 10, 2024
7e8355a
[skip ci] show error message
odeimaiz Dec 10, 2024
7109bbb
purchased
odeimaiz Dec 10, 2024
f5de79b
RUT unit tests
matusdrobuliak66 Dec 10, 2024
cda64e2
Import button
odeimaiz Dec 10, 2024
acd4c88
RUT unit tests
matusdrobuliak66 Dec 10, 2024
317cf1d
RUT unit tests
matusdrobuliak66 Dec 10, 2024
16650d8
refactor and 4 tabs
odeimaiz Dec 10, 2024
51c2b28
minor
odeimaiz Dec 10, 2024
bb97dec
all models
odeimaiz Dec 10, 2024
edc2c43
openCategory
odeimaiz Dec 10, 2024
7b742e0
minor
odeimaiz Dec 10, 2024
932fb00
webserver part
matusdrobuliak66 Dec 10, 2024
06f5743
webserver part
matusdrobuliak66 Dec 10, 2024
dbd1ffe
open api specs
matusdrobuliak66 Dec 10, 2024
6bec5ff
webserver part tests
matusdrobuliak66 Dec 10, 2024
754cd58
Merge branch 'master' into introduce-vip-models-pricing-4-part
matusdrobuliak66 Dec 10, 2024
3755dce
open api specs
matusdrobuliak66 Dec 10, 2024
8f264b1
Merge branch 'introduce-vip-models-pricing-4-part' of github.com:matu…
matusdrobuliak66 Dec 10, 2024
4185852
fix type
matusdrobuliak66 Dec 10, 2024
4c31cd0
fix type
matusdrobuliak66 Dec 10, 2024
530fda0
fix type
matusdrobuliak66 Dec 10, 2024
00d40bd
fix type
matusdrobuliak66 Dec 10, 2024
fa3c648
Merge branch 'master' into introduce-vip-models-pricing-4-part
matusdrobuliak66 Dec 10, 2024
256786c
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 10, 2024
12ebf32
Merge branch 'master' into introduce-vip-models-pricing-4-part
matusdrobuliak66 Dec 11, 2024
969f982
review @pcrespov
matusdrobuliak66 Dec 11, 2024
138412e
adding purchase item functionality
matusdrobuliak66 Dec 11, 2024
7e9de14
open api specs
matusdrobuliak66 Dec 11, 2024
4f1c5d6
improve error handling
matusdrobuliak66 Dec 11, 2024
26f9c57
open api specs
matusdrobuliak66 Dec 11, 2024
583b2b4
fix import
matusdrobuliak66 Dec 11, 2024
4a1008f
fix import
matusdrobuliak66 Dec 11, 2024
776806b
fix typecheck
matusdrobuliak66 Dec 11, 2024
fadfa1f
fix typecheck
matusdrobuliak66 Dec 11, 2024
356b3ee
Merge branch 'master' into introduce-vip-models-pricing-4-part
matusdrobuliak66 Dec 11, 2024
eff2f88
fixes @odeimaiz issue
pcrespov Dec 11, 2024
046c628
adds tests
pcrespov Dec 11, 2024
243ad48
types
pcrespov Dec 11, 2024
33f6bfb
fixes OAS
pcrespov Dec 11, 2024
9ef6411
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 11, 2024
6acc12f
Merge branch 'introduce-vip-models-pricing-4-part' of github.com:matu…
odeimaiz Dec 11, 2024
62e0688
services/webserver api version: 0.49.0 → 0.50.0
pcrespov Dec 11, 2024
5fbe4e8
fixes OAS
pcrespov Dec 11, 2024
739fad7
update oas
pcrespov Dec 11, 2024
d25b6f1
Merge branch 'is1779/fixes-master' of github.com:pcrespov/osparc-simc…
odeimaiz Dec 11, 2024
4bc3248
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 11, 2024
3f83740
get purchases
odeimaiz Dec 11, 2024
f23e16f
Merge branch 'enh/list-licensed-items' of github.com:odeimaiz/osparc-…
odeimaiz Dec 11, 2024
d0ba254
numberOfSeats
odeimaiz Dec 11, 2024
cdec8e6
[skip ci] expiration date
odeimaiz Dec 11, 2024
4e9ed4a
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 11, 2024
b10e456
purchases is an Array
odeimaiz Dec 11, 2024
a51c8a1
[skip ci] purchases
odeimaiz Dec 11, 2024
beccf2d
renaming
odeimaiz Dec 11, 2024
40a9b53
aesthetics
odeimaiz Dec 11, 2024
879ebfe
[skip ci] aesthtics
odeimaiz Dec 11, 2024
24b5fcf
minor
odeimaiz Dec 11, 2024
a381ac4
working
odeimaiz Dec 11, 2024
c8ac2bc
Feedback after purchase and hide Import
odeimaiz Dec 11, 2024
fda7fb6
openMarket from sim4life
odeimaiz Dec 11, 2024
7b6e32f
sendImportModelMessage
odeimaiz Dec 11, 2024
07a5547
minor
odeimaiz Dec 11, 2024
134acf0
Import button visibility
odeimaiz Dec 11, 2024
87362a3
gid string to int
odeimaiz Dec 11, 2024
436898e
minor binding
odeimaiz Dec 11, 2024
3f5ab00
get all licensedItems
odeimaiz Dec 11, 2024
0f0c6e4
minor
odeimaiz Dec 11, 2024
e626639
categories
odeimaiz Dec 11, 2024
45d9c21
Merge branch 'master' into enh/list-licensed-items
odeimaiz Dec 11, 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 @@ -1239,6 +1239,23 @@ qx.Class.define("osparc.data.Resources", {
url: statics.API + "/tags/{tagId}"
}
}
},

/*
* MARKET
*/
"market": {
useCache: false,
endpoints: {
get: {
method: "GET",
url: statics.API + "/catalog/licensed-items"
},
purchase: {
method: "GET",
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
url: statics.API + "/catalog/licensed-items/{licensedItemId}:purchase"
},
}
}
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ qx.Class.define("osparc.navigation.UserMenu", {
this.add(control);
break;
}
case "license":
case "license": {
control = new qx.ui.menu.Button(this.tr("License"));
osparc.utils.Utils.setIdToWidget(control, "userMenuLicenseBtn");
const licenseURL = osparc.store.Support.getLicenseURL();
control.addListener("execute", () => window.open(licenseURL));
this.add(control);
break;
}
case "tip-lite-button":
control = new qx.ui.menu.Button(this.tr("Access Full TIP"));
osparc.utils.Utils.setIdToWidget(control, "userMenuAccessTIPBtn");
Expand Down Expand Up @@ -237,7 +238,7 @@ qx.Class.define("osparc.navigation.UserMenu", {
this.addSeparator();

this.__addAnnouncements();

if (osparc.product.Utils.showS4LStore()) {
this.getChildControl("market");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ qx.Class.define("osparc.pricing.UnitsList", {

pricingUnits.forEach(pricingUnit => {
const pUnit = new osparc.study.PricingUnit(pricingUnit).set({
showSpecificInfo: true,
showAwsSpecificInfo: true,
showEditButton: true,
allowGrowY: false
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ qx.Class.define("osparc.study.PricingUnit", {
},

events: {
"editPricingUnit": "qx.event.type.Event"
"editPricingUnit": "qx.event.type.Event",
"rentPricingUnit": "qx.event.type.Event",
},

properties: {
Expand All @@ -42,19 +43,33 @@ qx.Class.define("osparc.study.PricingUnit", {
apply: "__buildLayout"
},

showSpecificInfo: {
showAwsSpecificInfo: {
check: "Boolean",
init: null,
nullable: true,
event: "changeShowSpecificInfo"
event: "changeShowAwsSpecificInfo"
},

showUnitExtraInfo: {
check: "Boolean",
init: true,
nullable: true,
event: "changeShowUnitExtraInfo"
},

showEditButton: {
check: "Boolean",
init: null,
init: false,
nullable: true,
event: "changeShowEditButton"
},

showRentButton: {
check: "Boolean",
init: false,
nullable: true,
event: "changeShowRentButton"
},
},

members: {
Expand All @@ -79,10 +94,24 @@ qx.Class.define("osparc.study.PricingUnit", {
});
this._add(control);
break;
case "unitExtraInfo":
control = new qx.ui.basic.Label().set({
font: "text-13",
rich: true,
});
this._add(control);
break;
case "edit-button":
control = new qx.ui.form.Button(qx.locale.Manager.tr("Edit"));
this._add(control);
break;
case "rent-button":
control = new qx.ui.form.Button(qx.locale.Manager.tr("Rent")).set({
appearance: "strong-button",
center: true,
});
this._add(control);
break;
}
return control || this.base(arguments, id);
},
Expand All @@ -106,17 +135,20 @@ qx.Class.define("osparc.study.PricingUnit", {
pricingUnit.bind("awsSpecificInfo", specificInfo, "value", {
converter: v => qx.locale.Manager.tr("EC2") + ": " + v,
});
this.bind("showSpecificInfo", specificInfo, "visibility", {
this.bind("showAwsSpecificInfo", specificInfo, "visibility", {
converter: show => show ? "visible" : "excluded"
})
}

// add pricing unit extra info
const unitExtraInfo = this.getChildControl("unitExtraInfo");
let text = "";
Object.entries(pricingUnit.getUnitExtraInfo()).forEach(([key, value]) => {
this._add(new qx.ui.basic.Label().set({
value: key + ": " + value,
font: "text-13"
}));
text += `${key}: ${value}<br>`;
});
unitExtraInfo.setValue(text);
this.bind("showUnitExtraInfo", unitExtraInfo, "visibility", {
converter: show => show ? "visible" : "excluded"
});

// add edit button
Expand All @@ -125,6 +157,13 @@ qx.Class.define("osparc.study.PricingUnit", {
converter: show => show ? "visible" : "excluded"
})
editButton.addListener("execute", () => this.fireEvent("editPricingUnit"));

// add rent button
const rentButton = this.getChildControl("rent-button");
this.bind("showRentButton", rentButton, "visibility", {
converter: show => show ? "visible" : "excluded"
})
rentButton.addListener("execute", () => this.fireEvent("rentPricingUnit"));
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
construct: function() {
this.base(arguments);

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

this.__poplulateLayout();
Expand All @@ -46,8 +46,10 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {

const anatomicalModelsData = this.getAnatomicalModelsData();
if (anatomicalModelsData) {
const card = this.__createcCard(anatomicalModelsData);
this._add(card);
const modelInfo = this.__createModelInfo(anatomicalModelsData);
this._add(modelInfo);
const pricingUnits = this.__createPricingUnits(anatomicalModelsData);
this._add(pricingUnits);
} else {
const selectModelLabel = new qx.ui.basic.Label().set({
value: this.tr("Select a model for more details"),
Expand All @@ -61,13 +63,11 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
}
},

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

__createModelInfo: function(anatomicalModelsData) {
const cardGrid = new qx.ui.layout.Grid(16, 16);
const cardLayout = new qx.ui.container.Composite(cardGrid);

const description = anatomicalModelsData["Description"];
const description = anatomicalModelsData["description"];
description.split(" - ").forEach((desc, idx) => {
const titleLabel = new qx.ui.basic.Label().set({
value: desc,
Expand All @@ -85,7 +85,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
});

const thumbnail = new qx.ui.basic.Image().set({
source: anatomicalModelsData["Thumbnail"],
source: anatomicalModelsData["thumbnail"],
alignY: "middle",
scale: true,
allowGrowX: true,
Expand All @@ -100,7 +100,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
row: 2,
});

const features = anatomicalModelsData["Features"];
const features = anatomicalModelsData["features"];
const featuresGrid = new qx.ui.layout.Grid(8, 8);
const featuresLayout = new qx.ui.container.Composite(featuresGrid);
let idx = 0;
Expand All @@ -125,7 +125,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
column: 0,
row: idx,
});

const nameLabel = new qx.ui.basic.Label().set({
value: features[key.toLowerCase()],
font: "text-14",
Expand All @@ -135,7 +135,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
column: 1,
row: idx,
});

idx++;
}
});
Expand Down Expand Up @@ -167,40 +167,42 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
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;
},

__createPricingUnits: function(anatomicalModelsData) {
console.log(anatomicalModelsData);
const pricingUnitsLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
alignX: "center"
}));

const params = {
url: {
pricingPlanId: anatomicalModelsData["pricingPlanId"]
}
};
osparc.data.Resources.fetch("pricingPlans", "getOne", params)
.then(data => {
const pricingUnits = data["pricingUnits"];
pricingUnits.forEach(pricingUnit => {
const pUnit = new osparc.study.PricingUnit(pricingUnit).set({
showAwsSpecificInfo: false,
showUnitExtraInfo: false,
showEditButton: false,
showRentButton: true,
allowGrowY: false
});
pUnit.addListener("rentPricingUnit", () => this.__rentAnatomicalModel(anatomicalModelsData, pricingUnit));
pricingUnitsLayout.add(pUnit);
});
})
.catch(err => console.error(err));

return pricingUnitsLayout;
},

__rentAnatomicalModel: function(anatomicalModelsData, pricingUnit) {
console.log(":puschase", anatomicalModelsData["licensedItemId"], pricingUnit["pricingUnitId"]);
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
},
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelListItem", {
check: "Number",
init: null,
nullable: false,
event: "changemodelId",
event: "changeModelId",
},

thumbnail: {
Expand All @@ -83,6 +83,20 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelListItem", {
event: "changeDate",
},

licensedItemId: {
check: "String",
init: null,
nullable: false,
event: "changeLicensedItemId",
},

pricingPlanId: {
check: "Number",
init: null,
nullable: false,
event: "changePricingPlanId",
},

leased: {
check: "Boolean",
init: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ qx.Class.define("osparc.vipMarket.MarketWindow", {

statics: {
openWindow: function() {
const storeWindow = new osparc.vipMarket.MarketWindow();
storeWindow.center();
storeWindow.open();
return storeWindow;
if (osparc.product.Utils.showS4LStore()) {
const storeWindow = new osparc.vipMarket.MarketWindow();
storeWindow.center();
storeWindow.open();
return storeWindow;
}
return null;
}
},

Expand Down
Loading
Loading