From ae86f9f10c2669adaae596bc1b06a66b17afacf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Mon, 11 Nov 2019 22:43:23 +0000 Subject: [PATCH] fix(ui): migrate to @silence_ticket filters --- ui/src/Components/MainModal/Help.js | 20 +++++++++---------- .../MainModal/__snapshots__/Help.test.js.snap | 16 +++++++-------- .../ManagedSilence/SilenceComment.js | 4 ++-- .../ManagedSilence/SilenceComment.test.js | 8 ++++---- ui/src/Models/API.js | 4 ++-- ui/src/__mocks__/Alerts.js | 4 ++-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ui/src/Components/MainModal/Help.js b/ui/src/Components/MainModal/Help.js index 5f71d5dba..9c5ac33c6 100644 --- a/ui/src/Components/MainModal/Help.js +++ b/ui/src/Components/MainModal/Help.js @@ -237,21 +237,21 @@ const Help = () => ( - - Match silenced alerts where detected JIRA issue id is equal to{" "} + + Match silenced alerts where detected ticket ID is equal to{" "} PROJECT-123. - - Match silenced alerts where detected JIRA issue id is different - than PROJECT-123. + + Match silenced alerts where detected ticket ID is different than{" "} + PROJECT-123. - - Match silenced alerts where detected JIRA issue id matches regular + + Match silenced alerts where detected ticket ID matches regular expression /.*PROJECT.*/. diff --git a/ui/src/Components/MainModal/__snapshots__/Help.test.js.snap b/ui/src/Components/MainModal/__snapshots__/Help.test.js.snap index 536e94a95..ef0a08358 100644 --- a/ui/src/Components/MainModal/__snapshots__/Help.test.js.snap +++ b/ui/src/Components/MainModal/__snapshots__/Help.test.js.snap @@ -667,7 +667,7 @@ exports[` matches snapshot 1`] = `
- Match alerts based on the jira linked in the silence + Match alerts based on the ticket IDs detected in the silence comment
@@ -700,7 +700,7 @@ exports[` matches snapshot 1`] = ` > - This is supported only if JIRA regexp are enabled and able to match JIRA ids in the silence comment body. + This is supported only if ticket regexp are enabled and able to match ticket IDs in the silence comment.
Examples: @@ -709,11 +709,11 @@ exports[` matches snapshot 1`] = `
  • - @silence_jira=PROJECT-123 + @silence_ticket=PROJECT-123
    - Match silenced alerts where detected JIRA issue id is equal to + Match silenced alerts where detected ticket ID is equal to PROJECT-123 @@ -723,11 +723,11 @@ exports[` matches snapshot 1`] = `
  • - @silence_jira!=PROJECT-123 + @silence_ticket!=PROJECT-123
    - Match silenced alerts where detected JIRA issue id is different than + Match silenced alerts where detected ticket ID is different than PROJECT-123 @@ -737,11 +737,11 @@ exports[` matches snapshot 1`] = `
  • - @silence_jira=~PROJECT + @silence_ticket=~PROJECT
    - Match silenced alerts where detected JIRA issue id matches regular expression + Match silenced alerts where detected ticket ID matches regular expression /.*PROJECT.*/ diff --git a/ui/src/Components/ManagedSilence/SilenceComment.js b/ui/src/Components/ManagedSilence/SilenceComment.js index 8789dbe4f..c4a59986d 100644 --- a/ui/src/Components/ManagedSilence/SilenceComment.js +++ b/ui/src/Components/ManagedSilence/SilenceComment.js @@ -22,9 +22,9 @@ const SilenceComment = ({ afterUpdate, alertStore }) => { - const comment = silence.jiraURL ? ( + const comment = silence.ticketURL ? ( ", () => { }); it("Renders a JIRA link if present", () => { - silence.jiraURL = "http://localhost/1234"; - silence.jiraID = "1234"; + silence.ticketURL = "http://localhost/1234"; + silence.ticketID = "1234"; const tree = MountedSilenceComment(true); expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1); }); it("Renders a JIRA link if present and comment is expanded", () => { - silence.jiraURL = "http://localhost/1234"; - silence.jiraID = "1234"; + silence.ticketURL = "http://localhost/1234"; + silence.ticketID = "1234"; const tree = MountedSilenceComment(false); expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1); }); diff --git a/ui/src/Models/API.js b/ui/src/Models/API.js index 61710615f..e6e7e9c44 100644 --- a/ui/src/Models/API.js +++ b/ui/src/Models/API.js @@ -61,8 +61,8 @@ const APISilence = PropTypes.exact({ createdAt: PropTypes.string.isRequired, createdBy: PropTypes.string.isRequired, comment: PropTypes.string.isRequired, - jiraID: PropTypes.string.isRequired, - jiraURL: PropTypes.string.isRequired + ticketID: PropTypes.string.isRequired, + ticketURL: PropTypes.string.isRequired }); const APIAlertmanagerUpstream = PropTypes.exact({ diff --git a/ui/src/__mocks__/Alerts.js b/ui/src/__mocks__/Alerts.js index edaf24c93..afec1d72a 100644 --- a/ui/src/__mocks__/Alerts.js +++ b/ui/src/__mocks__/Alerts.js @@ -58,8 +58,8 @@ const MockSilence = () => ({ startsAt: "2000-01-01T00:00:00Z", endsAt: "2000-01-01T01:00:00Z", id: "04d37636-2350-4878-b382-e0b50353230f", - jiraID: "", - jiraURL: "", + ticketID: "", + ticketURL: "", matchers: [ { name: "foo", value: "bar", isRegex: false }, { name: "baz", value: "regex", isRegex: true }