Skip to content

Commit d8eff20

Browse files
committed
more progress
1 parent a7405b7 commit d8eff20

File tree

3 files changed

+46
-10
lines changed

3 files changed

+46
-10
lines changed

services/static-webserver/client/source/class/osparc/workbench/Annotation.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ qx.Class.define("osparc.workbench.Annotation", {
101101
members: {
102102
__svgLayer: null,
103103

104-
__drawAnnotation: async function(attrs) {
104+
__drawAnnotation: function(attrs) {
105105
if (this.__svgLayer === null) {
106106
return;
107107
}
@@ -124,7 +124,13 @@ qx.Class.define("osparc.workbench.Annotation", {
124124
break;
125125
case this.self().TYPES.CONVERSATION: {
126126
const text = `${attrs.x}, ${attrs.y}`;
127-
representation = this.__svgLayer.drawAnnotationText(attrs.x, attrs.y, text, "#00FF00", 12);
127+
const conversationData = {
128+
conversationId: attrs.conversationId,
129+
title: attrs.text || text,
130+
}
131+
representation = new osparc.workbench.ConversationUI(conversationData);
132+
// OM: Add it to the svgLayer or something
133+
representation.moveTo(attrs.x, attrs.y);
128134
representation.isSVG = false;
129135
break;
130136
}
@@ -241,9 +247,7 @@ qx.Class.define("osparc.workbench.Annotation", {
241247
type,
242248
attributes: this.getAttributes(),
243249
}
244-
if (type !== this.self().TYPES.CONVERSATION) {
245-
data.color = this.getColor();
246-
}
250+
data.color = this.getColor();
247251
return data;
248252
}
249253
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
19+
qx.Class.define("osparc.workbench.ConversationUI", {
20+
extend: osparc.workbench.BaseNodeUI,
21+
22+
construct: function(conversationData) {
23+
this.base(arguments);
24+
25+
this.__conversationData = conversationData;
26+
27+
const captionTitle = this.getChildControl("title");
28+
captionTitle.set({
29+
value: conversationData.title || this.tr("Conversation"),
30+
});
31+
},
32+
33+
members: {
34+
__conversationData: null,
35+
},
36+
});

services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,16 +1976,12 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
19761976
break;
19771977
}
19781978
case annotationTypes.CONVERSATION: {
1979-
const annotation = this.__addAnnotation(serializeData);
19801979
const conversationTitle = `${initPos.x}, ${initPos.y}`;
19811980
osparc.study.Conversations.addConversation(this.getStudy().getUuid(), conversationTitle, osparc.study.Conversations.PROJECT_ANNOTATION)
19821981
.then(conversationData => {
19831982
serializeData.attributes.conversationId = conversationData["conversationId"];
1983+
this.__addAnnotation(serializeData);
19841984
osparc.study.Conversations.popUpInWindow(this.getStudy().serialize(), conversationData["conversationId"]);
1985-
})
1986-
.catch(() => {
1987-
// remove annotation if conversation creation fails
1988-
this.__removeAnnotation(annotation.getId());
19891985
});
19901986
break;
19911987
}

0 commit comments

Comments
 (0)