diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-17 09:46:34 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-17 09:46:34 +0100 |
commit | fee7992c08c434940f0722886dc96f249a8e7fbf (patch) | |
tree | 74ef19d7a91893c33ad250b0ed9df0c37555f00e | |
parent | ef767268645e8f60b7111eb9f6b6c3aa1b615661 (diff) | |
download | gitlab-ce-fee7992c08c434940f0722886dc96f249a8e7fbf.tar.gz |
Fix pipelines visualisation rendering
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/views/projects/commit/_pipeline.html.haml | 16 |
3 files changed, 15 insertions, 7 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 08f396210c9..b42977f9ebd 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -102,7 +102,7 @@ module Ci end def playable? - project.builds_enabled? && commands.present? && manual? + project.builds_enabled? && commands.present? && manual? && skipped? end def play(current_user = nil) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index bce6a992af6..caf4d25029f 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -34,6 +34,10 @@ module Ci CommitStatus.where(pipeline: pluck(:id)).stages end + def stages + statuses.order(:stage_idx).latest.group_by(&:stage) + end + def project_id project.id end diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml index 0c006656d1d..27501d89dc5 100644 --- a/app/views/projects/commit/_pipeline.html.haml +++ b/app/views/projects/commit/_pipeline.html.haml @@ -1,9 +1,8 @@ .row-content-block.build-content.middle-block.pipeline-graph .pipeline-visualization %ul.stage-column-list - - pipeline.statuses.stages.each do |stage| - - statuses = pipeline.statuses.where(stage: stage) - - status = statuses.latest.status + - stages = pipeline.statuses.latest.order(:stage_idx).group_by(&:stage) + - stages.each do |stage, builds| %li.stage-column .stage-name %a{name: stage} @@ -11,11 +10,16 @@ = stage.titleize .builds-container %ul - - statuses.each do |build| + - builds.each do |build| %li.build .build-content - %span{class: "ci-status-link ci-status-icon-#{status}"} - = ci_icon_for_status(status) + %span{class: "ci-status-link ci-status-icon-#{build.status}"} + - if build.try(:playable?) + = link_to play_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Play' do + = icon('play') + - else + = link_to namespace_project_build_url(build.project.namespace, build.project, build) do + = ci_icon_for_status(build.status) = build.name .row-content-block.build-content.middle-block.pipeline-graph |