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?, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

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

Instance Method Details

#erased_by_nameObject


13
14
15
# File 'app/presenters/ci/build_presenter.rb', line 13

def erased_by_name
  erased_by.name if erased_by_user?
end

#erased_by_user?Boolean

Returns:

  • (Boolean)

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

def erased_by_user?
  # Build can be erased through API, therefore it does not have
  # `erased_by` user assigned in that case.
  erased? && erased_by
end

#execute_inObject


40
41
42
# File 'app/presenters/ci/build_presenter.rb', line 40

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

#status_title(status = detailed_status) ⇒ Object


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

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

#tooltip_messageObject


36
37
38
# File 'app/presenters/ci/build_presenter.rb', line 36

def tooltip_message
  "#{build.name} - #{detailed_status.status_tooltip}"
end

#trigger_variablesObject


25
26
27
28
29
30
31
32
33
34
# File 'app/presenters/ci/build_presenter.rb', line 25

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