Class: Ci::BuildPresenter

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

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?, #can_all?, #can_any?

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



24
25
26
# File 'app/presenters/ci/build_presenter.rb', line 24

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

#failure_messageObject



28
29
30
# File 'app/presenters/ci/build_presenter.rb', line 28

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
# File 'app/presenters/ci/build_presenter.rb', line 15

def trigger_variables
  @trigger_variables ||=
    if pipeline.trigger_id.blank?
      []
    else
      pipeline.variables.map(&:to_hash_variable)
    end
end