Commit a58e010f authored by mgandres's avatar mgandres

Hide pipeline status in pipeline editor for new projects

When a user opens a new project and uses the pipeline editor to create a
new CI configuration file, the pipeline status should be hidden since
there are no triggered pipelines yet for the project. It will be visible
once the user creates their first commit (and thus, triggers their first
pipeline).
parent 56e33f62
...@@ -35,10 +35,14 @@ export default { ...@@ -35,10 +35,14 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
isNewCiConfigFile: {
type: Boolean,
required: true,
},
}, },
computed: { computed: {
showPipelineStatus() { showPipelineStatus() {
return this.glFeatures.pipelineStatusForPipelineEditor; return this.glFeatures.pipelineStatusForPipelineEditor && !this.isNewCiConfigFile;
}, },
// make sure corners are rounded correctly depending on if // make sure corners are rounded correctly depending on if
// pipeline status is rendered // pipeline status is rendered
......
...@@ -278,6 +278,7 @@ export default { ...@@ -278,6 +278,7 @@ export default {
<pipeline-editor-home <pipeline-editor-home
:ci-config-data="ciConfigData" :ci-config-data="ciConfigData"
:ci-file-content="currentCiFileContent" :ci-file-content="currentCiFileContent"
:is-new-ci-config-file="isNewCiConfigFile"
@commit="updateOnCommit" @commit="updateOnCommit"
@resetContent="resetContent" @resetContent="resetContent"
@showError="showErrorAlert" @showError="showErrorAlert"
......
...@@ -19,6 +19,10 @@ export default { ...@@ -19,6 +19,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
isNewCiConfigFile: {
type: Boolean,
required: true,
},
}, },
data() { data() {
return { return {
...@@ -40,7 +44,10 @@ export default { ...@@ -40,7 +44,10 @@ export default {
<template> <template>
<div> <div>
<pipeline-editor-header :ci-config-data="ciConfigData" /> <pipeline-editor-header
:ci-config-data="ciConfigData"
:is-new-ci-config-file="isNewCiConfigFile"
/>
<pipeline-editor-tabs <pipeline-editor-tabs
:ci-config-data="ciConfigData" :ci-config-data="ciConfigData"
:ci-file-content="ciFileContent" :ci-file-content="ciFileContent"
......
...@@ -13,7 +13,7 @@ describe('Pipeline editor header', () => { ...@@ -13,7 +13,7 @@ describe('Pipeline editor header', () => {
}, },
}; };
const createComponent = ({ provide = {} } = {}) => { const createComponent = ({ provide = {}, props = {} } = {}) => {
wrapper = shallowMount(PipelineEditorHeader, { wrapper = shallowMount(PipelineEditorHeader, {
provide: { provide: {
...mockProvide, ...mockProvide,
...@@ -23,6 +23,8 @@ describe('Pipeline editor header', () => { ...@@ -23,6 +23,8 @@ describe('Pipeline editor header', () => {
ciConfigData: mockLintResponse, ciConfigData: mockLintResponse,
ciFileContent: mockCiYml, ciFileContent: mockCiYml,
isCiConfigDataLoading: false, isCiConfigDataLoading: false,
isNewCiConfigFile: false,
...props,
}, },
}); });
}; };
...@@ -36,15 +38,21 @@ describe('Pipeline editor header', () => { ...@@ -36,15 +38,21 @@ describe('Pipeline editor header', () => {
}); });
describe('template', () => { describe('template', () => {
beforeEach(() => { it('hides the pipeline status for new projects without a CI file', () => {
createComponent(); createComponent({ props: { isNewCiConfigFile: true } });
expect(findPipelineStatus().exists()).toBe(false);
}); });
it('renders the pipeline status', () => { it('renders the pipeline status when CI file exists', () => {
createComponent({ props: { isNewCiConfigFile: false } });
expect(findPipelineStatus().exists()).toBe(true); expect(findPipelineStatus().exists()).toBe(true);
}); });
it('renders the validation segment', () => { it('renders the validation segment', () => {
createComponent();
expect(findValidationSegment().exists()).toBe(true); expect(findValidationSegment().exists()).toBe(true);
}); });
}); });
......
...@@ -18,6 +18,7 @@ describe('Pipeline editor home wrapper', () => { ...@@ -18,6 +18,7 @@ describe('Pipeline editor home wrapper', () => {
ciConfigData: mockLintResponse, ciConfigData: mockLintResponse,
ciFileContent: mockCiYml, ciFileContent: mockCiYml,
isCiConfigDataLoading: false, isCiConfigDataLoading: false,
isNewCiConfigFile: false,
...props, ...props,
}, },
}); });
......
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