Skip to content

Commit a01502b

Browse files
committed
Tag Data Model
1 parent 1e4ecff commit a01502b

File tree

1 file changed

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

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/* ************************************************************************
2+
3+
osparc - the simcore frontend
4+
5+
https://osparc.io
6+
7+
Copyright:
8+
2024 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+
/**
19+
* Class that stores Tag data.
20+
*/
21+
22+
qx.Class.define("osparc.data.model.Tag", {
23+
extend: qx.core.Object,
24+
25+
/**
26+
* @param tagData {Object} Object containing the serialized Tag Data
27+
*/
28+
construct: function(tagData) {
29+
this.base(arguments);
30+
31+
this.set({
32+
tagId: tagData.id,
33+
name: tagData.name,
34+
description: tagData.description,
35+
accessRights: tagData.accessRights,
36+
});
37+
},
38+
39+
properties: {
40+
tagId: {
41+
check: "Number",
42+
nullable: true,
43+
init: null,
44+
event: "changeTagId"
45+
},
46+
47+
name: {
48+
check: "String",
49+
nullable: false,
50+
init: null,
51+
event: "changeName"
52+
},
53+
54+
description: {
55+
check: "String",
56+
nullable: false,
57+
init: null,
58+
event: "changeDescription"
59+
},
60+
61+
color: {
62+
check: "Color",
63+
event: "changeColor",
64+
init: "#303030"
65+
},
66+
67+
accessRights: {
68+
check: "Object",
69+
nullable: false,
70+
init: null,
71+
event: "changeAccessRights"
72+
},
73+
},
74+
75+
members: {
76+
serialize: function() {
77+
const jsonObject = {};
78+
const propertyKeys = this.self().getProperties();
79+
propertyKeys.forEach(key => {
80+
jsonObject[key] = this.get(key);
81+
});
82+
return jsonObject;
83+
}
84+
}
85+
});

0 commit comments

Comments
 (0)