Skip to content

Commit

Permalink
ArchiveRecordingCreated
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Oct 4, 2023
1 parent 5f58cfc commit 422bc0d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/app/Agent/AgentLiveProbes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const AgentLiveProbes: React.FC<AgentLiveProbesProps> = (_) => {
context.target.target(),
context.notificationChannel.messages(NotificationCategory.ProbeTemplateApplied),
]).subscribe(([currentTarget, e]) => {
if (currentTarget?.connectUrl != e.message.targetId && currentTarget?.jvmId != e.message.jvmId) {
if (currentTarget?.jvmId != e.message.jvmId) {
return;
}
setProbes((old) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/RecordingMetadata/BulkEditLabels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const BulkEditLabels: React.FC<BulkEditLabelsProps> = ({
]).subscribe((parts) => {
const currentTarget = parts[0];
const event = parts[1];
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) =>
Expand Down
8 changes: 4 additions & 4 deletions src/app/Recordings/ActiveRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export const ActiveRecordingsTable: React.FC<ActiveRecordingsTableProps> = (prop
context.notificationChannel.messages(NotificationCategory.SnapshotCreated),
),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) => old.concat([event.message.recording]));
Expand All @@ -268,7 +268,7 @@ export const ActiveRecordingsTable: React.FC<ActiveRecordingsTableProps> = (prop
context.notificationChannel.messages(NotificationCategory.SnapshotDeleted),
),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}

Expand All @@ -284,7 +284,7 @@ export const ActiveRecordingsTable: React.FC<ActiveRecordingsTableProps> = (prop
context.target.target(),
context.notificationChannel.messages(NotificationCategory.ActiveRecordingStopped),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) => {
Expand Down Expand Up @@ -315,7 +315,7 @@ export const ActiveRecordingsTable: React.FC<ActiveRecordingsTableProps> = (prop
context.target.target(),
context.notificationChannel.messages(NotificationCategory.RecordingMetadataUpdated),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) =>
Expand Down
6 changes: 3 additions & 3 deletions src/app/Recordings/ArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export const ArchivedRecordingsTable: React.FC<ArchivedRecordingsTableProps> = (
context.notificationChannel.messages(NotificationCategory.ActiveRecordingSaved),
),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) =>
Expand All @@ -326,7 +326,7 @@ export const ArchivedRecordingsTable: React.FC<ArchivedRecordingsTableProps> = (
propsTarget,
context.notificationChannel.messages(NotificationCategory.ArchivedRecordingDeleted),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) => old.filter((r) => r.name !== event.message.recording.name));
Expand All @@ -341,7 +341,7 @@ export const ArchivedRecordingsTable: React.FC<ArchivedRecordingsTableProps> = (
propsTarget,
context.notificationChannel.messages(NotificationCategory.RecordingMetadataUpdated),
]).subscribe(([currentTarget, event]) => {
if (currentTarget?.connectUrl != event.message.target && currentTarget?.jvmId != event.message.jvmId) {
if (currentTarget?.jvmId != event.message.jvmId) {
return;
}
setRecordings((old) =>
Expand Down
8 changes: 6 additions & 2 deletions src/app/Topology/Entity/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ export const getConnectUrlFromEvent = (event: NotificationMessage): string | und
return event.message.target || event.message.targetId;
};

export const getJvmIdFromEvent = (event: NotificationMessage): string | undefined => {
return event.message.jvmId;
};

export const useResources = <R = ResourceTypes,>(
targetNode: TargetNode,
resourceType: TargetOwnedResourceType | TargetRelatedResourceType,
Expand Down Expand Up @@ -344,9 +348,9 @@ export const useResources = <R = ResourceTypes,>(
),
)
.subscribe(([targetNode, event]) => {
const extractedUrl = getConnectUrlFromEvent(event);
const extractedJvmId = getJvmIdFromEvent(event);
const isOwned = isOwnedResource(resourceType);
if (!isOwned || (extractedUrl && extractedUrl === targetNode.target.connectUrl)) {
if (!isOwned || (extractedJvmId && extractedJvmId === targetNode.target.jvmId)) {
setLoading(true);
setResources((old) => {
// Avoid accessing state directly, which
Expand Down

0 comments on commit 422bc0d

Please sign in to comment.