Tempo: Add filtering for service graph query (#41162)

* Add filter based on AdHocFilter element

* Add tests

* Cancel layout in case we have have new data or we unmount node graph

* Fix typing

* Fix test
This commit is contained in:
Andrej Ocenas
2021-11-11 14:27:59 +01:00
committed by GitHub
parent f6ad3e420a
commit 5cc9ff8b28
16 changed files with 468 additions and 118 deletions

View File

@@ -1,15 +1,21 @@
const { layout } = jest.requireActual('../../app/plugins/panel/nodeGraph/layout.worker.js');
class LayoutMockWorker {
timeout: number | undefined;
constructor() {}
postMessage(data: any) {
const { nodes, edges, config } = data;
setTimeout(() => {
this.timeout = setTimeout(() => {
this.timeout = undefined;
layout(nodes, edges, config);
// @ts-ignore
this.onmessage({ data: { nodes, edges } });
}, 1);
}, 1) as any;
}
terminate() {
if (this.timeout) {
clearTimeout(this.timeout);
}
}
}