Class: Ci::BuildPresenter

Inherits:
ProcessablePresenter show all
Defined in:
app/presenters/ci/build_presenter.rb

Constant Summary

Constants inherited from CommitStatusPresenter

CommitStatusPresenter::TROUBLESHOOTING_DOC

Instance Method Summary collapse

Methods inherited from CommitStatusPresenter

#callout_failure_message, callout_failure_messages

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#execute_inObject



26
27
28
# File 'app/presenters/ci/build_presenter.rb', line 26

def execute_in
  scheduled? && scheduled_at && [0, scheduled_at - Time.now].max
end

#failure_messageObject



30
31
32
# File 'app/presenters/ci/build_presenter.rb', line 30

def failure_message
  callout_failure_message if build.failed?
end

#status_title(status = detailed_status) ⇒ Object



7
8
9
10
11
12
13
# File 'app/presenters/ci/build_presenter.rb', line 7

def status_title(status = detailed_status)
  if auto_canceled?
    "Job is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}"
  else
    tooltip_for_badge(status)
  end
end

#trigger_variablesObject



15
16
17
18
19
20
21
22
23
24
# File 'app/presenters/ci/build_presenter.rb', line 15

def trigger_variables
  return [] unless trigger_request

  @trigger_variables ||=
    if pipeline.variables.any?
      pipeline.variables.map(&:to_runner_variable)
    else
      trigger_request.user_variables
    end
end