diff --git a/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx b/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx
index 7855a715e4e..b441703c4bc 100644
--- a/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx
+++ b/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx
@@ -78,29 +78,54 @@ function ViewAction({ permissions, alertManagerName, receiverName }: ActionProps
}
interface ReceiverErrorProps {
errorCount: number;
+ errorDetail?: string;
}
-function ReceiverError({ errorCount }: ReceiverErrorProps) {
+function ReceiverError({ errorCount, errorDetail }: ReceiverErrorProps) {
return (
);
}
-interface ReceiverHealthProps {
- errorsByReceiver: number;
+interface NotifierHealthProps {
+ errorsByNotifier: number;
+ errorDetail?: string;
+ lastNotify: string;
}
-function ReceiverHealth({ errorsByReceiver }: ReceiverHealthProps) {
+function NotifierHealth({ errorsByNotifier, errorDetail, lastNotify }: NotifierHealthProps) {
+ const noErrorsColor = isLastNotifyNullDate(lastNotify) ? 'orange' : 'green';
+ const noErrorsText = isLastNotifyNullDate(lastNotify) ? 'No attempts' : 'OK';
+ return errorsByNotifier > 0 ? (
+
+ ) : (
+
+ );
+}
+
+interface ReceiverHealthProps {
+ errorsByReceiver: number;
+ someWithNoAttempt: boolean;
+}
+
+function ReceiverHealth({ errorsByReceiver, someWithNoAttempt }: ReceiverHealthProps) {
+ const noErrorsColor = someWithNoAttempt ? 'orange' : 'green';
+ const noErrorsText = someWithNoAttempt ? 'No attempts' : 'OK';
return errorsByReceiver > 0 ? (
) : (
-
+
);
}
+interface NotifierHealthProps {
+ errorsByNotifier: number;
+ errorDetail?: string;
+ lastNotify: string;
+}
const useContactPointsState = (alertManagerName: string) => {
const contactPointsStateRequest = useUnifiedAlertingSelector((state) => state.contactPointsState);
@@ -158,8 +183,14 @@ function NotifiersTable({ notifiersState }: NotifiersTableProps) {
{
id: 'health',
label: 'Health',
- renderCell: ({ data: { lastError } }) => {
- return ;
+ renderCell: ({ data: { lastError, lastNotify } }) => {
+ return (
+
+ );
},
size: 0.5,
},
@@ -192,16 +223,18 @@ function NotifiersTable({ notifiersState }: NotifiersTableProps) {
];
}
const notifierRows: NotifierItemTableProps[] = Object.entries(notifiersState).flatMap((typeState) =>
- typeState[1].map((notifierStatus, index) => ({
- id: index,
- data: {
- type: typeState[0],
- lastError: notifierStatus.lastNotifyAttemptError,
- lastNotify: notifierStatus.lastNotifyAttempt,
- lastNotifyDuration: notifierStatus.lastNotifyAttemptDuration,
- sendResolved: notifierStatus.sendResolved,
- },
- }))
+ typeState[1].map((notifierStatus, index) => {
+ return {
+ id: index,
+ data: {
+ type: typeState[0],
+ lastError: notifierStatus.lastNotifyAttemptError,
+ lastNotify: notifierStatus.lastNotifyAttempt,
+ lastNotifyDuration: notifierStatus.lastNotifyAttemptDuration,
+ sendResolved: notifierStatus.sendResolved,
+ },
+ };
+ })
);
return ;
@@ -319,6 +352,15 @@ export const ReceiversTable: FC = ({ config, alertManagerName }) => {
);
};
+const errorsByReceiver = (contactPointsState: ContactPointsState, receiverName: string) =>
+ contactPointsState?.receivers[receiverName]?.errorCount ?? 0;
+
+const someNotifiersWithNoAttempt = (contactPointsState: ContactPointsState, receiverName: string) => {
+ const notifiers = Object.values(contactPointsState?.receivers[receiverName]?.notifiers ?? {});
+ const hasSomeWitNoAttempt =
+ notifiers.length === 0 || notifiers.flat().some((status) => isLastNotifyNullDate(status.lastNotifyAttempt));
+ return hasSomeWitNoAttempt;
+};
function useGetColumns(
alertManagerName: string,
@@ -356,9 +398,14 @@ function useGetColumns(
id: 'health',
label: 'Health',
renderCell: ({ data: { name } }) => {
- const errorsByReceiver = (contactPointsState: ContactPointsState, receiverName: string) =>
- contactPointsState?.receivers[receiverName]?.errorCount ?? 0;
- return contactPointsState && ;
+ return (
+ contactPointsState && (
+
+ )
+ );
},
size: 1,
};