From 98d49fe877aa8550ef84fc41ef1b87bbd82fdb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Wed, 10 Aug 2022 18:32:44 +0100 Subject: [PATCH] fix(ui): always show alerts if there are any Fixes #4301 --- CHANGELOG.md | 8 ++++++++ ui/src/Components/Grid/index.test.tsx | 24 ++++++++++++++++++++++++ ui/src/Components/Grid/index.tsx | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 262d87fd3..5ab41ee26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## v0.107 + +### Changed + +- Don't show fatal error page if configured health checks are failing but + alertmanager is still showing alerts. A popup message with will still + be visible. + ## v0.106 ### Added diff --git a/ui/src/Components/Grid/index.test.tsx b/ui/src/Components/Grid/index.test.tsx index 35e518e56..ba560bcad 100644 --- a/ui/src/Components/Grid/index.test.tsx +++ b/ui/src/Components/Grid/index.test.tsx @@ -62,6 +62,30 @@ describe("", () => { expect(tree.text()).toBe(""); }); + it("renders AlertGrid if there's only one upstream and it's unhealthy but there are alerts", () => { + alertStore.data.setUpstreams({ + counters: { total: 1, healthy: 0, failed: 1 }, + instances: [ + { + name: "am1", + cluster: "am", + clusterMembers: ["am"], + uri: "http://am1", + publicURI: "http://am1", + error: "error", + version: "0.24.0", + readonly: false, + corsCredentials: "include", + headers: {}, + }, + ], + clusters: { am1: ["am1"] }, + }); + alertStore.info.setTotalAlerts(1); + const tree = ShallowGrid(); + expect(tree.find("Memo(AlertGrid)")).toHaveLength(1); + }); + it("renders FatalError if there's only one upstream and it's unhealthy but without any error", () => { alertStore.data.setUpstreams({ counters: { total: 1, healthy: 0, failed: 1 }, diff --git a/ui/src/Components/Grid/index.tsx b/ui/src/Components/Grid/index.tsx index 9b159fab0..e8e9d0f8d 100644 --- a/ui/src/Components/Grid/index.tsx +++ b/ui/src/Components/Grid/index.tsx @@ -27,7 +27,8 @@ const Grid: FC<{ alertStore.data.upstreams.counters.total === 1 && alertStore.data.upstreams.counters.healthy === 0 && alertStore.data.upstreams.instances[0] && - alertStore.data.upstreams.instances[0].error !== "" ? ( + alertStore.data.upstreams.instances[0].error !== "" && + alertStore.info.totalAlerts === 0 ? ( ) : alertStore.info.version !== "unknown" && alertStore.info.totalAlerts === 0 ? (