2018-07-24 06:00:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-28 21:12:32 -05:00
|
|
|
module Ci
|
|
|
|
class BuildMetadataPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
TIMEOUT_SOURCES = {
|
|
|
|
unknown_timeout_source: nil,
|
|
|
|
project_timeout_source: 'project',
|
2019-09-16 14:06:05 -04:00
|
|
|
runner_timeout_source: 'runner',
|
|
|
|
job_timeout_source: 'job'
|
2018-02-28 21:12:32 -05:00
|
|
|
}.freeze
|
|
|
|
|
2021-09-21 05:12:21 -04:00
|
|
|
presents ::Ci::BuildMetadata, as: :metadata
|
2018-02-28 21:12:32 -05:00
|
|
|
|
2021-09-21 05:12:21 -04:00
|
|
|
delegator_override :timeout_source
|
2018-02-28 21:12:32 -05:00
|
|
|
def timeout_source
|
|
|
|
return unless metadata.timeout_source?
|
|
|
|
|
|
|
|
TIMEOUT_SOURCES[metadata.timeout_source.to_sym] ||
|
2018-03-01 13:43:10 -05:00
|
|
|
metadata.timeout_source
|
2018-02-28 21:12:32 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|