Class: Ci::BuildPresenter

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

Instance Attribute Summary

Attributes included from Gitlab::View::Presenter::Base

#subject

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::View::Presenter::Base

#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


11
12
13
# File 'app/presenters/ci/build_presenter.rb', line 11

def erased_by_name
  erased_by.name if erased_by_user?
end

#erased_by_user?Boolean

Returns:

  • (Boolean)

5
6
7
8
9
# File 'app/presenters/ci/build_presenter.rb', line 5

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


38
39
40
# File 'app/presenters/ci/build_presenter.rb', line 38

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

#status_titleObject


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

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

#tooltip_messageObject


34
35
36
# File 'app/presenters/ci/build_presenter.rb', line 34

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

#trigger_variablesObject


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

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