Commit b9d841c0 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '26947-build-status-self-link' into 'master'

Use new partial to render a badge without a link in the builds details.

Closes #26947

See merge request !8740
parents 1897d556 6679a906
- status = local_assigns.fetch(:status) - status = local_assigns.fetch(:status)
- link = local_assigns.fetch(:link, true)
- css_classes = "ci-status ci-#{status.group}" - css_classes = "ci-status ci-#{status.group}"
- if status.has_details? - if link && status.has_details?
= link_to status.details_path, class: css_classes do = link_to status.details_path, class: css_classes do
= custom_icon(status.icon) = custom_icon(status.icon)
= status.text = status.text
......
.content-block.build-header .content-block.build-header
.header-content .header-content
= render 'ci/status/badge', status: @build.detailed_status(current_user) = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false
Build Build
%strong ##{@build.id} %strong.js-build-id ##{@build.id}
in pipeline in pipeline
= link_to pipeline_path(@build.pipeline) do = link_to pipeline_path(@build.pipeline) do
%strong ##{@build.pipeline.id} %strong ##{@build.pipeline.id}
......
---
title: Add link verification to badge partial in order to render a badge without a link
merge_request: 8740
author:
...@@ -15,6 +15,36 @@ describe 'projects/builds/show', :view do ...@@ -15,6 +15,36 @@ describe 'projects/builds/show', :view do
allow(view).to receive(:can?).and_return(true) allow(view).to receive(:can?).and_return(true)
end end
describe 'build information in header' do
let(:build) do
create(:ci_build, :success, environment: 'staging')
end
before do
render
end
it 'shows status name' do
expect(rendered).to have_css('.ci-status.ci-success', text: 'passed')
end
it 'does not render a link to the build' do
expect(rendered).not_to have_link('passed')
end
it 'shows build id' do
expect(rendered).to have_css('.js-build-id', text: build.id)
end
it 'shows a link to the pipeline' do
expect(rendered).to have_link(build.pipeline.id)
end
it 'shows a link to the commit' do
expect(rendered).to have_link(build.pipeline.short_sha)
end
end
describe 'environment info in build view' do describe 'environment info in build view' do
context 'build with latest deployment' do context 'build with latest deployment' do
let(:build) do let(:build) do
......
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