Skip to content

Commit ae45706

Browse files
committed
myAccessRights
1 parent cc826bb commit ae45706

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

services/static-webserver/client/source/class/osparc/form/tag/TagItem.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ qx.Class.define("osparc.form.tag.TagItem", {
5757
init: "#303030"
5858
},
5959

60+
myAccessRights: {
61+
check: "Object",
62+
nullable: false,
63+
event: "changeMyAccessRights",
64+
},
65+
6066
accessRights: {
6167
check: "Object",
6268
nullable: false,
@@ -104,16 +110,18 @@ qx.Class.define("osparc.form.tag.TagItem", {
104110
case "shared-icon":
105111
control = new qx.ui.basic.Image().set({
106112
minWidth: 30,
107-
alignY: "middle"
113+
alignY: "middle",
114+
cursor: "pointer",
108115
});
109116
this.addListener("changeAccessRights", e => {
110117
const accessRights = e.getData();
111-
console.log(accessRights);
118+
console.log("changeAccessRights", accessRights);
112119
if (accessRights) {
113120
osparc.dashboard.CardBase.populateShareIcon(control, accessRights);
114121
}
115122
}, this);
116-
control.addListener("tap", e => this.__openAccessRights(), this);
123+
osparc.dashboard.CardBase.populateShareIcon(control, this.getAccessRights())
124+
control.addListener("tap", () => this.__openAccessRights(), this);
117125
break;
118126
case "name-input":
119127
control = new qx.ui.form.TextField().set({
@@ -155,6 +163,7 @@ qx.Class.define("osparc.form.tag.TagItem", {
155163
tag.bind("name", this, "name");
156164
tag.bind("description", this, "description");
157165
tag.bind("color", this, "color");
166+
tag.bind("myAccessRights", this, "myAccessRights");
158167
tag.bind("accessRights", this, "accessRights");
159168
},
160169

@@ -215,8 +224,8 @@ qx.Class.define("osparc.form.tag.TagItem", {
215224
* Generates and returns the buttons for deleting and editing an existing label (display mode)
216225
*/
217226
__tagItemButtons: function() {
218-
const canIWrite = osparc.data.model.Tag.canIWrite(this.getAccessRights());
219-
const canIDelete = osparc.data.model.Tag.canIDelete(this.getAccessRights());
227+
const canIWrite = osparc.share.CollaboratorsTag.canIWrite(this.getMyAccessRights());
228+
const canIDelete = osparc.share.CollaboratorsTag.canIDelete(this.getMyAccessRights());
220229

221230
const buttonContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox());
222231
const editButton = new qx.ui.form.Button().set({

services/static-webserver/client/source/class/osparc/store/Tags.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ qx.Class.define("osparc.store.Tags", {
109109
}
110110
};
111111
osparc.data.Resources.fetch("tags", "getAccessRights", params)
112-
.then(accessRights => tag.setAccessRights(accessRights))
112+
.then(accessRightsArray => {
113+
const accessRights = {};
114+
accessRightsArray.forEach(ar => accessRights[ar.gid] = ar);
115+
tag.setAccessRights(accessRights)
116+
})
113117
.catch(err => console.error(err));
114118
},
115119

0 commit comments

Comments
 (0)