fix(ui): migrate to @silence_ticket filters

This commit is contained in:
Łukasz Mierzwa
2019-11-11 23:24:06 +00:00
parent 0015d3fa4e
commit ae86f9f10c
6 changed files with 28 additions and 28 deletions
+10 -10
View File
@@ -237,21 +237,21 @@ const Help = () => (
</QueryHelp>
<QueryHelp
title="Match alerts based on the jira linked in the silence"
title="Match alerts based on the ticket IDs detected in the silence comment"
operators={["=", "!=", "=~", "!~"]}
warning="This is supported only if JIRA regexp are enabled and able to
match JIRA ids in the silence comment body."
warning="This is supported only if ticket regexp are enabled and able to
match ticket IDs in the silence comment."
>
<FilterExample example="@silence_jira=PROJECT-123">
Match silenced alerts where detected JIRA issue id is equal to{" "}
<FilterExample example="@silence_ticket=PROJECT-123">
Match silenced alerts where detected ticket ID is equal to{" "}
<code>PROJECT-123</code>.
</FilterExample>
<FilterExample example="@silence_jira!=PROJECT-123">
Match silenced alerts where detected JIRA issue id is different
than <code>PROJECT-123</code>.
<FilterExample example="@silence_ticket!=PROJECT-123">
Match silenced alerts where detected ticket ID is different than{" "}
<code>PROJECT-123</code>.
</FilterExample>
<FilterExample example="@silence_jira=~PROJECT">
Match silenced alerts where detected JIRA issue id matches regular
<FilterExample example="@silence_ticket=~PROJECT">
Match silenced alerts where detected ticket ID matches regular
expression <code>/.*PROJECT.*/</code>.
</FilterExample>
</QueryHelp>
@@ -667,7 +667,7 @@ exports[`<Help /> matches snapshot 1`] = `
</ul>
</dd>
<dt>
Match alerts based on the jira linked in the silence
Match alerts based on the ticket IDs detected in the silence comment
</dt>
<dd class=\\"mb-5\\">
<div>
@@ -700,7 +700,7 @@ exports[`<Help /> matches snapshot 1`] = `
>
</path>
</svg>
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.
</div>
<div>
Examples:
@@ -709,11 +709,11 @@ exports[`<Help /> matches snapshot 1`] = `
<li>
<div>
<span class=\\"badge badge-info\\">
@silence_jira=PROJECT-123
@silence_ticket=PROJECT-123
</span>
</div>
<div>
Match silenced alerts where detected JIRA issue id is equal to
Match silenced alerts where detected ticket ID is equal to
<code>
PROJECT-123
</code>
@@ -723,11 +723,11 @@ exports[`<Help /> matches snapshot 1`] = `
<li>
<div>
<span class=\\"badge badge-info\\">
@silence_jira!=PROJECT-123
@silence_ticket!=PROJECT-123
</span>
</div>
<div>
Match silenced alerts where detected JIRA issue id is different than
Match silenced alerts where detected ticket ID is different than
<code>
PROJECT-123
</code>
@@ -737,11 +737,11 @@ exports[`<Help /> matches snapshot 1`] = `
<li>
<div>
<span class=\\"badge badge-info\\">
@silence_jira=~PROJECT
@silence_ticket=~PROJECT
</span>
</div>
<div>
Match silenced alerts where detected JIRA issue id matches regular expression
Match silenced alerts where detected ticket ID matches regular expression
<code>
/.*PROJECT.*/
</code>
@@ -22,9 +22,9 @@ const SilenceComment = ({
afterUpdate,
alertStore
}) => {
const comment = silence.jiraURL ? (
const comment = silence.ticketURL ? (
<a
href={silence.jiraURL}
href={silence.ticketURL}
target="_blank"
rel="noopener noreferrer"
className={
@@ -98,15 +98,15 @@ describe("<SilenceComment />", () => {
});
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);
});
+2 -2
View File
@@ -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({
+2 -2
View File
@@ -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 }