summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-09-05 18:49:27 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-09-05 18:49:27 +0800
commit6e1a06d8cd761692596696ab4e17ccaf0c68519d (patch)
treeab274f9ae23f39e4afc1697829f3685c412ad873
parentd071f61b0de12a57012ed1c77634b54fa83615a7 (diff)
downloadgitlab-ce-6e1a06d8cd761692596696ab4e17ccaf0c68519d.tar.gz
Show how long this pipeline was queued
Closes #19804
-rw-r--r--app/models/ci/pipeline.rb7
-rw-r--r--app/views/projects/pipelines/_info.html.haml3
2 files changed, 10 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 4092205578e..0b1df9f4294 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -257,6 +257,13 @@ module Ci
]
end
+ def queued_duration
+ return unless started_at
+
+ seconds = (started_at - created_at).to_i
+ seconds unless seconds.zero?
+ end
+
def update_duration
return unless started_at
diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml
index 063e83a407a..03f5f55e336 100644
--- a/app/views/projects/pipelines/_info.html.haml
+++ b/app/views/projects/pipelines/_info.html.haml
@@ -10,6 +10,9 @@
- if @pipeline.duration
in
= time_interval_in_words(@pipeline.duration)
+ - if @pipeline.queued_duration
+ (queued for
+ = "#{time_interval_in_words(@pipeline.queued_duration)})"
.pull-right
= link_to namespace_project_pipeline_path(@project.namespace, @project, @pipeline), class: "ci-status ci-#{@pipeline.status}" do