diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-22 15:09:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-22 15:09:39 +0300 |
commit | 26879909dd0571b392f105373a700a314201cd53 (patch) | |
tree | 800cb6476926e919ce7cabdcadd58a1cdb3178e1 /app/presenters/alert_management | |
parent | 1086ac5177a6762ac14bccc6ce5584781bd44d1c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters/alert_management')
-rw-r--r-- | app/presenters/alert_management/alert_presenter.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/presenters/alert_management/alert_presenter.rb b/app/presenters/alert_management/alert_presenter.rb index 5debe6d5dbd..aafc18084fd 100644 --- a/app/presenters/alert_management/alert_presenter.rb +++ b/app/presenters/alert_management/alert_presenter.rb @@ -8,6 +8,7 @@ module AlertManagement MARKDOWN_LINE_BREAK = " \n" HORIZONTAL_LINE = "\n\n---\n\n" + INCIDENT_LABEL_NAME = ::IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES[:title] delegate :metrics_dashboard_url, :runbook, to: :parsed_payload @@ -38,6 +39,30 @@ module AlertManagement Gitlab::Utils::InlineHash.merge_keys(payload) end + def show_incident_issues_link? + project.incident_management_setting&.create_issue? + end + + def show_performance_dashboard_link? + prometheus_alert.present? + end + + def incident_issues_link + project_issues_url(project, label_name: INCIDENT_LABEL_NAME) + end + + def performance_dashboard_link + if environment + metrics_project_environment_url(project, environment) + else + metrics_project_environments_url(project) + end + end + + def email_title + [environment&.name, query_title].compact.join(': ') + end + private attr_reader :alert, :project @@ -80,5 +105,11 @@ module AlertManagement def host_links hosts.join(' ') end + + def query_title + return title unless prometheus_alert + + "#{prometheus_alert.title} #{prometheus_alert.computed_operator} #{prometheus_alert.threshold} for 5 minutes" + end end end |