Skip to content

Commit

Permalink
fix(agent): patch event should consider current target selection (#904)
Browse files Browse the repository at this point in the history
Signed-off-by: Thuan Vo <[email protected]>
  • Loading branch information
Thuan Vo authored Mar 10, 2023
1 parent 3f480ab commit 9cfd2ef
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/Agent/AgentLiveProbes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -200,7 +201,13 @@ export const AgentLiveProbes: React.FC<AgentLiveProbesProps> = (_) => {

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);
Expand All @@ -211,7 +218,7 @@ export const AgentLiveProbes: React.FC<AgentLiveProbesProps> = (_) => {
});
})
);
}, [addSubscription, context, context.notificationChannel, setProbes]);
}, [addSubscription, context, context.notificationChannel, context.target, setProbes]);

React.useEffect(() => {
addSubscription(
Expand Down

0 comments on commit 9cfd2ef

Please sign in to comment.