From 156cfde84b38fd15e8d3fbac5fd34f8903da67f2 Mon Sep 17 00:00:00 2001 From: Moshe Immermam Date: Fri, 8 Nov 2024 12:04:12 +0200 Subject: [PATCH] feat: add notification silence filter --- src/api/types/notifications.ts | 2 ++ .../NotificationSilenceForm.tsx | 6 ++++++ .../Notifications/SilenceNotificationsList.tsx | 14 ++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/api/types/notifications.ts b/src/api/types/notifications.ts index 725a7b9b5..25a139aad 100644 --- a/src/api/types/notifications.ts +++ b/src/api/types/notifications.ts @@ -45,6 +45,7 @@ export type NotificationRules = { export type SilenceNotificationResponse = { id: string; + filter?: string; component_id?: string; config_id?: string; check_id?: string; @@ -85,6 +86,7 @@ export type NotificationSilenceItem = { id: string; namespace: string; description?: string; + filter?: string; from: string; until: string; recursive?: boolean; diff --git a/src/components/Notifications/SilenceNotificationForm/NotificationSilenceForm.tsx b/src/components/Notifications/SilenceNotificationForm/NotificationSilenceForm.tsx index bdd31fcaf..57919563a 100644 --- a/src/components/Notifications/SilenceNotificationForm/NotificationSilenceForm.tsx +++ b/src/components/Notifications/SilenceNotificationForm/NotificationSilenceForm.tsx @@ -53,6 +53,7 @@ export default function NotificationSilenceForm({ if (data.id) { return updateNotificationSilence({ id: data.id, + filter: data.filter, updated_at: "now()", source: data.source, canary_id: data.canary_id, @@ -126,6 +127,11 @@ export default function NotificationSilenceForm({ label="Silence Duration" /> +
{data?.id && ( diff --git a/src/components/Notifications/SilenceNotificationsList.tsx b/src/components/Notifications/SilenceNotificationsList.tsx index 369b7a995..c75e1c1c0 100644 --- a/src/components/Notifications/SilenceNotificationsList.tsx +++ b/src/components/Notifications/SilenceNotificationsList.tsx @@ -187,6 +187,20 @@ const silenceNotificationListColumns: MRT_ColumnDef { + const isExpired = dayjs(row.original.until).isBefore(dayjs()); + return ( + + {row.original.filter} + + ); + } + }, { header: "Reason", accessorKey: "description",