Skip to content

Commit 943daef

Browse files
committed
preselectCollaboratorGids
1 parent 7a24e30 commit 943daef

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

services/static-webserver/client/source/class/osparc/editor/AnnotationNoteCreator.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
9292
recipientsManager.setCaption("Recipient");
9393
recipientsManager.getActionButton().setLabel(this.tr("Add"));
9494
recipientsManager.addListener("addCollaborators", e => {
95-
const {
96-
selectedGids,
97-
} = e.getData();
95+
const data = e.getData();
96+
const recipientGids = data["selectedGids"];
9897

99-
if (selectedGids && selectedGids.length) {
100-
const recipientGid = parseInt(selectedGids[0]);
98+
if (recipientGids && recipientGids.length) {
99+
const recipientGid = parseInt(recipientGids[0]);
101100
this.__setRecipientGid(recipientGid);
102101
recipientsManager.close();
103102

@@ -107,11 +106,14 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
107106
proposeSharing.push(recipientGid);
108107
}
109108
if (proposeSharing.length) {
110-
console.log("share?", proposeSharing);
111-
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(currentStudy, false);
109+
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(currentStudy, false, true, proposeSharing);
112110
collaboratorsManager.addListener("addCollaborators", ev => {
113-
const data = ev.getData();
114-
console.log("share asd", data);
111+
const {
112+
selectedGids,
113+
newAccessRights,
114+
} = e.getData();
115+
console.log("addCollaborators", selectedGids, newAccessRights);
116+
// this._addEditors(selectedGids, newAccessRights);
115117
collaboratorsManager.close();
116118
});
117119
}

services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
qx.Class.define("osparc.share.NewCollaboratorsManager", {
99
extend: osparc.ui.window.SingletonWindow,
1010

11-
construct: function(resourceData, showOrganizations = true, showAccessRights = true) {
11+
construct: function(resourceData, showOrganizations = true, showAccessRights = true, preselectCollaboratorGids = []) {
1212
this.base(arguments, "newCollaboratorsManager", this.tr("New collaborators"));
1313

1414
this.set({
@@ -39,6 +39,16 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
3939
this.__shareWithEmailEnabled = osparc.utils.DisabledPlugins.isShareWithEmailEnabled();
4040
}
4141

42+
if (preselectCollaboratorGids && preselectCollaboratorGids.length) {
43+
preselectCollaboratorGids.forEach(preselectCollaboratorGid => {
44+
const potentialCollaboratorList = this.getChildControl("potential-collaborators-list");
45+
const found = potentialCollaboratorList.getChildren().find(c => "groupId" in c && c["groupId"] === preselectCollaboratorGid)
46+
if (found) {
47+
found.setValue(true);
48+
}
49+
});
50+
}
51+
4252
this.center();
4353
this.open();
4454
},

0 commit comments

Comments
 (0)