diff --git a/src/app/Diagnostics/ThreadDumpsTable.tsx b/src/app/Diagnostics/ThreadDumpsTable.tsx index 852ba650b..b6f43183d 100644 --- a/src/app/Diagnostics/ThreadDumpsTable.tsx +++ b/src/app/Diagnostics/ThreadDumpsTable.tsx @@ -141,7 +141,7 @@ export const ThreadDumpsTable: React.FC = ({}) => { (threadDump: ThreadDump) => { addSubscription( context.api.deleteThreadDump(threadDump.threadDumpId).subscribe(() => { - setThreadDumps((old) => old.filter((t) => t.threadDumpId !== threadDump.threadDumpId)); + // do nothing - table state update is performed by ThreadDumpDeleted notification handler }), ); }, @@ -173,6 +173,14 @@ export const ThreadDumpsTable: React.FC = ({}) => { ); }, [addSubscription, context.notificationChannel, refreshThreadDumps]); + React.useEffect(() => { + addSubscription( + context.notificationChannel.messages(NotificationCategory.ThreadDumpDeleted).subscribe((msg) => { + setThreadDumps((old) => old.filter((t) => t.threadDumpId !== msg.message.threadDumpId)); + }), + ); + }, [addSubscription, context.notificationChannel, refreshThreadDumps]); + React.useEffect(() => { addSubscription( context.target.target().subscribe(() => { diff --git a/src/app/Shared/Services/api.types.ts b/src/app/Shared/Services/api.types.ts index 40b2e4805..0ad429d4c 100644 --- a/src/app/Shared/Services/api.types.ts +++ b/src/app/Shared/Services/api.types.ts @@ -557,6 +557,7 @@ export enum NotificationCategory { TargetCredentialsDeleted = 'TargetCredentialsDeleted', ThreadDumpSuccess = 'ThreadDumpSuccess', ThreadDumpFailure = 'ThreadDumpFailure', + ThreadDumpDeleted = 'ThreadDumpDeleted', CredentialsStored = 'CredentialsStored', CredentialsDeleted = 'CredentialsDeleted', ReportSuccess = 'ReportSuccess', diff --git a/src/app/Shared/Services/api.utils.ts b/src/app/Shared/Services/api.utils.ts index 19c96bfc2..c8946a9b2 100644 --- a/src/app/Shared/Services/api.utils.ts +++ b/src/app/Shared/Services/api.utils.ts @@ -406,6 +406,14 @@ export const messageKeys = new Map([ body: (evt) => `Failed to create Thread Dump for target: ${evt.message.targetId}`, } as NotificationMessageMapper, ], + [ + NotificationCategory.ThreadDumpDeleted, + { + variant: AlertVariant.success, + title: 'Thread Dump Deleted', + body: (evt) => `${evt.message.threadDumpId} was deleted`, + } as NotificationMessageMapper, + ], [ NotificationCategory.CredentialsStored, { diff --git a/src/test/Settings/__snapshots__/NotificationControl.test.tsx.snap b/src/test/Settings/__snapshots__/NotificationControl.test.tsx.snap index 986e43392..4d63b6f28 100644 --- a/src/test/Settings/__snapshots__/NotificationControl.test.tsx.snap +++ b/src/test/Settings/__snapshots__/NotificationControl.test.tsx.snap @@ -1336,6 +1336,45 @@ exports[` renders correctly 1`] = ` data-ouia-component-id="OUIA-Generated-Switch-30" data-ouia-component-type="PF5/Switch" data-ouia-safe={true} + htmlFor="ThreadDumpDeleted" + > + + + + + + +
+