Commit 8495a310 authored by James Fargher's avatar James Fargher

Merge branch '342747-hide-empty-row-if-no-badge' into 'master'

Hide badge row if there are no pipeline badges

See merge request gitlab-org/gitlab!72538
parents aaa154be bef25878
...@@ -67,6 +67,17 @@ module Ci ...@@ -67,6 +67,17 @@ module Ci
] ]
end end
def has_pipeline_badges?(pipeline)
pipeline.child? ||
pipeline.latest? ||
pipeline.merge_train_pipeline? ||
pipeline.has_yaml_errors? ||
pipeline.failure_reason? ||
pipeline.auto_devops_source? ||
pipeline.detached_merge_request_pipeline? ||
pipeline.stuck?
end
private private
def warning_markdown(pipeline) def warning_markdown(pipeline)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
- if @pipeline.queued_duration - if @pipeline.queued_duration
= "(queued for #{time_interval_in_words(@pipeline.queued_duration)})" = "(queued for #{time_interval_in_words(@pipeline.queued_duration)})"
- if has_pipeline_badges?(@pipeline)
.well-segment.qa-pipeline-badges .well-segment.qa-pipeline-badges
.icon-container .icon-container
= sprite_icon('flag') = sprite_icon('flag')
......
...@@ -71,4 +71,26 @@ RSpec.describe Ci::PipelinesHelper do ...@@ -71,4 +71,26 @@ RSpec.describe Ci::PipelinesHelper do
it { expect(has_gitlab_ci?).to eq(result) } it { expect(has_gitlab_ci?).to eq(result) }
end end
end end
describe 'has_pipeline_badges?' do
let(:pipeline) { create(:ci_empty_pipeline) }
subject { helper.has_pipeline_badges?(pipeline) }
context 'when pipeline has a badge' do
before do
pipeline.drop!(:config_error)
end
it 'shows pipeline badges' do
expect(subject).to eq(true)
end
end
context 'when pipeline has no badges' do
it 'shows pipeline badges' do
expect(subject).to eq(false)
end
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