Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix: Add recipient to Sticky notes #5723

Merged
merged 11 commits into from
Apr 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ qx.Class.define("osparc.desktop.wallets.MembersList", {
serializedData["resourceType"] = "wallet";
const showOrganizations = false;
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(serializedData, showOrganizations);
collaboratorsManager.addListener("addEditors", e => {
collaboratorsManager.addListener("addCollaborators", e => {
const cb = () => collaboratorsManager.close();
this.__addMembers(e.getData(), cb);
}, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
this._setLayout(new qx.ui.layout.VBox(10));

this.getChildControl("instructions");
this.getChildControl("select-destinatary");
this.getChildControl("select-recipient");
this.getChildControl("note");
this.getChildControl("add");
},

properties: {
destinataryGid: {
recipientGid: {
check: "Integer",
init: null,
nullable: true,
event: "changeDestinataryGid"
event: "changeRecipientGid"
},

note: {
Expand Down Expand Up @@ -74,13 +74,13 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
});
this._add(control);
break;
case "destinatary-layout":
case "recipient-layout":
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)).set({
alignY: "middle"
});
this._add(control);
break;
case "select-destinatary":
case "select-recipient":
control = new qx.ui.form.Button(this.tr("Select recipient")).set({
allowGrowX: false
});
Expand All @@ -92,18 +92,18 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
const collabs = e.getData();
if (collabs) {
collaboratorsManager.close();
this.__setDestinataryGid(collabs[0]);
this.__setRecipientGid(collabs[0]);
}
}, this);
}, this);
this.getChildControl("destinatary-layout").add(control);
this.getChildControl("recipient-layout").add(control);
break;
case "selected-destinatary":
case "selected-recipient":
control = new qx.ui.basic.Label().set({
font: "text-14",
alignY: "middle"
});
this.getChildControl("destinatary-layout").add(control, {
this.getChildControl("recipient-layout").add(control, {
flex: 1
});
break;
Expand Down Expand Up @@ -148,11 +148,11 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
return control || this.base(arguments, id);
},

__setDestinataryGid: function(gid) {
this.setDestinataryGid(gid);
__setRecipientGid: function(gid) {
this.setRecipientGid(gid);
osparc.store.Store.getInstance().getGroup(gid)
.then(user => {
this.getChildControl("selected-destinatary").setValue(user.label);
this.getChildControl("selected-recipient").setValue(user.label);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ qx.Class.define("osparc.share.Collaborators", {
});
addCollaboratorBtn.addListener("execute", () => {
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(this._serializedData);
collaboratorsManager.addListener("addEditors", e => {
collaboratorsManager.addListener("addCollaborators", e => {
const cb = () => collaboratorsManager.close();
this._addEditors(e.getData(), cb);
}, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
},

events: {
"addEditors": "qx.event.type.Data"
"addCollaborators": "qx.event.type.Data"
},

members: {
Expand Down Expand Up @@ -166,7 +166,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
addCollabs.push(collabId);
}
if (addCollabs.length) {
this.fireDataEvent("addEditors", addCollabs);
this.fireDataEvent("addCollaborators", addCollabs);
}
// The parent class will close the window
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ qx.Class.define("osparc.workbench.Annotation", {
let representation = null;
switch (this.getType()) {
case "note": {
const user = await osparc.store.Store.getInstance().getGroup(attrs.destinataryGid);
const user = await osparc.store.Store.getInstance().getGroup(attrs.recipientGid);
representation = this.__svgLayer.drawAnnotationNote(attrs.x, attrs.y, user ? user.label : "", attrs.text);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Here is a little example of how to use the widget.
*
* <pre class='javascript'>
* let svgWidget = new osparc.workbench.SvgWidget("SvgWidget_(Purporse)");
* let svgWidget = new osparc.workbench.SvgWidget("SvgWidget_(Purpose)");
* this.getRoot().add(svgWidget);
* </pre>
*/
Expand Down Expand Up @@ -97,8 +97,8 @@ qx.Class.define("osparc.workbench.SvgWidget", {
return osparc.wrapper.Svg.drawAnnotationText(this.__canvas, x, y, label, color, fontSize);
},

drawAnnotationNote: function(x, y, destinataryName = "", text = "") {
return osparc.wrapper.Svg.drawAnnotationNote(this.__canvas, x, y, destinataryName, text);
drawAnnotationNote: function(x, y, recipientName = "", text = "") {
return osparc.wrapper.Svg.drawAnnotationNote(this.__canvas, x, y, recipientName, text);
},

drawAnnotationRect: function(width, height, x, y, color) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1890,10 +1890,10 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
const noteEditor = new osparc.editor.AnnotationNoteCreator();
const win = osparc.editor.AnnotationNoteCreator.popUpInWindow(noteEditor, true);
noteEditor.addListener("addNote", () => {
const gid = noteEditor.getDestinataryGid();
const gid = noteEditor.getRecipientGid();
osparc.store.Store.getInstance().getGroup(gid)
.then(user => {
serializeData.attributes.destinataryGid = gid;
serializeData.attributes.recipientGid = gid;
serializeData.attributes.text = noteEditor.getNote();
if (user) {
osparc.notification.Notifications.postNewAnnotationNote(user.id, this.getStudy().getUuid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ qx.Class.define("osparc.wrapper.Svg", {
return text;
},

drawAnnotationNote: function(draw, x, y, destinataryName, note) {
drawAnnotationNote: function(draw, x, y, recipientName, note) {
const lines = note.split("\n");
const width = 200;
const minHeight = 120;
Expand Down Expand Up @@ -224,7 +224,7 @@ qx.Class.define("osparc.wrapper.Svg", {
gNote.add(separator);

const defaultFont = osparc.utils.Utils.getDefaultFont();
const title = gNote.text(destinataryName)
const title = gNote.text(recipientName)
.font({
fill: "#000000",
size: (defaultFont["size"]+1) + "px",
Expand Down
Loading