Commit 54a5d513 authored by Scott Hampton's avatar Scott Hampton

Fixing CI icon mismatch

MR list, and related MRs and branches were using a deprecated helper.

Created a new icon haml file to help move these forward.
parent ab9f8785
- status = local_assigns.fetch(:status)
- size = local_assigns.fetch(:size, 16)
- link = local_assigns.fetch(:link, true)
- title = local_assigns.fetch(:title, nil)
- css_classes = "ci-status-link ci-status-icon ci-status-icon-#{status.group} #{'has-tooltip' if title.present?}"
- if link && status.has_details?
= link_to status.details_path, class: css_classes, title: title, data: { html: title.present? } do
= sprite_icon(status.icon, size: size)
- else
%span{ class: css_classes, title: title, data: { html: title.present? } }
= sprite_icon(status.icon, size: size)
\ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
= merge_request.to_reference = merge_request.to_reference
%span.mr-ci-status.flex-md-grow-1.justify-content-end.d-flex.ml-md-2 %span.mr-ci-status.flex-md-grow-1.justify-content-end.d-flex.ml-md-2
- if merge_request.can_read_pipeline? - if merge_request.can_read_pipeline?
= render_pipeline_status(merge_request.head_pipeline, tooltip_placement: 'bottom') = render 'ci/status/icon', status: merge_request.head_pipeline.detailed_status(current_user), link: true
- elsif has_any_head_pipeline - elsif has_any_head_pipeline
= icon('blank fw') = icon('blank fw')
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- pipeline = @project.pipeline_for(branch, target.sha) if target - pipeline = @project.pipeline_for(branch, target.sha) if target
- if can?(current_user, :read_pipeline, pipeline) - if can?(current_user, :read_pipeline, pipeline)
%span.related-branch-ci-status %span.related-branch-ci-status
= render_pipeline_status(pipeline) = render 'ci/status/icon', status: pipeline.detailed_status(current_user), link: true
%span.related-branch-info %span.related-branch-info
%strong %strong
= link_to branch, project_compare_path(@project, from: @project.default_branch, to: branch), class: "ref-name" = link_to branch, project_compare_path(@project, from: @project.default_branch, to: branch), class: "ref-name"
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
CLOSED CLOSED
- if can?(current_user, :read_pipeline, merge_request.head_pipeline) - if can?(current_user, :read_pipeline, merge_request.head_pipeline)
%li.issuable-pipeline-status.d-none.d-sm-inline-block %li.issuable-pipeline-status.d-none.d-sm-inline-block
= render_pipeline_status(merge_request.head_pipeline) = render 'ci/status/icon', status: merge_request.head_pipeline.detailed_status(current_user), link: true
- if merge_request.open? && merge_request.broken? - if merge_request.open? && merge_request.broken?
%li.issuable-pipeline-broken.d-none.d-sm-inline-block %li.issuable-pipeline-broken.d-none.d-sm-inline-block
= link_to merge_request_path(merge_request), class: "has-tooltip", title: _('Cannot be merged automatically') do = link_to merge_request_path(merge_request), class: "has-tooltip", title: _('Cannot be merged automatically') do
......
---
title: Fix pipeline status icon mismatch
merge_request: 25407
author:
type: fixed
require 'spec_helper'
describe 'ci/status/_icon' do
let(:user) { create(:user) }
let(:project) { create(:project, :private) }
let(:pipeline) { create(:ci_pipeline, project: project) }
context 'when rendering status for build' do
let(:build) do
create(:ci_build, :success, pipeline: pipeline)
end
context 'when user has ability to see details' do
before do
project.add_developer(user)
end
it 'has link to build details page' do
details_path = project_job_path(project, build)
render_status(build)
expect(rendered).to have_link(href: details_path)
end
end
context 'when user do not have ability to see build details' do
before do
render_status(build)
end
it 'contains build status text' do
expect(rendered).to have_css('.ci-status-icon.ci-status-icon-success')
end
it 'does not contain links' do
expect(rendered).not_to have_link
end
end
end
context 'when rendering status for external job' do
context 'when user has ability to see commit status details' do
before do
project.add_developer(user)
end
context 'status has external target url' do
before do
external_job = create(:generic_commit_status,
status: :running,
pipeline: pipeline,
target_url: 'http://gitlab.com')
render_status(external_job)
end
it 'contains valid commit status text' do
expect(rendered).to have_css('.ci-status-icon.ci-status-icon-running')
end
it 'has link to external status page' do
expect(rendered).to have_link(href: 'http://gitlab.com')
end
end
context 'status do not have external target url' do
before do
external_job = create(:generic_commit_status, status: :canceled)
render_status(external_job)
end
it 'contains valid commit status text' do
expect(rendered).to have_css('.ci-status-icon.ci-status-icon-canceled')
end
it 'has link to external status page' do
expect(rendered).not_to have_link
end
end
end
end
def render_status(resource)
render 'ci/status/icon', status: resource.detailed_status(user)
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