Commit 935b2655 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Change alert list type

Change the type of alert details list from bulleted to description list
parent 98344b6b
...@@ -4,6 +4,7 @@ module Projects ...@@ -4,6 +4,7 @@ module Projects
module Prometheus module Prometheus
class AlertPresenter < Gitlab::View::Presenter::Delegated class AlertPresenter < Gitlab::View::Presenter::Delegated
RESERVED_ANNOTATIONS = %w(gitlab_incident_markdown).freeze RESERVED_ANNOTATIONS = %w(gitlab_incident_markdown).freeze
MARKDOWN_LINE_BREAK = " \n".freeze
def full_title def full_title
[environment_name, alert_title].compact.join(': ') [environment_name, alert_title].compact.join(': ')
...@@ -57,10 +58,10 @@ module Projects ...@@ -57,10 +58,10 @@ module Projects
def metadata_list def metadata_list
metadata = [] metadata = []
metadata << bullet('starts_at', starts_at) if starts_at metadata << list_item('starts_at', starts_at) if starts_at
metadata << bullet('full_query', backtick(full_query)) if full_query metadata << list_item('full_query', backtick(full_query)) if full_query
metadata.join("\n") metadata.join(MARKDOWN_LINE_BREAK)
end end
def alert_details def alert_details
...@@ -78,13 +79,13 @@ module Projects ...@@ -78,13 +79,13 @@ module Projects
strong_memoize(:annotation_list) do strong_memoize(:annotation_list) do
annotations annotations
.reject { |annotation| RESERVED_ANNOTATIONS.include?(annotation.label) } .reject { |annotation| RESERVED_ANNOTATIONS.include?(annotation.label) }
.map { |annotation| bullet(annotation.label, annotation.value) } .map { |annotation| list_item(annotation.label, annotation.value) }
.join("\n") .join(MARKDOWN_LINE_BREAK)
end end
end end
def bullet(key, value) def list_item(key, value)
"* #{key}: #{value}" "**#{key}:** #{value}".strip
end end
def backtick(value) def backtick(value)
......
...@@ -45,7 +45,7 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -45,7 +45,7 @@ describe Projects::Prometheus::AlertPresenter do
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
#### Summary #### Summary
* starts_at: #{presenter.starts_at} **starts_at:** #{presenter.starts_at}
MARKDOWN MARKDOWN
) )
...@@ -62,12 +62,11 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -62,12 +62,11 @@ describe Projects::Prometheus::AlertPresenter do
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
#### Summary #### Summary
* starts_at: #{presenter.starts_at} **starts_at:** #{presenter.starts_at}
#### Alert Details #### Alert Details
* foo: value1 **foo:** value1 \n**bar:** value2
* bar: value2
MARKDOWN MARKDOWN
) )
end end
...@@ -83,8 +82,7 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -83,8 +82,7 @@ describe Projects::Prometheus::AlertPresenter do
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
#### Summary #### Summary
* starts_at: #{presenter.starts_at} **starts_at:** #{presenter.starts_at} \n**full_query:** `query`
* full_query: `query`
MARKDOWN MARKDOWN
) )
......
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