diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-17 11:21:00 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-17 11:21:00 +0100 |
commit | 1cd9b3b8a0b1024d043b9344869aceeadb9c84f1 (patch) | |
tree | 89bcf12fba2a5f99a44974b4abcb7d375a431d40 | |
parent | fd09311da93070546c52e65c0c2af9b8566c56b5 (diff) | |
download | gitlab-ce-1cd9b3b8a0b1024d043b9344869aceeadb9c84f1.tar.gz |
Split pipeline status item for Commit Status and Build
4 files changed, 27 insertions, 15 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index d3fc5191721..c360a6ff729 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -78,8 +78,8 @@ module Ci CommitStatus.where(pipeline: pluck(:id)).stages end - def stages - statuses.order(:stage_idx).latest.group_by(&:stage) + def stages_with_latest_statuses + statuses.latest.order(:stage_idx).group_by(&:stage) end def project_id diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml new file mode 100644 index 00000000000..5149d75e5a2 --- /dev/null +++ b/app/views/projects/ci/builds/_build_pipeline.html.haml @@ -0,0 +1,12 @@ +%li.build + .build-content + %span{class: "ci-status-link ci-status-icon-#{subject.status}"} + - if subject.playable? && can?(current_user, :update_build, @project) + = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do + = icon('play') + - elsif can?(current_user, :read_build, @project) && subject.started? + = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do + = ci_icon_for_status(subject.status) + - else + = ci_icon_for_status(subject.status) + = subject.name diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml index 5c8f40acfe3..7a7f61e9705 100644 --- a/app/views/projects/commit/_pipeline.html.haml +++ b/app/views/projects/commit/_pipeline.html.haml @@ -1,8 +1,8 @@ .row-content-block.build-content.middle-block.pipeline-graph .pipeline-visualization %ul.stage-column-list - - stages = pipeline.statuses.latest.order(:stage_idx).group_by(&:stage) - - stages.each do |stage, builds| + - stages = pipeline.stages_with_latest_statuses + - stages.each do |stage, statuses| %li.stage-column .stage-name %a{name: stage} @@ -10,17 +10,8 @@ = stage.titleize .builds-container %ul - - builds.each do |build| - %li.build - .build-content - %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 + - statuses.each do |status| + = render "projects/#{status.to_partial_path}_pipeline", subject: status .row-content-block.build-content.middle-block.pipeline-graph .pull-right diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml new file mode 100644 index 00000000000..760918b18a3 --- /dev/null +++ b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml @@ -0,0 +1,9 @@ +%li.build + .build-content + %span{class: "ci-status-link ci-status-icon-#{subject.status}"} + - if subject.target_url + - link_to subject.target_url do + = ci_icon_for_status(subject.status) + - else + = ci_icon_for_status(subject.status) + = subject.name |