blob: 513fcd90cf84c4f3947560c4423f713cfd1a93cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
module Ci
class BuildPresenter < ProcessablePresenter
presents ::Ci::Build, as: :build
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
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
def execute_in
scheduled? && scheduled_at && [0, scheduled_at - Time.now].max
end
private
def tooltip_for_badge(status)
status.badge_tooltip.capitalize
end
def detailed_status
@detailed_status ||= build.detailed_status(user)
end
end
end
Ci::BuildPresenter.prepend_mod_with('Ci::BuildPresenter')
|