Skip to content

Commit 03dd215

Browse files
committed
fetch tags access rights when really needed
1 parent f9caee7 commit 03dd215

File tree

2 files changed

+9
-3
lines changed
  • services/static-webserver/client/source/class/osparc

2 files changed

+9
-3
lines changed

services/static-webserver/client/source/class/osparc/desktop/preferences/pages/TagsPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ qx.Class.define("osparc.desktop.preferences.pages.TagsPage", {
3232
members: {
3333
__tagsContainer: null,
3434

35-
__renderLayout: function() {
35+
__renderLayout: async function() {
3636
// Tags
3737
this.__tagsContainer = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
3838
this.__tagsContainer.set({
@@ -44,6 +44,9 @@ qx.Class.define("osparc.desktop.preferences.pages.TagsPage", {
4444
});
4545

4646
const tags = osparc.store.Tags.getInstance().getTags();
47+
for (const tag of tags) {
48+
await osparc.store.Tags.getInstance().fetchAccessRights(tag);
49+
}
4750
const tagItems = tags.map(tag => new osparc.form.tag.TagItem().set({tag}));
4851
tagItems.forEach(tagItem => {
4952
this.__tagsContainer.add(tagItem);

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ qx.Class.define("osparc.store.Tags", {
4545
tagsData.forEach(tagData => {
4646
const tag = this.__addToCache(tagData);
4747
tags.push(tag);
48-
this.fetchAccessRights(tag);
4948
});
5049
return tags;
5150
});
@@ -106,7 +105,11 @@ qx.Class.define("osparc.store.Tags", {
106105
.catch(console.error);
107106
},
108107

109-
fetchAccessRights: function(tag) {
108+
fetchAccessRights: function(tag, reload = false) {
109+
if (reload === false && tag.getAccessRights() !== null) {
110+
return new Promise(resolve => resolve());
111+
}
112+
110113
const params = {
111114
url: {
112115
"tagId": tag.getTagId()

0 commit comments

Comments
 (0)