@@ -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