summaryrefslogtreecommitdiff
path: root/app/helpers/ci
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/ci')
-rw-r--r--app/helpers/ci/jobs_helper.rb1
-rw-r--r--app/helpers/ci/pipelines_helper.rb33
2 files changed, 27 insertions, 7 deletions
diff --git a/app/helpers/ci/jobs_helper.rb b/app/helpers/ci/jobs_helper.rb
index 0344413b849..e876eb64029 100644
--- a/app/helpers/ci/jobs_helper.rb
+++ b/app/helpers/ci/jobs_helper.rb
@@ -6,6 +6,7 @@ module Ci
{
"endpoint" => project_job_path(@project, @build, format: :json),
"project_path" => @project.full_path,
+ "artifact_help_url" => help_page_path('user/gitlab_com/index.html', anchor: 'gitlab-cicd'),
"deployment_help_url" => help_page_path('user/project/clusters/index.html', anchor: 'troubleshooting'),
"runner_help_url" => help_page_path('ci/runners/README.html', anchor: 'set-maximum-job-timeout-for-a-runner'),
"runner_settings_url" => project_runners_path(@build.project, anchor: 'js-runners-settings'),
diff --git a/app/helpers/ci/pipelines_helper.rb b/app/helpers/ci/pipelines_helper.rb
index 749726e0e33..309aa477108 100644
--- a/app/helpers/ci/pipelines_helper.rb
+++ b/app/helpers/ci/pipelines_helper.rb
@@ -2,16 +2,35 @@
module Ci
module PipelinesHelper
+ include Gitlab::Ci::Warnings
+
def pipeline_warnings(pipeline)
return unless pipeline.warning_messages.any?
- content_tag(:div, class: 'alert alert-warning') do
- content_tag(:h4, 'Warning:') <<
- content_tag(:div) do
- pipeline.warning_messages.each do |warning|
- concat(markdown(warning.content))
- end
- end
+ total_warnings = pipeline.warning_messages.length
+ message = warning_header(total_warnings)
+
+ content_tag(:div, class: 'bs-callout bs-callout-warning') do
+ content_tag(:details) do
+ concat content_tag(:summary, message, class: 'gl-mb-2')
+ warning_markdown(pipeline) { |markdown| concat markdown }
+ end
+ end
+ end
+
+ def warning_header(count)
+ message = _("%{total_warnings} warning(s) found:") % { total_warnings: count }
+
+ return message unless count > MAX_LIMIT
+
+ _("%{message} showing first %{warnings_displayed}") % { message: message, warnings_displayed: MAX_LIMIT }
+ end
+
+ private
+
+ def warning_markdown(pipeline)
+ pipeline.warning_messages(limit: MAX_LIMIT).each do |warning|
+ yield markdown(warning.content)
end
end
end