Skip to content

Commit 4141491

Browse files
committed
osparc.ui.basic.Tag expects the model
1 parent 7bfb913 commit 4141491

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
262262
tagsContainer.setVisibility(tags.length ? "visible" : "excluded");
263263
tagsContainer.removeAll();
264264
tags.forEach(tag => {
265-
const tagUI = new osparc.ui.basic.Tag(tag.name, tag.color, "searchBarFilter");
265+
const tagUI = new osparc.ui.basic.Tag(tag, "searchBarFilter");
266266
tagUI.set({
267267
font: "text-12",
268268
toolTipText: this.tr("Click to filter by this Tag")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
237237
const tagsContainer = this.getChildControl("tags");
238238
tagsContainer.removeAll();
239239
tags.forEach(tag => {
240-
const tagUI = new osparc.ui.basic.Tag(tag.name, tag.color, "searchBarFilter");
240+
const tagUI = new osparc.ui.basic.Tag(tag, "searchBarFilter");
241241
tagUI.set({
242242
alignY: "middle",
243243
font: "text-12",

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

Lines changed: 4 additions & 4 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.id)) : [];
211+
const tags = resourceData.tags ? osparc.store.Store.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.id)) : [];
437+
const tags = resourceData.tags ? osparc.store.Store.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);
@@ -443,9 +443,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
443443
cards.push(card);
444444
} else {
445445
tags.forEach(tag => {
446-
let groupContainer = this.__getGroupContainer(tag.id);
446+
let groupContainer = this.__getGroupContainer(tag.getTagId());
447447
if (groupContainer === null) {
448-
groupContainer = this.__createGroupContainer(tag.id, tag.name, tag.color);
448+
groupContainer = this.__createGroupContainer(tag.getTagId(), tag.getName(), tag.getColor());
449449
groupContainer.setHeaderIcon("@FontAwesome5Solid/tag/24");
450450
this.__groupedContainers.add(groupContainer);
451451
this.__groupedContainers.getChildren().sort((a, b) => a.getHeaderLabel().localeCompare(b.getHeaderLabel()));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ qx.Class.define("osparc.info.StudyUtils", {
216216
if (tagsContainer.indexOf(noTagsLabel) > -1) {
217217
tagsContainer.remove(noTagsLabel);
218218
}
219-
tagsContainer.add(new osparc.ui.basic.Tag(selectedTag.name, selectedTag.color));
219+
tagsContainer.add(new osparc.ui.basic.Tag(selectedTag));
220220
});
221221
};
222222
study.addListener("changeTags", () => addTags(study), this);

services/static-webserver/client/source/class/osparc/ui/basic/Tag.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ qx.Class.define("osparc.ui.basic.Tag", {
1313
extend: qx.ui.basic.Label,
1414
/**
1515
* Constructor for the Tag element.
16-
* @param {String} value Short text to be shown on the tag
17-
* @param {String} color Color for the background, must be in hex3 or hex6 form
16+
* @param {osparc.data.model.Tag} tag Short text to be shown on the tag
1817
* @param {String} [filterGroupId] If present, clicking on the tab will dispatch a bus message with the
1918
* id ``GroupIdTagsTrigger`` to be subscribed by a filter.
2019
*/
21-
construct: function(value, color, filterGroupId) {
22-
this.base(arguments, value);
20+
construct: function(tag, filterGroupId) {
21+
this.base(arguments);
22+
23+
tag.bind("name", this, "value");
24+
tag.bind("color", this, "color");
2325
this.setFont("text-11");
24-
if (color) {
25-
this.setColor(color);
26-
}
26+
2727
if (filterGroupId) {
2828
this.setCursor("pointer");
2929
this.addListener("tap", e => {

0 commit comments

Comments
 (0)