@@ -46,6 +46,9 @@ qx.Class.define("osparc.vipStore.VIPStore", {
4646 } else {
4747 curatedModel [ key ] = model [ key ] ;
4848 }
49+ if ( key === "ID" && [ 22 ] . includes ( model [ key ] ) ) {
50+ curatedModel [ "leased" ] = true ;
51+ }
4952 } ) ;
5053 anatomicalModels . push ( curatedModel ) ;
5154 } ) ;
@@ -58,7 +61,7 @@ qx.Class.define("osparc.vipStore.VIPStore", {
5861 __anatomicalModels : null ,
5962 __sortByButton : null ,
6063
61- __buildLayout : async function ( ) {
64+ __buildLayout : function ( ) {
6265 const toolbarLayout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 10 ) ) . set ( {
6366 alignY : "middle" ,
6467 // maxHeight: 30
@@ -101,10 +104,23 @@ qx.Class.define("osparc.vipStore.VIPStore", {
101104 ctrl . bindProperty ( "thumbnail" , "thumbnail" , null , item , id ) ;
102105 ctrl . bindProperty ( "name" , "name" , null , item , id ) ;
103106 ctrl . bindProperty ( "date" , "date" , null , item , id ) ;
107+ ctrl . bindProperty ( "leased" , "leased" , null , item , id ) ;
104108 } ,
105109 configureItem : item => {
106110 item . subscribeToFilterGroup ( "vipModels" ) ;
107111 } ,
112+ group : model => {
113+ return model . getLeased ? model . getLeased ( ) : null ;
114+ } ,
115+ createGroupItem ( ) {
116+ return new qx . ui . form . ListItem ( ) ;
117+ } ,
118+ configureGroupItem : item => {
119+ item . setBackgroundColor ( "strong-color" ) ;
120+ } ,
121+ bindGroupItem : ( controller , item , id ) => {
122+ controller . bindProperty ( null , "leased" , null , item , id ) ;
123+ } ,
108124 } ) ;
109125
110126 const loadingModel = {
@@ -134,12 +150,15 @@ qx.Class.define("osparc.vipStore.VIPStore", {
134150 anatomicModelDetails . setAnatomicalModelsData ( null ) ;
135151 } , this ) ;
136152
137- // fetch data
138- const resp = await fetch ( "https://itis.swiss/PD_DirectDownload/getDownloadableItems/AnatomicalModels" , { method :"POST" } ) ;
139- const anatomicalModelsRaw = await resp . json ( ) ;
140- this . __anatomicalModels = this . self ( ) . curateAnatomicalModels ( anatomicalModelsRaw ) ;
141-
142- this . __populateModels ( ) ;
153+ fetch ( "https://itis.swiss/PD_DirectDownload/getDownloadableItems/AnatomicalModels" , {
154+ method :"POST"
155+ } )
156+ . then ( resp => resp . json ( ) )
157+ . then ( anatomicalModelsRaw => {
158+ this . __anatomicalModels = this . self ( ) . curateAnatomicalModels ( anatomicalModelsRaw ) ;
159+ this . __populateModels ( ) ;
160+ } )
161+ . catch ( err => console . error ( err ) ) ;
143162 } ,
144163
145164 __populateModels : function ( ) {
0 commit comments