BigW Consortium Gitlab

Commit 5643cd6b by Lin Jen-Shin

Show wall-clock time when showing pipeline instead of:

cumulative builds time. Closes #17007
parent 551ffc0a
...@@ -17,6 +17,11 @@ module TimeHelper ...@@ -17,6 +17,11 @@ module TimeHelper
def duration_in_numbers(finished_at, started_at) def duration_in_numbers(finished_at, started_at)
interval = interval_in_seconds(started_at, finished_at) interval = interval_in_seconds(started_at, finished_at)
duration_in_numbers_from_interval(interval)
end
def duration_in_numbers_from_interval(interval)
time_format = interval < 1.hour ? "%M:%S" : "%H:%M:%S" time_format = interval < 1.hour ? "%M:%S" : "%H:%M:%S"
Time.at(interval).utc.strftime(time_format) Time.at(interval).utc.strftime(time_format)
......
...@@ -213,6 +213,10 @@ module Ci ...@@ -213,6 +213,10 @@ module Ci
] ]
end end
def wall_clock_duration
finished_at.to_i - started_at.to_i if finished_at && started_at
end
private private
def build_builds_for_stages(stages, user, status, trigger_request) def build_builds_for_stages(stages, user, status, trigger_request)
......
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
\- \-
%td %td
- if pipeline.started_at && pipeline.finished_at - if pipeline.wall_clock_duration
%p.duration %p.duration
= custom_icon("icon_timer") = custom_icon("icon_timer")
= duration_in_numbers(pipeline.finished_at, pipeline.started_at) = duration_in_numbers_from_interval(pipeline.wall_clock_duration)
- if pipeline.finished_at - if pipeline.finished_at
%p.finished-at %p.finished-at
= icon("calendar") = icon("calendar")
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
- if @pipeline.ref - if @pipeline.ref
for for
= link_to @pipeline.ref, namespace_project_commits_path(@project.namespace, @project, @pipeline.ref), class: "monospace" = link_to @pipeline.ref, namespace_project_commits_path(@project.namespace, @project, @pipeline.ref), class: "monospace"
- if @pipeline.duration - if @pipeline.wall_clock_duration
in in
= time_interval_in_words @pipeline.duration = time_interval_in_words(@pipeline.wall_clock_duration)
.pull-right .pull-right
= link_to namespace_project_pipeline_path(@project.namespace, @project, @pipeline), class: "ci-status ci-#{@pipeline.status}" do = link_to namespace_project_pipeline_path(@project.namespace, @project, @pipeline), class: "ci-status ci-#{@pipeline.status}" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment