Commit 98344b6b authored by Vitali Tatarintev's avatar Vitali Tatarintev

Split alert body into two sections

Split alert issue's body into Summary and Alert Details sections
parent 4190ebe2
......@@ -35,10 +35,10 @@ module Projects
def issue_summary_markdown
<<~MARKDOWN.chomp
## Summary
#### Summary
#{metadata_list}
#{annotation_list}
#{alert_details}
MARKDOWN
end
......@@ -63,6 +63,17 @@ module Projects
metadata.join("\n")
end
def alert_details
if annotation_list.present?
<<~MARKDOWN.chomp
#### Alert Details
#{annotation_list}
MARKDOWN
end
end
def annotation_list
strong_memoize(:annotation_list) do
annotations
......
......@@ -43,7 +43,7 @@ describe Projects::Prometheus::AlertPresenter do
it do
is_expected.to eq(
<<~MARKDOWN.chomp
## Summary
#### Summary
* starts_at: #{presenter.starts_at}
......@@ -60,9 +60,12 @@ describe Projects::Prometheus::AlertPresenter do
it do
is_expected.to eq(
<<~MARKDOWN.chomp
## Summary
#### Summary
* starts_at: #{presenter.starts_at}
#### Alert Details
* foo: value1
* bar: value2
MARKDOWN
......@@ -78,7 +81,7 @@ describe Projects::Prometheus::AlertPresenter do
it do
is_expected.to eq(
<<~MARKDOWN.chomp
## Summary
#### Summary
* starts_at: #{presenter.starts_at}
* full_query: `query`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment