EventBus: add origin to all events and support nested EventBus (#33548)

This commit is contained in:
Ryan McKinley
2021-04-30 13:33:29 -07:00
committed by GitHub
parent cedac5f4d4
commit 69f2a43063
13 changed files with 136 additions and 88 deletions

View File

@@ -18,15 +18,19 @@ export const AnnotationPicker = ({ annotation, events, onEnabledChanged }: Annot
const onCancel = () => getDashboardQueryRunner().cancel(annotation);
useEffect(() => {
const started = events.subscribe(AnnotationQueryStarted, (event) => {
if (event.payload === annotation) {
setLoading(true);
}
const started = events.getStream(AnnotationQueryStarted).subscribe({
next: (event) => {
if (event.payload === annotation) {
setLoading(true);
}
},
});
const stopped = events.subscribe(AnnotationQueryFinished, (event) => {
if (event.payload === annotation) {
setLoading(false);
}
const stopped = events.getStream(AnnotationQueryFinished).subscribe({
next: (event) => {
if (event.payload === annotation) {
setLoading(false);
}
},
});
return () => {