2017-03-20 18:05:52 -04:00
|
|
|
module Ci
|
2017-03-28 13:47:11 -04:00
|
|
|
class PipelinePresenter < Gitlab::View::Presenter::Delegated
|
2017-10-03 07:18:59 -04:00
|
|
|
FAILURE_REASONS = {
|
|
|
|
config_error: 'CI/CD YAML configuration error!'
|
|
|
|
}.freeze
|
|
|
|
|
|
|
|
presents :pipeline
|
2017-09-29 05:14:00 -04:00
|
|
|
|
|
|
|
def failure_reason
|
|
|
|
return unless pipeline.failure_reason?
|
|
|
|
|
|
|
|
FAILURE_REASONS[pipeline.failure_reason.to_sym] ||
|
|
|
|
pipeline.failure_reason
|
|
|
|
end
|
2017-03-20 18:05:52 -04:00
|
|
|
|
|
|
|
def status_title
|
2017-04-06 09:32:56 -04:00
|
|
|
if auto_canceled?
|
|
|
|
"Pipeline is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}"
|
|
|
|
end
|
2017-03-20 18:05:52 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|