From 3d411b6eafa10db46e7c6539d579873776af4f87 Mon Sep 17 00:00:00 2001 From: Thuan Vo Date: Thu, 9 Mar 2023 17:50:18 -0500 Subject: [PATCH] fix(agent): patch event should consider current target selection Signed-off-by: Thuan Vo --- src/app/Agent/AgentLiveProbes.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/Agent/AgentLiveProbes.tsx b/src/app/Agent/AgentLiveProbes.tsx index 902d3e6f2..60b2e034a 100644 --- a/src/app/Agent/AgentLiveProbes.tsx +++ b/src/app/Agent/AgentLiveProbes.tsx @@ -71,6 +71,7 @@ import { Td, } from '@patternfly/react-table'; import * as React from 'react'; +import { combineLatest } from 'rxjs'; import { AboutAgentCard } from './AboutAgentCard'; export type LiveProbeActions = 'REMOVE'; @@ -200,7 +201,13 @@ export const AgentLiveProbes: React.FC = (_) => { React.useEffect(() => { addSubscription( - context.notificationChannel.messages(NotificationCategory.ProbeTemplateApplied).subscribe((e) => { + combineLatest([ + context.target.target(), + context.notificationChannel.messages(NotificationCategory.ProbeTemplateApplied), + ]).subscribe(([currentTarget, e]) => { + if (currentTarget.connectUrl != e.message.targetId) { + return; + } setProbes((old) => { const probes = e.message.events as EventProbe[]; const probeIds = probes.map((p) => p.id); @@ -211,7 +218,7 @@ export const AgentLiveProbes: React.FC = (_) => { }); }) ); - }, [addSubscription, context, context.notificationChannel, setProbes]); + }, [addSubscription, context, context.notificationChannel, context.target, setProbes]); React.useEffect(() => { addSubscription(