summaryrefslogtreecommitdiff
path: root/app/presenters/ci/pipeline_presenter.rb
blob: 099b4720fb65edd2b7b116402811aa86dd1c25d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Ci
  class PipelinePresenter < Gitlab::View::Presenter::Delegated
    FAILURE_REASONS = {
      config_error: 'CI/CD YAML configuration error!'
    }.freeze

    presents :pipeline

    def failure_reason
      return unless pipeline.failure_reason?

      FAILURE_REASONS[pipeline.failure_reason.to_sym] ||
        pipeline.failure_reason
    end

    def status_title
      if auto_canceled?
        "Pipeline is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}"
      end
    end
  end
end