Skip to content

Commit f89623e

Browse files
committed
add annotationUI
1 parent 9918b37 commit f89623e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

services/static-webserver/client/source/class/osparc/study/Conversations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ qx.Class.define("osparc.study.Conversations", {
262262
.then(conversations => {
263263
if (conversations.length) {
264264
// Sort conversations by created date, newest first
265-
conversations.sort((a, b) => new Date(b.created) - new Date(a.created));
265+
conversations.sort((a, b) => new Date(b["created"]) - new Date(a["created"]));
266266
conversations.forEach(conversation => this.__addConversationPage(conversation));
267267
if (this.__openConversationId) {
268268
const conversationsLayout = this.getChildControl("conversations-layout");

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ qx.Class.define("osparc.workbench.Annotation", {
119119
representation = this.__svgLayer.drawAnnotationText(attrs.x, attrs.y, attrs.text, this.getColor(), attrs.fontSize);
120120
break;
121121
case this.self().TYPES.CONVERSATION: {
122-
console.log("attrs", attrs);
123-
representation = this.__svgLayer.drawAnnotationRect(100, 30, attrs.x, attrs.y, "#00FF00");
122+
const text = `${attrs.x}, ${attrs.y}`;
123+
representation = this.__svgLayer.drawAnnotationText(attrs.x, attrs.y, text, "#00FF00", 12);
124124
break;
125125
}
126126
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,10 +1976,15 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
19761976
break;
19771977
}
19781978
case annotationTypes.CONVERSATION: {
1979+
const annotation = this.__addAnnotation(serializeData);
19791980
const conversationTitle = `${initPos.x}, ${initPos.y}`;
19801981
osparc.study.Conversations.addConversation(this.getStudy().getUuid(), conversationTitle, osparc.study.Conversations.PROJECT_ANNOTATION)
19811982
.then(conversationData => {
19821983
osparc.study.Conversations.popUpInWindow(this.getStudy().serialize(), conversationData["conversationId"]);
1984+
})
1985+
.catch(() => {
1986+
// remove annotation if conversation creation fails
1987+
this.__removeAnnotation(annotation.getId());
19831988
});
19841989
break;
19851990
}
@@ -1994,6 +1999,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
19941999
this.__addAnnotationListeners(annotation);
19952000
this.__annotations[annotation.getId()] = annotation;
19962001
this.getStudy().getUi().addAnnotation(annotation);
2002+
return annotation;
19972003
},
19982004

19992005
__removeAnnotation: function(id) {

0 commit comments

Comments
 (0)