Commit 318c9bf4 authored by Tomas Vik's avatar Tomas Vik Committed by Bob Van Landuyt

Resolve "Multi-project pipelines in Web IDE lead to 404"

parent b5467943
...@@ -26,7 +26,13 @@ export default { ...@@ -26,7 +26,13 @@ export default {
<ci-icon :status="job.status" :borderless="true" :size="24" class="d-flex" /> <ci-icon :status="job.status" :borderless="true" :size="24" class="d-flex" />
<span class="gl-ml-3"> <span class="gl-ml-3">
{{ job.name }} {{ job.name }}
<a :href="job.path" target="_blank" class="ide-external-link position-relative"> <a
v-if="job.path"
:href="job.path"
target="_blank"
class="ide-external-link gl-relative"
data-testid="description-detail-link"
>
{{ jobId }} <gl-icon :size="12" name="external-link" /> {{ jobId }} <gl-icon :size="12" name="external-link" />
</a> </a>
</span> </span>
......
...@@ -9,7 +9,8 @@ class JobEntity < Grape::Entity ...@@ -9,7 +9,8 @@ class JobEntity < Grape::Entity
expose :started?, as: :started expose :started?, as: :started
expose :archived?, as: :archived expose :archived?, as: :archived
expose :build_path do |build| # bridge jobs don't have build detail pages
expose :build_path, if: ->(build) { !build.is_a?(Ci::Bridge) } do |build|
build_path(build) build_path(build)
end end
......
---
title: Multi-project pipelines in Web IDE lead to 404
merge_request: 41082
author:
type: fixed
...@@ -27,4 +27,12 @@ describe('IDE job description', () => { ...@@ -27,4 +27,12 @@ describe('IDE job description', () => {
vm.$el.querySelector('.ci-status-icon [data-testid="status_success_borderless-icon"]'), vm.$el.querySelector('.ci-status-icon [data-testid="status_success_borderless-icon"]'),
).not.toBe(null); ).not.toBe(null);
}); });
it('renders bridge job details without the job link', () => {
vm = mountComponent(Component, {
job: { ...jobs[0], path: undefined },
});
expect(vm.$el.querySelector('[data-testid="description-detail-link"]')).toBe(null);
});
}); });
...@@ -112,7 +112,8 @@ export const jobs = [ ...@@ -112,7 +112,8 @@ export const jobs = [
{ {
id: 4, id: 4,
name: 'test 4', name: 'test 4',
path: 'testing4', // bridge jobs don't have details page and so there is no path attribute
// see https://gitlab.com/gitlab-org/gitlab/-/issues/216480
status: { status: {
icon: 'status_failed', icon: 'status_failed',
text: 'failed', text: 'failed',
......
...@@ -218,4 +218,16 @@ RSpec.describe JobEntity do ...@@ -218,4 +218,16 @@ RSpec.describe JobEntity do
expect(subject).not_to include('recoverable') expect(subject).not_to include('recoverable')
end end
end end
context 'when job is a bridge' do
let(:job) { create(:ci_bridge) }
it 'does not include build path' do
expect(subject).not_to include(:build_path)
end
it 'does not include cancel path' do
expect(subject).not_to include(:cancel_path)
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