From a5dac6c516c87dbdeeedf466e6b47ae78c23a097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Fri, 2 Dec 2022 17:30:29 +0000 Subject: [PATCH] fix(ui): don't show receivers twice --- CHANGELOG.md | 6 ++++++ .../Grid/AlertGrid/AlertGroup/GroupFooter/index.tsx | 4 +++- ui/src/Components/Grid/AlertGrid/AlertGroup/index.tsx | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 495051b94..9f2d5cacc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v0.111 + +### Fixed + +- Fixed duplicated `@receiver` labels showing both on the alert and in the footer. + ## v0.110 ### Fixed diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.tsx b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.tsx index 712d5b9c7..e972eb74f 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.tsx +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.tsx @@ -17,6 +17,7 @@ const GroupFooter: FC<{ silenceFormStore: SilenceFormStore; showAnnotations?: boolean; showSilences?: boolean; + showReceiver?: boolean; }> = ({ group, afterUpdate, @@ -24,6 +25,7 @@ const GroupFooter: FC<{ silenceFormStore, showAnnotations = true, showSilences = true, + showReceiver = true, }) => { const total = (showAnnotations @@ -36,7 +38,7 @@ const GroupFooter: FC<{ (Object.keys(alertStore.data.upstreams.clusters).length > 1 ? group.shared.clusters.length : 0) + - (alertStore.data.receivers.length > 1 ? 1 : 0) + + (alertStore.data.receivers.length > 1 ? (showReceiver ? 1 : 0) : 0) + (showSilences ? Object.keys(group.shared.silences).length : 0); if (total === 0) { return null; diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/index.tsx b/ui/src/Components/Grid/AlertGrid/AlertGroup/index.tsx index 14ed231ea..a78d7ef7c 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/index.tsx +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/index.tsx @@ -236,6 +236,12 @@ const AlertGroup: FC<{ silenceFormStore={silenceFormStore} showAnnotations={!alertStore.ui.isIdle} showSilences={!alertStore.ui.isIdle} + showReceiver={ + !( + alertStore.data.receivers.length > 1 && + group.alerts.length === 1 + ) + } /> ) : null}