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 { interface ReceiverErrorProps {
errorCount: number; errorCount: number;
errorDetail?: string;
} }
function ReceiverError({ errorCount }: ReceiverErrorProps) { function ReceiverError({ errorCount, errorDetail }: ReceiverErrorProps) {
return ( return (
<Badge <Badge
color="orange" color="orange"
icon="exclamation-triangle" icon="exclamation-triangle"
text={`${errorCount} ${pluralize('error', errorCount)}`} text={`${errorCount} ${pluralize('error', errorCount)}`}
tooltip={`${errorCount} ${pluralize('error', errorCount)} detected in this contact point`} tooltip={errorDetail}
/> />
); );
} }
interface ReceiverHealthProps { interface ReceiverHealthProps {
errorsByReceiver: number; errorsByReceiver: number;
errorDetail?: string;
} }
function ReceiverHealth({ errorsByReceiver }: ReceiverHealthProps) { function ReceiverHealth({ errorsByReceiver, errorDetail }: ReceiverHealthProps) {
return errorsByReceiver > 0 ? ( return errorsByReceiver > 0 ? (
<ReceiverError errorCount={errorsByReceiver} /> <ReceiverError errorCount={errorsByReceiver} errorDetail={errorDetail} />
) : ( ) : (
<Badge color="green" text="OK" tooltip="No errors detected" /> <Badge color="green" text="OK" tooltip="No errors detected" />
); );
@@ -157,7 +159,7 @@ function NotifiersTable({ notifiersState }: NotifiersTableProps) {
id: 'health', id: 'health',
label: 'Health', label: 'Health',
renderCell: ({ data: { lastError } }) => { renderCell: ({ data: { lastError } }) => {
return <ReceiverHealth errorsByReceiver={lastError ? 1 : 0} />; return <ReceiverHealth errorsByReceiver={lastError ? 1 : 0} errorDetail={lastError ?? undefined} />;
}, },
size: 0.5, size: 0.5,
}, },