Module: Ci::PipelinesHelper

Includes:
Gitlab::Ci::Warnings
Defined in:
app/helpers/ci/pipelines_helper.rb

Constant Summary

Constants included from Gitlab::Ci::Warnings

Gitlab::Ci::Warnings::MAX_LIMIT

Instance Method Summary collapse

Instance Method Details

#pipeline_warnings(pipeline) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/ci/pipelines_helper.rb', line 7

def pipeline_warnings(pipeline)
  return unless pipeline.warning_messages.any?

  total_warnings = pipeline.warning_messages.length
  message = warning_header(total_warnings)

  (:div, class: 'bs-callout bs-callout-warning') do
    (:details) do
      concat (:summary, message, class: 'gl-mb-2')
      warning_markdown(pipeline) { |markdown| concat markdown }
    end
  end
end

#warning_header(count) ⇒ Object


21
22
23
24
25
26
27
# File 'app/helpers/ci/pipelines_helper.rb', line 21

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