2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
module Ci
|
|
|
|
class BuildMetadataPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
TIMEOUT_SOURCES = {
|
|
|
|
unknown_timeout_source: nil,
|
|
|
|
project_timeout_source: 'project',
|
2019-12-04 20:38:33 +05:30
|
|
|
runner_timeout_source: 'runner',
|
|
|
|
job_timeout_source: 'job'
|
2018-05-09 12:01:36 +05:30
|
|
|
}.freeze
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
presents ::Ci::BuildMetadata, as: :metadata
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
delegator_override :timeout_source
|
2018-05-09 12:01:36 +05:30
|
|
|
def timeout_source
|
|
|
|
return unless metadata.timeout_source?
|
|
|
|
|
|
|
|
TIMEOUT_SOURCES[metadata.timeout_source.to_sym] ||
|
|
|
|
metadata.timeout_source
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|