Commit d3886e09 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'fix/pipeline-details-invalid-buttons' into 'master'

Fix/pipeline details invalid buttons

See merge request gitlab-org/gitlab!25302
parents a3ccdf95 79fc65c0
...@@ -13,10 +13,11 @@ export default () => { ...@@ -13,10 +13,11 @@ export default () => {
}); });
} }
const pipelineTabLink = document.querySelector('.js-pipeline-tab-link a');
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset; const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
const pipelineStatusUrl = `${document
.querySelector('.js-pipeline-tab-link a') if (pipelineTabLink) {
.getAttribute('href')}/status.json`; const pipelineStatusUrl = `${pipelineTabLink.getAttribute('href')}/status.json`;
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Pipelines({ new Pipelines({
...@@ -28,4 +29,5 @@ export default () => { ...@@ -28,4 +29,5 @@ export default () => {
parentEl: '.pipelines-tabs', parentEl: '.pipelines-tabs',
}, },
}); });
}
}; };
...@@ -95,14 +95,14 @@ export default () => { ...@@ -95,14 +95,14 @@ export default () => {
}, },
}); });
const tabsElement = document.querySelector('.pipelines-tabs');
const testReportsEnabled = const testReportsEnabled =
window.gon && window.gon.features && window.gon.features.junitPipelineView; window.gon && window.gon.features && window.gon.features.junitPipelineView;
if (testReportsEnabled) { if (tabsElement && testReportsEnabled) {
const fetchReportsAction = 'fetchReports'; const fetchReportsAction = 'fetchReports';
testReportsStore.dispatch('setEndpoint', dataset.testReportEndpoint); testReportsStore.dispatch('setEndpoint', dataset.testReportEndpoint);
const tabsElmement = document.querySelector('.pipelines-tabs');
const isTestTabActive = Boolean( const isTestTabActive = Boolean(
document.querySelector('.pipelines-tabs > li > a.test-tab.active'), document.querySelector('.pipelines-tabs > li > a.test-tab.active'),
); );
...@@ -113,11 +113,11 @@ export default () => { ...@@ -113,11 +113,11 @@ export default () => {
const tabClickHandler = e => { const tabClickHandler = e => {
if (e.target.className === 'test-tab') { if (e.target.className === 'test-tab') {
testReportsStore.dispatch(fetchReportsAction); testReportsStore.dispatch(fetchReportsAction);
tabsElmement.removeEventListener('click', tabClickHandler); tabsElement.removeEventListener('click', tabClickHandler);
} }
}; };
tabsElmement.addEventListener('click', tabClickHandler); tabsElement.addEventListener('click', tabClickHandler);
} }
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
......
---
title: Fix pipeline details page initialisation on invalid pipeline
merge_request: 25302
author: Fabio Huser
type: fixed
...@@ -22,6 +22,7 @@ FactoryBot.define do ...@@ -22,6 +22,7 @@ FactoryBot.define do
factory :ci_pipeline do factory :ci_pipeline do
trait :invalid do trait :invalid do
status { :failed }
yaml_errors { 'invalid YAML' } yaml_errors { 'invalid YAML' }
failure_reason { :config_error } failure_reason { :config_error }
end end
......
...@@ -1077,8 +1077,6 @@ describe 'Pipeline', :js do ...@@ -1077,8 +1077,6 @@ describe 'Pipeline', :js do
end end
context 'when pipeline has configuration errors' do context 'when pipeline has configuration errors' do
include_context 'pipeline builds'
let(:pipeline) do let(:pipeline) do
create(:ci_pipeline, create(:ci_pipeline,
:invalid, :invalid,
...@@ -1119,6 +1117,10 @@ describe 'Pipeline', :js do ...@@ -1119,6 +1117,10 @@ describe 'Pipeline', :js do
%Q{span[title="#{pipeline.present.failure_reason}"]}) %Q{span[title="#{pipeline.present.failure_reason}"]})
end end
end end
it 'contains a pipeline header with title' do
expect(page).to have_content "Pipeline ##{pipeline.id}"
end
end end
context 'when pipeline is stuck' do context 'when pipeline is stuck' 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