From 3a905b748e42e7baae5b2fc6c5e7fc1feef15dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 1 Dec 2018 09:57:59 +0000 Subject: [PATCH] feat(api): consume Alertmanager cluster id in the UI --- .../Grid/AlertGrid/AlertGroup/Silence/index.test.js | 2 ++ .../Components/SilenceModal/AlertManagerInput/index.test.js | 4 ++++ .../SilenceModal/SilenceSubmit/SilenceSubmitProgress.test.js | 1 + ui/src/Models/API.js | 1 + ui/src/__mocks__/Alerts.js | 1 + 5 files changed, 9 insertions(+) diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Silence/index.test.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Silence/index.test.js index 4e271c32f..e3a0c412f 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Silence/index.test.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Silence/index.test.js @@ -62,6 +62,7 @@ beforeEach(() => { instances: [ { name: "default", + cluster: "default", uri: "file:///mock", publicURI: "http://example.com", error: "", @@ -187,6 +188,7 @@ describe("", () => { const am = instance.getAlertmanager(); expect(am).toEqual({ name: "default", + cluster: "default", uri: "file:///mock", publicURI: "http://example.com", error: "", diff --git a/ui/src/Components/SilenceModal/AlertManagerInput/index.test.js b/ui/src/Components/SilenceModal/AlertManagerInput/index.test.js index 053baef9c..17c9a84f7 100644 --- a/ui/src/Components/SilenceModal/AlertManagerInput/index.test.js +++ b/ui/src/Components/SilenceModal/AlertManagerInput/index.test.js @@ -25,6 +25,7 @@ beforeEach(() => { publicURI: "http://am1.example.com", error: "", version: "0.15.0", + cluster: "am1", clusterMembers: ["am1"] }, { @@ -33,6 +34,7 @@ beforeEach(() => { publicURI: "http://am2.example.com", error: "", version: "0.15.0", + cluster: "am2", clusterMembers: ["am2"] }, { @@ -41,6 +43,7 @@ beforeEach(() => { publicURI: "http://am3.example.com", error: "", version: "0.15.0", + cluster: "am3", clusterMembers: ["am3"] } ]; @@ -147,6 +150,7 @@ describe("", () => { publicURI: "http://am1.example.com/new", error: "", version: "0.15.0", + cluster: "am1", clusterMembers: ["am1"] }; // force update since this is where the mismatch check lives diff --git a/ui/src/Components/SilenceModal/SilenceSubmit/SilenceSubmitProgress.test.js b/ui/src/Components/SilenceModal/SilenceSubmit/SilenceSubmitProgress.test.js index 426673055..264ded049 100644 --- a/ui/src/Components/SilenceModal/SilenceSubmit/SilenceSubmitProgress.test.js +++ b/ui/src/Components/SilenceModal/SilenceSubmit/SilenceSubmitProgress.test.js @@ -19,6 +19,7 @@ beforeEach(() => { publicURI: "http://example.com", error: "", version: "0.15.0", + cluster: "mockAlertmanager", clusterMembers: ["mockAlertmanager"] } ] diff --git a/ui/src/Models/API.js b/ui/src/Models/API.js index 9f837e44f..d21ef96dd 100644 --- a/ui/src/Models/API.js +++ b/ui/src/Models/API.js @@ -66,6 +66,7 @@ const APISilence = PropTypes.exact({ const APIAlertmanagerUpstream = PropTypes.exact({ name: PropTypes.string.isRequired, + cluster: PropTypes.string.isRequired, uri: PropTypes.string.isRequired, publicURI: PropTypes.string.isRequired, error: PropTypes.string.isRequired, diff --git a/ui/src/__mocks__/Alerts.js b/ui/src/__mocks__/Alerts.js index 19e8c5077..82b74eb77 100644 --- a/ui/src/__mocks__/Alerts.js +++ b/ui/src/__mocks__/Alerts.js @@ -66,6 +66,7 @@ const MockSilence = () => ({ const MockAlertmanager = () => ({ name: "default", + cluster: "default", uri: "http://localhost", publicURI: "http://am.example.com", error: "",