summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2018-02-28 21:36:01 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2018-03-28 13:57:18 +0200
commit1b0b8b9c02642ac19b9f5019cdd38fcec280c2a7 (patch)
treece4f8eba20d9f3d434cead27abb77e855b3ae237 /app/presenters
parent8ffa48098b77e1f35f9c01f6977d9ccf1d166a24 (diff)
downloadgitlab-ce-1b0b8b9c02642ac19b9f5019cdd38fcec280c2a7.tar.gz
Change timeout_source to enum
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/ci/build_presenter.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/presenters/ci/build_presenter.rb b/app/presenters/ci/build_presenter.rb
index 255475e1fe6..be6cc2e70b1 100644
--- a/app/presenters/ci/build_presenter.rb
+++ b/app/presenters/ci/build_presenter.rb
@@ -1,5 +1,12 @@
module Ci
class BuildPresenter < Gitlab::View::Presenter::Delegated
+
+ TIMEOUT_SOURCES = {
+ unknown_timeout_source: nil,
+ project_timeout_source: 'project',
+ runner_timeout_source: 'runner'
+ }.freeze
+
presents :build
def erased_by_user?
@@ -18,6 +25,13 @@ module Ci
end
end
+ def timeout_source
+ return unless build.timeout_source?
+
+ TIMEOUT_SOURCES[build.timeout_source.to_sym] ||
+ build.timeout_source
+ end
+
def trigger_variables
return [] unless trigger_request