Skip to content

Commit 4680e0b

Browse files
authored
Fix Service Catalog tags filter (#2541)
1 parent 79a24d1 commit 4680e0b

File tree

5 files changed

+42
-21
lines changed

5 files changed

+42
-21
lines changed

services/web/client/source/class/osparc/component/service/ServiceButtonSmall.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ qx.Class.define("osparc.component.service.ServiceButtonSmall", {
3333
if (serviceModel) {
3434
this.setServiceModel(serviceModel);
3535
}
36+
37+
this.subscribeToFilterGroup("serviceCatalog");
3638
},
3739

3840
properties: {
@@ -95,8 +97,13 @@ qx.Class.define("osparc.component.service.ServiceButtonSmall", {
9597
},
9698

9799
_filterTags: function(tags) {
98-
const checks = this.getServiceModel().getTags().map(tag => tag.name);
99-
return osparc.dashboard.CardBase.filterText(checks, tags);
100+
if (tags && tags.length) {
101+
const type = this.getServiceModel().getType() || "";
102+
if (!tags.includes(osparc.utils.Utils.capitalize(type.trim()))) {
103+
return true;
104+
}
105+
}
106+
return false;
100107
},
101108

102109
_filterClassifiers: function(classifiers) {

services/web/client/source/class/osparc/component/workbench/NodeUI.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -340,24 +340,36 @@ qx.Class.define("osparc.component.workbench.NodeUI", {
340340
});
341341
},
342342

343-
// implement osparc.component.filter.IFilterable
344-
_shouldApplyFilter: function(data) {
345-
if (data.text) {
346-
const label = this.getNode().getLabel()
347-
.trim()
348-
.toLowerCase();
349-
if (label.indexOf(data.text) === -1) {
350-
return true;
351-
}
343+
__filterText: function(text) {
344+
const label = this.getNode().getLabel()
345+
.trim()
346+
.toLowerCase();
347+
if (label.indexOf(text) === -1) {
348+
return true;
352349
}
353-
if (data.tags && data.tags.length) {
350+
return false;
351+
},
352+
353+
__filterTags: function(tags) {
354+
if (tags && tags.length) {
354355
const category = this.getNode().getMetaData().category || "";
355356
const type = this.getNode().getMetaData().type || "";
356-
if (!data.tags.includes(osparc.utils.Utils.capitalize(category.trim())) && !data.tags.includes(osparc.utils.Utils.capitalize(type.trim()))) {
357+
if (!tags.includes(osparc.utils.Utils.capitalize(category.trim())) && !tags.includes(osparc.utils.Utils.capitalize(type.trim()))) {
357358
return true;
358359
}
359360
}
360361
return false;
362+
},
363+
364+
// implement osparc.component.filter.IFilterable
365+
_shouldApplyFilter: function(data) {
366+
if (data.text) {
367+
return this.__filterText(data.text);
368+
}
369+
if (data.tags && data.tags.length) {
370+
return this.__filterTags(data.tags);
371+
}
372+
return false;
361373
}
362374
}
363375
});

services/web/client/source/class/osparc/component/workbench/ServiceCatalog.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ qx.Class.define("osparc.component.workbench.ServiceCatalog", {
8686
members: {
8787
__allServicesList: null,
8888
__filteredServicesObj: null,
89-
__textfield: null,
89+
__textFilter: null,
9090
__contextLeftNodeId: null,
9191
__contextRightNodeId: null,
9292
__versionsBox: null,
@@ -101,7 +101,7 @@ qx.Class.define("osparc.component.workbench.ServiceCatalog", {
101101
spacing: 10
102102
});
103103
const filters = new osparc.component.filter.group.ServiceFilterGroup("serviceCatalog");
104-
this.__textfield = filters.getTextFilter().getChildControl("textfield", true);
104+
this.__textFilter = filters.getTextFilter().getChildControl("textfield", true);
105105
filterPart.add(filters);
106106
toolbar.add(filterPart);
107107

@@ -304,9 +304,9 @@ qx.Class.define("osparc.component.workbench.ServiceCatalog", {
304304
__attachEventHandlers: function() {
305305
this.addListener("appear", () => {
306306
osparc.component.filter.UIFilterController.getInstance().resetGroup("serviceCatalog");
307-
this.__textfield.focus();
307+
this.__textFilter.focus();
308308
}, this);
309-
this.__textfield.addListener("keypress", e => {
309+
this.__textFilter.addListener("keypress", e => {
310310
if (e.getKeyIdentifier() === "Enter") {
311311
this.__serviceBrowser.selectFirstVisible();
312312
const selected = this.__serviceBrowser.getSelected();

services/web/client/source/class/osparc/data/model/Node.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,12 @@ qx.Class.define("osparc.data.model.Node", {
379379
return uniqueNodes;
380380
},
381381

382+
getExposedNodeIDs: function() {
383+
const exposedInnerNodes = this.getExposedInnerNodes();
384+
const exposedNodeIDs = exposedInnerNodes.map(exposedInnerNode => exposedInnerNode.getNodeId());
385+
return exposedNodeIDs;
386+
},
387+
382388
populateNodeData: function(nodeData) {
383389
if (nodeData) {
384390
if (nodeData.label) {

services/web/client/source/class/osparc/utils/Services.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ qx.Class.define("osparc.utils.Services", {
4040
dynamic: {
4141
label: "Interactive",
4242
icon: "@FontAwesome5Solid/mouse-pointer/"
43-
},
44-
container: {
45-
label: "Group of nodes",
46-
icon: "@FontAwesome5Solid/box-open/"
4743
}
4844
},
4945

0 commit comments

Comments
 (0)