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 ...@@ -35,10 +35,10 @@ module Projects
def issue_summary_markdown def issue_summary_markdown
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
## Summary #### Summary
#{metadata_list} #{metadata_list}
#{annotation_list} #{alert_details}
MARKDOWN MARKDOWN
end end
...@@ -63,6 +63,17 @@ module Projects ...@@ -63,6 +63,17 @@ module Projects
metadata.join("\n") metadata.join("\n")
end end
def alert_details
if annotation_list.present?
<<~MARKDOWN.chomp
#### Alert Details
#{annotation_list}
MARKDOWN
end
end
def annotation_list def annotation_list
strong_memoize(:annotation_list) do strong_memoize(:annotation_list) do
annotations annotations
......
...@@ -43,7 +43,7 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -43,7 +43,7 @@ describe Projects::Prometheus::AlertPresenter do
it do it do
is_expected.to eq( is_expected.to eq(
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
## Summary #### Summary
* starts_at: #{presenter.starts_at} * starts_at: #{presenter.starts_at}
...@@ -60,9 +60,12 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -60,9 +60,12 @@ describe Projects::Prometheus::AlertPresenter do
it do it do
is_expected.to eq( is_expected.to eq(
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
## Summary #### Summary
* starts_at: #{presenter.starts_at} * starts_at: #{presenter.starts_at}
#### Alert Details
* foo: value1 * foo: value1
* bar: value2 * bar: value2
MARKDOWN MARKDOWN
...@@ -78,7 +81,7 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -78,7 +81,7 @@ describe Projects::Prometheus::AlertPresenter do
it do it do
is_expected.to eq( is_expected.to eq(
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
## Summary #### Summary
* starts_at: #{presenter.starts_at} * starts_at: #{presenter.starts_at}
* full_query: `query` * 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