Skip to content

Commit 860e167

Browse files
committed
leased
1 parent e14cd4b commit 860e167

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

services/static-webserver/client/source/class/osparc/vipStore/AnatomicalModelListItem.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ qx.Class.define("osparc.vipStore.AnatomicalModelListItem", {
8181
nullable: true,
8282
event: "changeDate",
8383
},
84+
85+
leased: {
86+
check: "Boolean",
87+
init: false,
88+
nullable: true,
89+
event: "changeLeased",
90+
},
8491
},
8592

8693
members: { // eslint-disable-line qx-rules/no-refs-in-members

services/static-webserver/client/source/class/osparc/vipStore/VIPStore.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)