diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index a45612fb28b12928c60c434725918f0eec8d2e41..ce8b66b194518a32aebf7df48f163835c5228fcd 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -111,7 +111,7 @@ %span.label.label-primary = tag - - if @build.pipeline.stages_count.many? + - if @build.pipeline.stages_count > 1 .dropdown.build-dropdown .title Stage %button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'} @@ -120,7 +120,7 @@ %ul.dropdown-menu - @build.pipeline.stages.each do |stage| %li - %a.stage-item= stage + %a.stage-item= stage.name .builds-container - HasStatus::ORDERED_STATUSES.each do |build_status| diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml index 2cd40bb1106ccfab9618d6e5f276449fd02391fb..4fc5e15592af999c0e690f318be7f8fe31d909c6 100644 --- a/app/views/projects/commit/_pipeline.html.haml +++ b/app/views/projects/commit/_pipeline.html.haml @@ -25,18 +25,7 @@ = time_interval_in_words pipeline.duration .row-content-block.build-content.middle-block.pipeline-graph.hidden - .pipeline-visualization - %ul.stage-column-list - - pipeline.stages.each do |stage| - %li.stage-column - .stage-name - %a{name: stage.name} - - if stage.name - = stage.name.titleize - .builds-container - %ul - = render "projects/commit/pipeline_stage", statuses: stage.statuses - + = render "projects/pipelines/graph", subject: pipeline - if pipeline.yaml_errors.present? .bs-callout.bs-callout-danger @@ -61,4 +50,5 @@ - if pipeline.project.build_coverage_enabled? %th Coverage %th - = render pipeline.stages + - pipeline.stages.each do |stage| + = render "projects/stage/stage", subject: stage diff --git a/app/views/projects/commit/_pipeline_stage.html.haml b/app/views/projects/commit/_pipeline_stage.html.haml deleted file mode 100644 index f9a9c8707f52c60c0f1d9a3959c97405cc26fa53..0000000000000000000000000000000000000000 --- a/app/views/projects/commit/_pipeline_stage.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- status_groups = statuses.sort_by(&:name).group_by(&:group_name) -- status_groups.each do |group_name, grouped_statuses| - - if grouped_statuses.one? - - status = grouped_statuses.first - - is_playable = status.playable? && can?(current_user, :update_build, @project) - %li.build{ class: ("playable" if is_playable) } - .curve - .build-content - = render "projects/#{status.to_partial_path}_pipeline", subject: status - - else - %li.build - .curve - .dropdown.inline.build-content - = render "projects/commit/pipeline_status_group", name: group_name, subject: grouped_statuses diff --git a/app/views/projects/pipelines/_graph.html.haml b/app/views/projects/pipelines/_graph.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..3bb6426c15666cd0b033fa5a18d3f00e38e8eb12 --- /dev/null +++ b/app/views/projects/pipelines/_graph.html.haml @@ -0,0 +1,4 @@ +.pipeline-visualization + %ul.stage-column-list + - subject.stages.each do |stage| + = render "projects/stage/graph", subject: stage diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml index 57e793d2e59fc9becfa411a46815640c57f88c97..2ace9339af3fb0f94a0a8fa7112b3cf123e99930 100644 --- a/app/views/projects/pipelines/_with_tabs.html.haml +++ b/app/views/projects/pipelines/_with_tabs.html.haml @@ -13,17 +13,7 @@ .tab-content #js-tab-pipeline.tab-pane .build-content.middle-block.pipeline-graph - .pipeline-visualization - %ul.stage-column-list - - pipeline.stages.each do |stage| - %li.stage-column - .stage-name - %a{name: stage.name} - - if stage.name - = stage.name.titleize - .builds-container - %ul - = render "projects/commit/pipeline_stage", statuses: statuses + = render "projects/pipelines/graph", subject: pipeline #js-tab-builds.tab-pane - if pipeline.yaml_errors.present? @@ -49,4 +39,5 @@ - if pipeline.project.build_coverage_enabled? %th Coverage %th - = render pipeline.stages + - pipeline.stages.each do |stage| + = render "projects/stage/stage", subject: stage diff --git a/app/views/projects/stage/_graph.html.haml b/app/views/projects/stage/_graph.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..f1d11db58ab4d6df5b130e1888aab4500bfa5904 --- /dev/null +++ b/app/views/projects/stage/_graph.html.haml @@ -0,0 +1,22 @@ +%li.stage-column + .stage-name + %a{ name: subject.name } + - if subject.name + = subject.name.titleize + .builds-container + %ul + - statuses = subject.statuses.latest + - status_groups = statuses.sort_by(&:name).group_by(&:group_name) + - status_groups.each do |group_name, grouped_statuses| + - if grouped_statuses.one? + - status = grouped_statuses.first + - is_playable = status.playable? && can?(current_user, :update_build, @project) + %li.build{ class: ("playable" if is_playable) } + .curve + .build-content + = render "projects/#{status.to_partial_path}_pipeline", subject: status + - else + %li.build + .curve + .dropdown.inline.build-content + = render "projects/stage/in_stage_group", name: group_name, subject: grouped_statuses diff --git a/app/views/projects/commit/_pipeline_status_group.html.haml b/app/views/projects/stage/_in_stage_group.html.haml similarity index 100% rename from app/views/projects/commit/_pipeline_status_group.html.haml rename to app/views/projects/stage/_in_stage_group.html.haml diff --git a/app/views/projects/stage/_stage.html.haml b/app/views/projects/stage/_stage.html.haml index 717075620d97826750aba60052643e410a6bbcf1..055d8fca38b3a4712375705c6567a5df6bd19259 100644 --- a/app/views/projects/stage/_stage.html.haml +++ b/app/views/projects/stage/_stage.html.haml @@ -1,7 +1,7 @@ %tr %th{colspan: 10} %strong - %a{name: subject.name} + %a{ name: subject.name } %span{class: "ci-status-link ci-status-icon-#{subject.status}"} = ci_icon_for_status(subject.status) - if subject.name