Skip to content

Commit ac227d5

Browse files
committed
use won store and more modeling
1 parent 4141491 commit ac227d5

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
208208
},
209209

210210
__createCard: function(resourceData) {
211-
const tags = resourceData.tags ? osparc.store.Store.getInstance().getTags().filter(tag => resourceData.tags.includes(tag.getTagId())) : [];
211+
const tags = resourceData.tags ? osparc.store.Tags.getInstance().getTags().filter(tag => resourceData.tags.includes(tag.getTagId())) : [];
212212
const card = this.getMode() === "grid" ? new osparc.dashboard.GridButtonItem() : new osparc.dashboard.ListButtonItem();
213213
card.set({
214214
appearance: resourceData.type ? `pb-${resourceData.type}` : `pb-${resourceData.resourceType}`,
@@ -434,7 +434,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
434434
},
435435

436436
__groupByTags: function(cards, resourceData) {
437-
const tags = resourceData.tags ? osparc.store.Store.getInstance().getTags().filter(tag => resourceData.tags.includes(tag.getTagId())) : [];
437+
const tags = resourceData.tags ? osparc.store.Tags.getInstance().getTags().filter(tag => resourceData.tags.includes(tag.getTagId())) : [];
438438
if (tags.length === 0) {
439439
let noGroupContainer = this.__getGroupContainer("no-group");
440440
const card = this.__createCard(resourceData);

services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,15 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
158158
const maxTags = 5;
159159
this.__tagButtons = [];
160160
layout.removeAll();
161-
osparc.store.Store.getInstance().getTags().forEach((tag, idx) => {
162-
const button = new qx.ui.form.ToggleButton(tag.name, "@FontAwesome5Solid/tag/18");
161+
osparc.store.Tags.getInstance().getTags().forEach((tag, idx) => {
162+
const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/18");
163+
button.id = tag.getTagId();
164+
tag.bind("name", button, "label");
165+
tag.bind("color", button.getChildControl("icon"), "textColor");
163166
osparc.utils.Utils.setIdToWidget(button, this.__resourceType + "-tagFilterItem");
164-
button.id = tag.id;
165167
button.set({
166168
appearance: "filter-toggle-button",
167-
value: selectedTagIds.includes(tag.id)
168-
});
169-
button.getChildControl("icon").set({
170-
textColor: tag.color
169+
value: selectedTagIds.includes(tag.getTagId())
171170
});
172171

173172
layout.add(button);

services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
208208
},
209209

210210
__addTags: function(menuButton) {
211-
const tags = osparc.store.Store.getInstance().getTags();
211+
const tags = osparc.store.Tags.getInstance().getTags();
212212
menuButton.setVisibility(tags.length ? "visible" : "excluded");
213213
if (tags.length) {
214214
const tagsMenu = new qx.ui.menu.Menu();
215215
osparc.utils.Utils.setIdToWidget(tagsMenu, "searchBarFilter-tags-menu");
216216
tags.forEach(tag => {
217-
const tagButton = new qx.ui.menu.Button(tag.name, "@FontAwesome5Solid/tag/12");
218-
tagButton.getChildControl("icon").setTextColor(tag.color);
217+
const tagButton = new qx.ui.menu.Button(tag.getName(), "@FontAwesome5Solid/tag/12");
218+
tagButton.getChildControl("icon").setTextColor(tag.getColor());
219219
tagsMenu.add(tagButton);
220220
tagButton.addListener("execute", () => this.addTagActiveFilter(tag), this);
221221
});
@@ -275,12 +275,13 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
275275
},
276276

277277
setTagsActiveFilter: function(tagIds) {
278-
const tags = osparc.store.Store.getInstance().getTags();
278+
const tags = osparc.store.Tags.getInstance().getTags();
279279
tags.forEach(tag => {
280-
if (tagIds.includes(tag.id)) {
281-
this.__addChip("tag", tag.id, tag.name);
280+
const tagId = tag.getTagId();
281+
if (tagIds.includes(tagId)) {
282+
this.__addChip("tag", tag.id, tag.getName());
282283
} else {
283-
this.__removeChip("tag", tag.id, tag.name);
284+
this.__removeChip("tag", tag.id, tag.getName());
284285
}
285286
});
286287
},

services/static-webserver/client/source/class/osparc/filter/UserTagsFilter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ qx.Class.define("osparc.filter.UserTagsFilter", {
1818
},
1919
members: {
2020
__buildMenu: function() {
21-
osparc.store.Store.getInstance().getTags()
21+
osparc.store.Tags.getInstance().getTags()
2222
.forEach(tag => {
2323
const menuButton = this._addOption(tag.name);
2424
menuButton.setIcon("@FontAwesome5Solid/square/12");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ qx.Class.define("osparc.form.tag.TagManager", {
119119

120120
__repopulateTags: function() {
121121
this.__tagsContainer.removeAll();
122-
const tags = osparc.store.Store.getInstance().getTags();
122+
const tags = osparc.store.Tags.getInstance().getTags();
123123
tags.forEach(tag => this.__tagsContainer.add(this.__tagButton(tag)));
124124
},
125125

services/static-webserver/client/source/class/osparc/info/StudyUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ qx.Class.define("osparc.info.StudyUtils", {
211211
tagsContainer.removeAll();
212212
const noTagsLabel = new qx.ui.basic.Label(qx.locale.Manager.tr("Add tags"));
213213
tagsContainer.add(noTagsLabel);
214-
osparc.store.Store.getInstance().getTags().filter(tag => model.getTags().includes(tag.id))
214+
osparc.store.Tags.getInstance().getTags().filter(tag => model.getTags().includes(tag.id))
215215
.forEach(selectedTag => {
216216
if (tagsContainer.indexOf(noTagsLabel) > -1) {
217217
tagsContainer.remove(noTagsLabel);

0 commit comments

Comments
 (0)