Skip to content

Commit 2cf13e1

Browse files
committed
LicensedItem model
1 parent 86776a7 commit 2cf13e1

File tree

1 file changed

+149
-0
lines changed
  • services/static-webserver/client/source/class/osparc/data/model

1 file changed

+149
-0
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/* ************************************************************************
2+
3+
osparc - the simcore frontend
4+
5+
https://osparc.io
6+
7+
Copyright:
8+
2025 IT'IS Foundation, https://itis.swiss
9+
10+
License:
11+
MIT: https://opensource.org/licenses/MIT
12+
13+
Authors:
14+
* Odei Maiz (odeimaiz)
15+
16+
************************************************************************ */
17+
18+
qx.Class.define("osparc.data.model.LicensedItem", {
19+
extend: qx.core.Object,
20+
21+
/**
22+
* @param licensedItemData {Object} Object containing the serialized LicensedItem Data
23+
*/
24+
construct: function(licensedItemData) {
25+
this.base(arguments);
26+
27+
console.log("licensedItemData", licensedItemData);
28+
29+
let thumbnail = "";
30+
let date = null;
31+
let licensedResources = [];
32+
if (licensedItemData["licensedResources"]) {
33+
if (licensedItemData["licensedResources"].length) {
34+
const firstItem = licensedItemData["licensedResources"][0]["source"];
35+
if (firstItem["thumbnail"]) {
36+
thumbnail = firstItem["thumbnail"];
37+
}
38+
if (firstItem["features"] && firstItem["features"]["date"]) {
39+
date = firstItem["features"]["date"];
40+
}
41+
}
42+
licensedItemData["licensedResources"].forEach(licensedRsrc => licensedResources.push(licensedRsrc["source"]));
43+
}
44+
45+
this.set({
46+
licensedItemId: licensedItemData.licensedItemId,
47+
categoryId: licensedItemData.categoryId,
48+
categoryDisplay: licensedItemData.categoryDisplay,
49+
categoryIcon: licensedItemData.categoryIcon,
50+
pricingPlanId: licensedItemData.pricingPlanId,
51+
key: licensedItemData.key,
52+
version: licensedItemData.version,
53+
thumbnail: thumbnail,
54+
displayName: licensedItemData.displayName,
55+
date: new Date(date),
56+
licensedResources: licensedResources,
57+
seats: licensedItemData.seats || null,
58+
});
59+
},
60+
61+
properties: {
62+
licensedItemId: {
63+
check: "String",
64+
nullable: false,
65+
init: null,
66+
event: "changeLicensedItemId",
67+
},
68+
69+
categoryId: {
70+
check: "String",
71+
nullable: true,
72+
init: null,
73+
event: "changeCategoryId",
74+
},
75+
76+
categoryDisplay: {
77+
check: "String",
78+
nullable: true,
79+
init: null,
80+
event: "changeCategoryDisplay",
81+
},
82+
83+
categoryIcon: {
84+
check: "String",
85+
nullable: true,
86+
init: null,
87+
event: "changeCategoryIcon",
88+
},
89+
90+
pricingPlanId: {
91+
check: "Number",
92+
nullable: false,
93+
init: null,
94+
event: "changePricingPlanId",
95+
},
96+
97+
key: {
98+
check: "String",
99+
nullable: false,
100+
init: null,
101+
event: "changeKey",
102+
},
103+
104+
version: {
105+
check: "String",
106+
nullable: false,
107+
init: null,
108+
event: "changeVersion",
109+
},
110+
111+
thumbnail: {
112+
check: "String",
113+
nullable: true,
114+
init: null,
115+
event: "changeThumbnail",
116+
},
117+
118+
displayName: {
119+
check: "String",
120+
nullable: false,
121+
init: null,
122+
event: "changeDisplayName",
123+
},
124+
125+
date: {
126+
check: "Date",
127+
nullable: false,
128+
init: null,
129+
event: "changeDate",
130+
},
131+
132+
licensedResources: {
133+
check: "Array",
134+
nullable: false,
135+
init: [],
136+
event: "changeLicensedResources",
137+
},
138+
139+
seats: {
140+
check: "Object",
141+
nullable: true,
142+
init: null,
143+
event: "changeSeats",
144+
},
145+
},
146+
147+
members: {
148+
}
149+
});

0 commit comments

Comments
 (0)