Commit acd9cd09 authored by James Edwards-Jones's avatar James Edwards-Jones

Hides pipeline ‘Failed Jobs’ tab when no jobs have failed

parent 4c0adb9e
......@@ -71,7 +71,11 @@ class Projects::PipelinesController < Projects::ApplicationController
end
def failures
render_show
if @pipeline.statuses.latest.failed.present?
render_show
else
redirect_to pipeline_path(@pipeline)
end
end
def status
......
- failed_builds = @pipeline.statuses.latest.failed
.tabs-holder
%ul.pipelines-tabs.nav-links.no-top.no-bottom
%li.js-pipeline-tab-link
......@@ -7,10 +9,11 @@
= link_to builds_namespace_project_pipeline_path(@project.namespace, @project, @pipeline), data: {target: 'div#js-tab-builds', action: 'builds', toggle: 'tab' }, class: 'builds-tab' do
Jobs
%span.badge.js-builds-counter= pipeline.statuses.count
%li.js-failures-tab-link
= link_to failures_namespace_project_pipeline_path(@project.namespace, @project, @pipeline), data: {target: 'div#js-tab-failures', action: 'failures', toggle: 'tab' }, class: 'failures-tab' do
Failures
%span.badge.js-failures-counter= pipeline.statuses.latest.failed.count
- if failed_builds.present?
%li.js-failures-tab-link
= link_to failures_namespace_project_pipeline_path(@project.namespace, @project, @pipeline), data: {target: 'div#js-tab-failures', action: 'failures', toggle: 'tab' }, class: 'failures-tab' do
Failed Jobs
%span.badge.js-failures-counter= failed_builds.count
.tab-content
#js-tab-pipeline.tab-pane
......@@ -41,13 +44,13 @@
%th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.stages, as: :stage
#js-tab-failures.build-failures.tab-pane
- failed = @pipeline.statuses.latest.failed
- failed.each do |build|
.build-state
%span.ci-status-icon-failed= custom_icon('icon_status_failed')
%span.stage
= build.stage.titleize
%span.build-name
= render "notify/links/#{build.to_partial_path}", pipeline: @pipeline, build: build
%pre.build-log= build_summary(build)
- if failed_builds.present?
#js-tab-failures.build-failures.tab-pane
- failed_builds.each do |build|
.build-state
%span.ci-status-icon-failed= custom_icon('icon_status_failed')
%span.stage
= build.stage.titleize
%span.build-name
= render "notify/links/#{build.to_partial_path}", pipeline: @pipeline, build: build
%pre.build-log= build_summary(build)
......@@ -269,6 +269,7 @@ describe 'Pipeline', :feature, :js do
end
it 'shows jobs tab pane as active' do
expect(page).to have_content('Failed Jobs')
expect(page).to have_css('#js-tab-failures.active')
end
......@@ -291,5 +292,19 @@ describe 'Pipeline', :feature, :js do
expect(page).to have_content('No job trace')
end
end
context 'without failures' do
before do
failed_build.update!(status: :success)
visit pipeline_failures_page
end
it 'displays the pipeline graph' do
expect(current_path).to eq(pipeline_path(pipeline))
expect(page).not_to have_content('Failed Jobs')
expect(page).to have_selector('.pipeline-visualization')
end
end
end
end
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