Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/app/Diagnostics/ThreadDumpsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const ThreadDumpsTable: React.FC<ThreadDumpsProps> = ({}) => {
(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
}),
);
},
Expand Down Expand Up @@ -173,6 +173,14 @@ export const ThreadDumpsTable: React.FC<ThreadDumpsProps> = ({}) => {
);
}, [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(() => {
Expand Down
1 change: 1 addition & 0 deletions src/app/Shared/Services/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ export enum NotificationCategory {
TargetCredentialsDeleted = 'TargetCredentialsDeleted',
ThreadDumpSuccess = 'ThreadDumpSuccess',
ThreadDumpFailure = 'ThreadDumpFailure',
ThreadDumpDeleted = 'ThreadDumpDeleted',
CredentialsStored = 'CredentialsStored',
CredentialsDeleted = 'CredentialsDeleted',
ReportSuccess = 'ReportSuccess',
Expand Down
8 changes: 8 additions & 0 deletions src/app/Shared/Services/api.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand Down
45 changes: 42 additions & 3 deletions src/test/Settings/__snapshots__/NotificationControl.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,45 @@ exports[`<NotificationControl/> renders correctly 1`] = `
data-ouia-component-id="OUIA-Generated-Switch-30"
data-ouia-component-type="PF5/Switch"
data-ouia-safe={true}
htmlFor="ThreadDumpDeleted"
>
<input
aria-label=""
aria-labelledby="ThreadDumpDeleted-on"
checked={true}
className="pf-v5-c-switch__input"
disabled={false}
id="ThreadDumpDeleted"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-v5-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-v5-c-switch__label pf-m-on"
id="ThreadDumpDeleted-on"
>
Thread Dump Deleted
</span>
<span
aria-hidden="true"
className="pf-v5-c-switch__label pf-m-off"
id="ThreadDumpDeleted-off"
>
Thread Dump Deleted
</span>
</label>
</div>
<div
className="pf-v5-l-stack__item"
>
<label
className="pf-v5-c-switch"
data-ouia-component-id="OUIA-Generated-Switch-31"
data-ouia-component-type="PF5/Switch"
data-ouia-safe={true}
htmlFor="CredentialsStored"
>
<input
Expand Down Expand Up @@ -1372,7 +1411,7 @@ exports[`<NotificationControl/> renders correctly 1`] = `
>
<label
className="pf-v5-c-switch"
data-ouia-component-id="OUIA-Generated-Switch-31"
data-ouia-component-id="OUIA-Generated-Switch-32"
data-ouia-component-type="PF5/Switch"
data-ouia-safe={true}
htmlFor="CredentialsDeleted"
Expand Down Expand Up @@ -1411,7 +1450,7 @@ exports[`<NotificationControl/> renders correctly 1`] = `
>
<label
className="pf-v5-c-switch"
data-ouia-component-id="OUIA-Generated-Switch-32"
data-ouia-component-id="OUIA-Generated-Switch-33"
data-ouia-component-type="PF5/Switch"
data-ouia-safe={true}
htmlFor="ReportSuccess"
Expand Down Expand Up @@ -1450,7 +1489,7 @@ exports[`<NotificationControl/> renders correctly 1`] = `
>
<label
className="pf-v5-c-switch"
data-ouia-component-id="OUIA-Generated-Switch-33"
data-ouia-component-id="OUIA-Generated-Switch-34"
data-ouia-component-type="PF5/Switch"
data-ouia-safe={true}
htmlFor="ReportFailure"
Expand Down
Loading