Skip to content

Commit 37921b6

Browse files
committed
My Models
1 parent 862cf06 commit 37921b6

File tree

2 files changed

+24
-31
lines changed

2 files changed

+24
-31
lines changed

services/static-webserver/client/source/class/osparc/study/PricingUnitLicense.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
8888
const nCredits = this.getUnitData().getCost();
8989
const expirationDate = osparc.study.PricingUnitLicense.getExpirationDate();
9090
let msg = this.getUnitData().getName() + this.tr(" will be available until ") + osparc.utils.Utils.formatDate(expirationDate);
91-
msg += "<br>";
92-
msg += `The rental will cost ${nCredits} credits`;
93-
msg += `I hereby accept the Terms and Conditions`;
91+
msg += `<br>The rental will cost ${nCredits} credits`;
92+
msg += `<br>I hereby accept the Terms and Conditions`;
9493
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
9594
caption: this.tr("Rent"),
9695
confirmText: this.tr("Rent"),

services/static-webserver/client/source/class/osparc/vipMarket/Market.js

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ qx.Class.define("osparc.vipMarket.Market", {
5050
},
5151

5252
members: {
53-
__purchasedCategoryButton: null,
54-
__purchasedCategoryMarket: null,
53+
__myModelsCategoryMarket: null,
54+
__myModelsCategoryButton: null,
5555

5656
__populateCategories: function(openCategory) {
5757
const store = osparc.store.Store.getInstance();
@@ -68,18 +68,18 @@ qx.Class.define("osparc.vipMarket.Market", {
6868
const purchasedItems = values[1];
6969
osparc.store.LicensedItems.populateSeatsFromPurchases(licensedItems, purchasedItems);
7070
const categories = [];
71-
const purchasedCategory = {
72-
categoryId: "purchasedModels",
73-
label: this.tr("Rented"),
71+
const availableCategory = {
72+
categoryId: "availableModels",
73+
label: this.tr("My Models"),
7474
icon: "osparc/market/RentedModels.svg",
7575
items: [],
7676
};
77-
categories.push(purchasedCategory);
77+
categories.push(availableCategory);
7878
licensedItems.forEach(licensedItem => {
7979
if (licensedItem["seats"].length) {
80-
purchasedCategory["items"].push(licensedItem);
80+
availableCategory["items"].push(licensedItem);
8181
if (!openCategory) {
82-
openCategory = purchasedCategory["categoryId"];
82+
openCategory = availableCategory["categoryId"];
8383
}
8484
}
8585
if (licensedItem && licensedItem["categoryId"]) {
@@ -109,29 +109,22 @@ qx.Class.define("osparc.vipMarket.Market", {
109109
this.__openCategory(openCategory);
110110
}
111111

112-
this.__addFreeCategory();
112+
this.__addFreeItems();
113113
});
114114
},
115115

116-
__addFreeCategory: function() {
117-
const freeCategory = {
118-
categoryId: "freeModels",
119-
label: this.tr("Open Access Models"),
120-
icon: "osparc/market/RentedModels.svg",
121-
items: [],
122-
};
116+
__addFreeItems: function() {
123117
const licensedItemsStore = osparc.store.LicensedItems.getInstance();
124118
licensedItemsStore.getLicensedItems()
125119
.then(async licensedItems => {
120+
this.__freeItems = [];
126121
for (const licensedItem of licensedItems) {
127122
const pricingUnits = await osparc.store.Pricing.getInstance().fetchPricingUnits(licensedItem["pricingPlanId"]);
128123
if (pricingUnits.length === 1 && pricingUnits[0].getCost() === 0) {
129-
freeCategory["items"].push(licensedItem);
124+
this.__freeItems.push(licensedItem);
130125
}
131126
}
132-
if (freeCategory["items"].length) {
133-
this.__buildViPMarketPage(freeCategory, freeCategory["items"]);
134-
}
127+
this.__repopulateMyModelsCategory();
135128
});
136129
},
137130

@@ -141,19 +134,19 @@ qx.Class.define("osparc.vipMarket.Market", {
141134
category: marketTabInfo["categoryId"],
142135
});
143136
this.bind("openBy", vipMarketView, "openBy");
144-
vipMarketView.addListener("modelPurchased", () => this.__repopulatePurchasedCategory());
137+
vipMarketView.addListener("modelPurchased", () => this.__repopulateMyModelsCategory());
145138
vipMarketView.addListener("importMessageSent", () => this.fireEvent("importMessageSent"));
146139
const page = this.addTab(marketTabInfo["label"], marketTabInfo["icon"], vipMarketView);
147140
page.category = marketTabInfo["categoryId"];
148-
if (page.category === "purchasedModels") {
149-
this.__purchasedCategoryMarket = vipMarketView;
150-
this.__purchasedCategoryButton = page.getChildControl("button");
151-
this.__purchasedCategoryButton.setVisibility(licensedItems.length ? "visible" : "excluded");
141+
if (page.category === "availableModels") {
142+
this.__myModelsCategoryMarket = vipMarketView;
143+
this.__myModelsCategoryButton = page.getChildControl("button");
144+
this.__myModelsCategoryButton.setVisibility(licensedItems.length ? "visible" : "excluded");
152145
}
153146
return page;
154147
},
155148

156-
__repopulatePurchasedCategory: function() {
149+
__repopulateMyModelsCategory: function() {
157150
const store = osparc.store.Store.getInstance();
158151
const contextWallet = store.getContextWallet();
159152
const walletId = contextWallet.getWalletId();
@@ -172,8 +165,9 @@ qx.Class.define("osparc.vipMarket.Market", {
172165
items.push(licensedItem);
173166
}
174167
});
175-
this.__purchasedCategoryButton.setVisibility(items.length ? "visible" : "excluded");
176-
this.__purchasedCategoryMarket.setLicensedItems(items);
168+
items = items.concat(this.__freeItems);
169+
this.__myModelsCategoryButton.setVisibility(items.length ? "visible" : "excluded");
170+
this.__myModelsCategoryMarket.setLicensedItems(items);
177171
});
178172
},
179173

0 commit comments

Comments
 (0)