From 852738a4984edef4006a91b6b007a4c85fb3282e Mon Sep 17 00:00:00 2001 From: Mike Scott Date: Thu, 30 May 2019 09:32:20 +0000 Subject: Add Pipeline IID to views * Add Pipeline IID to MR's * Add Pipeline IID to commit box * Add Pipeline IID to builds page * Add Pipeline IID to job sidebar * Add Pipeline IID to header on view pipeline pages * Add changelog entry * Update tests --- .../jobs/components/stages_dropdown_spec.js | 21 ++++++++-------- spec/javascripts/jobs/mock_data.js | 1 + spec/javascripts/pipelines/mock_data.js | 1 + spec/javascripts/pipelines/pipeline_url_spec.js | 5 ++++ .../components/mr_widget_pipeline_spec.js | 28 ++++++++++++---------- spec/javascripts/vue_mr_widget/mock_data.js | 5 ++++ .../vue_mr_widget/mr_widget_options_spec.js | 2 ++ 7 files changed, 40 insertions(+), 23 deletions(-) (limited to 'spec/javascripts') diff --git a/spec/javascripts/jobs/components/stages_dropdown_spec.js b/spec/javascripts/jobs/components/stages_dropdown_spec.js index 52bb5161123..e98639bf21e 100644 --- a/spec/javascripts/jobs/components/stages_dropdown_spec.js +++ b/spec/javascripts/jobs/components/stages_dropdown_spec.js @@ -9,6 +9,7 @@ describe('Stages Dropdown', () => { const mockPipelineData = { id: 28029444, + iid: 123, details: { status: { details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', @@ -77,8 +78,8 @@ describe('Stages Dropdown', () => { expect(vm.$el.querySelector('.dropdown .js-selected-stage').textContent).toContain('deploy'); }); - it(`renders the pipeline info text like "Pipeline #123 for source_branch"`, () => { - const expected = `Pipeline #${pipeline.id} for ${pipeline.ref.name}`; + it(`renders the pipeline info text like "Pipeline #123 (#12) for source_branch"`, () => { + const expected = `Pipeline #${pipeline.id} (#${pipeline.iid}) for ${pipeline.ref.name}`; const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText); expect(actual).toBe(expected); @@ -100,10 +101,10 @@ describe('Stages Dropdown', () => { }); }); - it(`renders the pipeline info text like "Pipeline #123 for !456 with source_branch into target_branch"`, () => { - const expected = `Pipeline #${pipeline.id} for !${pipeline.merge_request.iid} with ${ - pipeline.merge_request.source_branch - } into ${pipeline.merge_request.target_branch}`; + it(`renders the pipeline info text like "Pipeline #123 (#12) for !456 with source_branch into target_branch"`, () => { + const expected = `Pipeline #${pipeline.id} (#${pipeline.iid}) for !${ + pipeline.merge_request.iid + } with ${pipeline.merge_request.source_branch} into ${pipeline.merge_request.target_branch}`; const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText); expect(actual).toBe(expected); @@ -143,10 +144,10 @@ describe('Stages Dropdown', () => { }); }); - it(`renders the pipeline info like "Pipeline #123 for !456 with source_branch"`, () => { - const expected = `Pipeline #${pipeline.id} for !${pipeline.merge_request.iid} with ${ - pipeline.merge_request.source_branch - }`; + it(`renders the pipeline info like "Pipeline #123 (#12) for !456 with source_branch"`, () => { + const expected = `Pipeline #${pipeline.id} (#${pipeline.iid}) for !${ + pipeline.merge_request.iid + } with ${pipeline.merge_request.source_branch}`; const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText); expect(actual).toBe(expected); diff --git a/spec/javascripts/jobs/mock_data.js b/spec/javascripts/jobs/mock_data.js index 3d40e94d219..88b0bb206ee 100644 --- a/spec/javascripts/jobs/mock_data.js +++ b/spec/javascripts/jobs/mock_data.js @@ -960,6 +960,7 @@ export default { }, pipeline: { id: 140, + iid: 13, user: { name: 'Root', username: 'root', diff --git a/spec/javascripts/pipelines/mock_data.js b/spec/javascripts/pipelines/mock_data.js index 03ead6cd8ba..8eef9166b8d 100644 --- a/spec/javascripts/pipelines/mock_data.js +++ b/spec/javascripts/pipelines/mock_data.js @@ -1,5 +1,6 @@ export const pipelineWithStages = { id: 20333396, + iid: 304399, user: { id: 128633, name: 'Rémy Coutable', diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index aa196af2f33..88c0137dc58 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -13,6 +13,7 @@ describe('Pipeline Url Component', () => { propsData: { pipeline: { id: 1, + iid: 1, path: 'foo', flags: {}, }, @@ -28,6 +29,7 @@ describe('Pipeline Url Component', () => { propsData: { pipeline: { id: 1, + iid: 1, path: 'foo', flags: {}, }, @@ -47,6 +49,7 @@ describe('Pipeline Url Component', () => { propsData: { pipeline: { id: 1, + iid: 1, path: 'foo', flags: { latest: true, @@ -78,6 +81,7 @@ describe('Pipeline Url Component', () => { propsData: { pipeline: { id: 1, + iid: 1, path: 'foo', flags: { latest: true, @@ -100,6 +104,7 @@ describe('Pipeline Url Component', () => { propsData: { pipeline: { id: 1, + iid: 1, path: 'foo', flags: { failure_reason: true, diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js index 75017d20473..a2308b0dfdb 100644 --- a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js +++ b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js @@ -103,7 +103,7 @@ describe('MRWidgetPipeline', () => { it('should render pipeline ID', () => { expect(vm.$el.querySelector('.pipeline-id').textContent.trim()).toEqual( - `#${mockData.pipeline.id}`, + `#${mockData.pipeline.id} (#${mockData.pipeline.iid})`, ); }); @@ -150,7 +150,7 @@ describe('MRWidgetPipeline', () => { it('should render pipeline ID', () => { expect(vm.$el.querySelector('.pipeline-id').textContent.trim()).toEqual( - `#${mockData.pipeline.id}`, + `#${mockData.pipeline.id} (#${mockData.pipeline.iid})`, ); }); @@ -222,9 +222,9 @@ describe('MRWidgetPipeline', () => { sourceBranchLink: mockCopy.source_branch_link, }); - const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${ - pipeline.commit.short_id - } on ${mockCopy.source_branch_link}`; + const expected = `Pipeline #${pipeline.id} (#${pipeline.iid}) ${ + pipeline.details.status.label + } for ${pipeline.commit.short_id} on ${mockCopy.source_branch_link}`; const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText); @@ -247,11 +247,11 @@ describe('MRWidgetPipeline', () => { sourceBranchLink: mockCopy.source_branch_link, }); - const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${ - pipeline.commit.short_id - } on !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch} into ${ - pipeline.merge_request.target_branch - }`; + const expected = `Pipeline #${pipeline.id} (#${pipeline.iid}) ${ + pipeline.details.status.label + } for ${pipeline.commit.short_id} on !${pipeline.merge_request.iid} with ${ + pipeline.merge_request.source_branch + } into ${pipeline.merge_request.target_branch}`; const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText); @@ -274,9 +274,11 @@ describe('MRWidgetPipeline', () => { sourceBranchLink: mockCopy.source_branch_link, }); - const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${ - pipeline.commit.short_id - } on !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch}`; + const expected = `Pipeline #${pipeline.id} (#${pipeline.iid}) ${ + pipeline.details.status.label + } for ${pipeline.commit.short_id} on !${pipeline.merge_request.iid} with ${ + pipeline.merge_request.source_branch + }`; const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText); diff --git a/spec/javascripts/vue_mr_widget/mock_data.js b/spec/javascripts/vue_mr_widget/mock_data.js index bec16b0aab0..edbd0d54151 100644 --- a/spec/javascripts/vue_mr_widget/mock_data.js +++ b/spec/javascripts/vue_mr_widget/mock_data.js @@ -62,6 +62,7 @@ export default { "Merge branch 'daaaa' into 'master'\n\nUpdate README.md\n\nSee merge request !22", pipeline: { id: 172, + iid: 32, user: { name: 'Administrator', username: 'root', @@ -241,6 +242,8 @@ export default { export const mockStore = { pipeline: { id: 0, + iid: 0, + path: '/root/acets-app/pipelines/0', details: { status: { details_path: '/root/review-app-tester/pipelines/66', @@ -258,6 +261,8 @@ export const mockStore = { }, mergePipeline: { id: 1, + iid: 1, + path: '/root/acets-app/pipelines/0', details: { status: { details_path: '/root/review-app-tester/pipelines/66', diff --git a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js index a0628fdcebe..7653c10b94b 100644 --- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js @@ -600,6 +600,7 @@ describe('mrWidgetOptions', () => { ]; const deploymentMockData = { id: 15, + iid: 7, name: 'review/diplo', url: '/root/acets-review-apps/environments/15', stop_url: '/root/acets-review-apps/environments/15/stop', @@ -646,6 +647,7 @@ describe('mrWidgetOptions', () => { vm.mr.state = 'merged'; vm.mr.mergePipeline = { id: 127, + iid: 35, user: { id: 1, name: 'Administrator', -- cgit v1.2.1