Add error details in notification error feedback tooltip (#56472)

This commit is contained in:
Sonia Aguilar
2022-10-06 16:20:07 +02:00
committed by GitHub
parent 66e8f39ce8
commit 01526d9053
@@ -78,25 +78,27 @@ function ViewAction({ permissions, alertManagerName, receiverName }: ActionProps
}
interface ReceiverErrorProps {
errorCount: number;
errorDetail?: string;
}
function ReceiverError({ errorCount }: ReceiverErrorProps) {
function ReceiverError({ errorCount, errorDetail }: ReceiverErrorProps) {
return (
<Badge
color="orange"
icon="exclamation-triangle"
text={`${errorCount} ${pluralize('error', errorCount)}`}
tooltip={`${errorCount} ${pluralize('error', errorCount)} detected in this contact point`}
tooltip={errorDetail}
/>
);
}
interface ReceiverHealthProps {
errorsByReceiver: number;
errorDetail?: string;
}
function ReceiverHealth({ errorsByReceiver }: ReceiverHealthProps) {
function ReceiverHealth({ errorsByReceiver, errorDetail }: ReceiverHealthProps) {
return errorsByReceiver > 0 ? (
<ReceiverError errorCount={errorsByReceiver} />
<ReceiverError errorCount={errorsByReceiver} errorDetail={errorDetail} />
) : (
<Badge color="green" text="OK" tooltip="No errors detected" />
);
@@ -157,7 +159,7 @@ function NotifiersTable({ notifiersState }: NotifiersTableProps) {
id: 'health',
label: 'Health',
renderCell: ({ data: { lastError } }) => {
return <ReceiverHealth errorsByReceiver={lastError ? 1 : 0} />;
return <ReceiverHealth errorsByReceiver={lastError ? 1 : 0} errorDetail={lastError ?? undefined} />;
},
size: 0.5,
},