Commit bdbb6a8b authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'tr-remove-alert-detail-markdown' into 'master'

Remove alert detail markdown sections

See merge request gitlab-org/gitlab!42183
parents fb0b4a31 ad120393
...@@ -46,7 +46,7 @@ module AlertManagement ...@@ -46,7 +46,7 @@ module AlertManagement
def issue_summary_markdown def issue_summary_markdown
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
#{metadata_list} #{metadata_list}
#{alert_details}#{metric_embed_for_alert} #{metric_embed_for_alert}
MARKDOWN MARKDOWN
end end
...@@ -65,23 +65,6 @@ module AlertManagement ...@@ -65,23 +65,6 @@ module AlertManagement
metadata.join(MARKDOWN_LINE_BREAK) metadata.join(MARKDOWN_LINE_BREAK)
end end
def alert_details
if details.present?
<<~MARKDOWN.chomp
#### Alert Details
#{details_list}
MARKDOWN
end
end
def details_list
details
.map { |label, value| list_item(label, value) }
.join(MARKDOWN_LINE_BREAK)
end
def metric_embed_for_alert def metric_embed_for_alert
"\n[](#{metrics_dashboard_url})" if metrics_dashboard_url "\n[](#{metrics_dashboard_url})" if metrics_dashboard_url
end end
......
...@@ -51,18 +51,10 @@ module Projects ...@@ -51,18 +51,10 @@ module Projects
def issue_summary_markdown def issue_summary_markdown
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
#{metadata_list} #{metadata_list}
#{alert_details}#{metric_embed_for_alert} #{metric_embed_for_alert}
MARKDOWN MARKDOWN
end end
def details_list
strong_memoize(:details_list) do
details
.map { |label, value| list_item(label, value) }
.join(MARKDOWN_LINE_BREAK)
end
end
def metric_embed_for_alert def metric_embed_for_alert
"\n[](#{metrics_dashboard_url})" if metrics_dashboard_url "\n[](#{metrics_dashboard_url})" if metrics_dashboard_url
end end
...@@ -111,17 +103,6 @@ module Projects ...@@ -111,17 +103,6 @@ module Projects
Gitlab::Utils::InlineHash.merge_keys(payload) Gitlab::Utils::InlineHash.merge_keys(payload)
end end
def alert_details
if details.present?
<<~MARKDOWN.chomp
#### Alert Details
#{details_list}
MARKDOWN
end
end
def list_item(key, value) def list_item(key, value)
"**#{key}:** #{value}".strip "**#{key}:** #{value}".strip
end end
......
...@@ -65,12 +65,6 @@ RSpec.describe AlertManagement::AlertPresenter do ...@@ -65,12 +65,6 @@ RSpec.describe AlertManagement::AlertPresenter do
**Description:** #{alert.description}#{markdown_line_break} **Description:** #{alert.description}#{markdown_line_break}
**GitLab alert:** #{alert_url} **GitLab alert:** #{alert_url}
#### Alert Details
**title:** Alert title#{markdown_line_break}
**start_time:** 2020-04-27T10:10:22.265949279Z#{markdown_line_break}
**custom.alert.fields:** ["one", "two"]#{markdown_line_break}
**yet.another:** 73
MARKDOWN MARKDOWN
) )
end end
......
...@@ -65,9 +65,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do ...@@ -65,9 +65,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do
<<~MARKDOWN.chomp <<~MARKDOWN.chomp
**Start time:** #{presenter.start_time} **Start time:** #{presenter.start_time}
#### Alert Details
**startsAt:** #{presenter.starts_at_raw}
MARKDOWN MARKDOWN
) )
end end
...@@ -96,17 +93,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do ...@@ -96,17 +93,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do
**Monitoring tool:** monitoring_tool_name#{markdown_line_break} **Monitoring tool:** monitoring_tool_name#{markdown_line_break}
**Hosts:** http://localhost:3000 http://localhost:3001 **Hosts:** http://localhost:3000 http://localhost:3001
#### Alert Details
**annotations.hosts:** ["http://localhost:3000", "http://localhost:3001"]#{markdown_line_break}
**annotations.service:** service_name#{markdown_line_break}
**annotations.monitoring_tool:** monitoring_tool_name#{markdown_line_break}
**annotations.description:** Alert Description#{markdown_line_break}
**annotations.bar:** value2#{markdown_line_break}
**annotations.foo:** value1#{markdown_line_break}
**annotations.title:** Alert Title#{markdown_line_break}
**generatorURL:** http://host?g0.expr=query#{markdown_line_break}
**startsAt:** #{presenter.starts_at_raw}
MARKDOWN MARKDOWN
) )
end end
...@@ -123,10 +109,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do ...@@ -123,10 +109,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do
**Start time:** #{presenter.start_time}#{markdown_line_break} **Start time:** #{presenter.start_time}#{markdown_line_break}
**Hosts:** http://localhost:3000 **Hosts:** http://localhost:3000
#### Alert Details
**annotations.hosts:** http://localhost:3000#{markdown_line_break}
**startsAt:** #{presenter.starts_at_raw}
MARKDOWN MARKDOWN
) )
end end
......
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