Skip to content

Commit

Permalink
fix: Fix node filters in UI (argoproj#5162)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Behar <[email protected]>
  • Loading branch information
simster7 committed Feb 23, 2021
1 parent d9fb0c3 commit 4b78a7e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions ui/src/app/shared/components/graph/graph-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,23 @@ export const GraphPanel = (props: Props) => {

const visible = (id: Node) => {
const label = props.graph.nodes.get(id);
return (
(nodeGenres[label.genre] &&
(!nodeClassNames || Object.entries(nodeClassNames).find(([className, checked]) => checked && (label.classNames || '').split(' ').includes(className))) &&
(!nodeTags || Object.entries(nodeTags).find(([tag, checked]) => !label.tags || (checked && label.tags.has(tag)))) &&
!nodeSearchKeyword) ||
label.label.includes(nodeSearchKeyword)
);
// If the node matches the search string, return without considering filters
if (nodeSearchKeyword && label.label.includes(nodeSearchKeyword)) {
return true;
}
// If the node doesn't match enabled genres, don't display
if (!nodeGenres[label.genre]) {
return false;
}
// If the node doesn't match enabled node class names, don't display
if (nodeClassNames && !Object.entries(nodeClassNames).find(([className, checked]) => checked && (label.classNames || '').split(' ').includes(className))) {
return false;
}
// If the node doesn't match enabled node tags, don't display
if (nodeTags && !Object.entries(nodeTags).find(([tag, checked]) => !label.tags || (checked && label.tags.has(tag)))) {
return false;
}
return true;
};

layout(props.graph, nodeSize, horizontal, id => !visible(id), fast);
Expand Down

0 comments on commit 4b78a7e

Please sign in to comment.