From 756539d744d374227df3f663f5a281073cc79fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 11 Sep 2018 21:03:47 +0100 Subject: [PATCH] fix(ui): use publicURI for alertmanager requests in the silence form --- .../SilenceModal/AlertManagerInput.js | 2 +- .../SilenceModal/AlertManagerInput.test.js | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ui/src/Components/SilenceModal/AlertManagerInput.js b/ui/src/Components/SilenceModal/AlertManagerInput.js index 134d5f743..19ed6397d 100644 --- a/ui/src/Components/SilenceModal/AlertManagerInput.js +++ b/ui/src/Components/SilenceModal/AlertManagerInput.js @@ -12,7 +12,7 @@ import { ValidationError } from "Components/MultiSelect/ValidationError"; const AlertmanagerInstancesToOptions = instances => instances.map(i => ({ label: i.name, - value: i.uri + value: i.publicURI })); const AlertManagerInput = observer( diff --git a/ui/src/Components/SilenceModal/AlertManagerInput.test.js b/ui/src/Components/SilenceModal/AlertManagerInput.test.js index 71e1fc883..1b7769bba 100644 --- a/ui/src/Components/SilenceModal/AlertManagerInput.test.js +++ b/ui/src/Components/SilenceModal/AlertManagerInput.test.js @@ -19,9 +19,24 @@ const AlertmanagerOption = index => ({ beforeEach(() => { alertStore = new AlertStore([]); alertStore.data.upstreams.instances = [ - { name: "am1", uri: "http://am1.example.com", error: "" }, - { name: "am2", uri: "http://am2.example.com", error: "" }, - { name: "am3", uri: "http://am3.example.com", error: "" } + { + name: "am1", + uri: "http://am1.example.com", + publicURI: "http://am1.example.com", + error: "" + }, + { + name: "am2", + uri: "http://am2.example.com", + publicURI: "http://am2.example.com", + error: "" + }, + { + name: "am3", + uri: "http://am3.example.com", + publicURI: "http://am3.example.com", + error: "" + } ]; silenceFormStore = new SilenceFormStore(); }); @@ -123,7 +138,7 @@ describe("", () => { const tree = ShallowAlertManagerInput(); alertStore.data.upstreams.instances[0] = { name: "am1", - uri: "http://am1.example.com/new", + publicURI: "http://am1.example.com/new", error: "" }; // force update since this is where the mismatch check lives