Skip to content

Commit 9dafd24

Browse files
committed
getTags
1 parent d945454 commit 9dafd24

File tree

2 files changed

+12
-16
lines changed
  • services/static-webserver/client/source/class/osparc

2 files changed

+12
-16
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,10 @@ qx.Class.define("osparc.desktop.preferences.pages.TagsPage", {
4848
icon: "@FontAwesome5Solid/plus/14"
4949
});
5050
osparc.utils.Utils.setIdToWidget(this.__addTagButton, "addTagBtn");
51-
osparc.data.Resources.get("tags")
52-
.then(tags => {
53-
this.__tagItems = tags.map(tagData => {
54-
const tag = new osparc.data.model.Tag(tagData);
55-
return new osparc.form.tag.TagItem().set({
56-
tag
57-
});
58-
});
59-
this.__renderLayout();
60-
this.__attachEventHandlers();
61-
})
62-
.catch(err => console.error(err));
51+
const tags = osparc.store.Tags.getInstance().getTags();
52+
this.__tagItems = tags.map(tag => new osparc.form.tag.TagItem().set({tag}));
53+
this.__renderLayout();
54+
this.__attachEventHandlers();
6355
},
6456

6557
__renderLayout: function() {

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ qx.Class.define("osparc.store.Tags", {
5151
});
5252
},
5353

54+
getTags: function() {
55+
return this.tagsCached;
56+
},
57+
5458
postTag: function(name, parentTagId = null, workspaceId = null) {
5559
const newTagData = {
5660
name,
@@ -68,17 +72,17 @@ qx.Class.define("osparc.store.Tags", {
6872
});
6973
},
7074

71-
deleteTag: function(tagId, workspaceId) {
75+
deleteTag: function(tagId) {
7276
const params = {
73-
"url": {
77+
url: {
7478
tagId
7579
}
7680
};
7781
return osparc.data.Resources.getInstance().fetch("tags", "delete", params)
7882
.then(() => {
7983
const tag = this.getTag(tagId);
8084
if (tag) {
81-
this.__deleteFromCache(tagId, workspaceId);
85+
this.__deleteFromCache(tagId);
8286
this.fireDataEvent("tagRemoved", tag);
8387
}
8488
})
@@ -104,7 +108,7 @@ qx.Class.define("osparc.store.Tags", {
104108
},
105109

106110
__addToCache: function(tagData) {
107-
let tag = this.tagsCached.find(f => f.getTagId() === tagData["tagId"] && f.getWorkspaceId() === tagData["workspaceId"]);
111+
let tag = this.tagsCached.find(f => f.getTagId() === tagData["tagId"]);
108112
if (tag) {
109113
const props = Object.keys(qx.util.PropertyUtil.getProperties(osparc.data.model.Tag));
110114
// put

0 commit comments

Comments
 (0)