Skip to content

Commit

Permalink
Fix: aggregate link
Browse files Browse the repository at this point in the history
  • Loading branch information
alucas-nickel authored and mbouchenoire committed Jun 8, 2021
1 parent b889ae1 commit 70e082c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/webapp/features/graph/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,30 @@ import { actions as filtersActions } from '../filters/slice';
const getAgregateNodes = () =>
[...document.querySelectorAll('g[class=node]')].filter((e) =>
[...e.children].some(
(c) => c.tagName === 'text' && c.textContent?.[0] === '+'
(c1) =>
c1.tagName === 'g' &&
[...c1.children].some(
(c2) =>
c2.tagName === 'a' &&
[...c2.children].some(
(c3) => c3.tagName === 'text' && c3.textContent?.[0] === '+'
)
)
)
);

const onClickOnAggregate = (e: any) => {
let elem: Node | null | undefined = e.target;
do {
if (elem?.nodeName === 'g') {
elem.removeEventListener('click', onClickOnAggregate);
for (const child of elem.childNodes) {
if (child.nodeName === 'title' && child.textContent != null) {
elem.parentElement?.removeEventListener('click', onClickOnAggregate);
for (const n of elem.childNodes) {
const e = n as Element;
if (e.nodeName === 'a' && e.hasAttribute('title')) {
store.dispatch(
filtersActions.addFilters({
name: 'components',
value: child.textContent.split(';')
value: e.getAttribute('title')?.split(';') ?? []
})
);

Expand Down

0 comments on commit 70e082c

Please sign in to comment.