Commit ed6c1e5c authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch 'pb-fix-duration-for-skipped-pipeline' into 'master'

Show skipped duration for all skipped pipelines

See merge request gitlab-org/gitlab!57242
parents 3e7166ab 3be9e982
...@@ -22,6 +22,9 @@ export default { ...@@ -22,6 +22,9 @@ export default {
finishedTime() { finishedTime() {
return this.pipeline?.details?.finished_at; return this.pipeline?.details?.finished_at;
}, },
skipped() {
return this.pipeline?.details?.status?.label === 'skipped';
},
durationFormatted() { durationFormatted() {
const date = new Date(this.duration * 1000); const date = new Date(this.duration * 1000);
...@@ -48,16 +51,11 @@ export default { ...@@ -48,16 +51,11 @@ export default {
legacyTableMobileClass() { legacyTableMobileClass() {
return !this.glFeatures.newPipelinesTable ? 'table-mobile-content' : ''; return !this.glFeatures.newPipelinesTable ? 'table-mobile-content' : '';
}, },
singleStagePipelineManual() {
return (
this.pipeline.details.manual_actions.length > 0 && this.pipeline.details.stages.length === 1
);
},
showInProgress() { showInProgress() {
return !this.duration && !this.finishedTime && !this.singleStagePipelineManual; return !this.duration && !this.finishedTime && !this.skipped;
}, },
showSkipped() { showSkipped() {
return !this.duration && !this.finishedTime && this.singleStagePipelineManual; return !this.duration && !this.finishedTime && this.skipped;
}, },
}, },
}; };
......
---
title: Show skipped duration state for all skipped pipelines
merge_request: 57242
author:
type: changed
...@@ -5,41 +5,6 @@ import TimeAgo from '~/pipelines/components/pipelines_list/time_ago.vue'; ...@@ -5,41 +5,6 @@ import TimeAgo from '~/pipelines/components/pipelines_list/time_ago.vue';
describe('Timeago component', () => { describe('Timeago component', () => {
let wrapper; let wrapper;
const mutlipleStages = {
manual_actions: [
{
name: 'deploy_job',
path: '/root/one-stage-manual/-/jobs/1930/play',
playable: true,
scheduled: false,
},
],
stages: [
{
name: 'deploy',
},
{
name: 'qa',
},
],
};
const singleStageManual = {
manual_actions: [
{
name: 'deploy_job',
path: '/root/one-stage-manual/-/jobs/1930/play',
playable: true,
scheduled: false,
},
],
stages: [
{
name: 'deploy',
},
],
};
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = shallowMount(TimeAgo, { wrapper = shallowMount(TimeAgo, {
propsData: { propsData: {
...@@ -82,7 +47,7 @@ describe('Timeago component', () => { ...@@ -82,7 +47,7 @@ describe('Timeago component', () => {
describe('without duration', () => { describe('without duration', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ ...singleStageManual, duration: 0, finished_at: '' }); createComponent({ duration: 0, finished_at: '' });
}); });
it('should not render duration and timer svg', () => { it('should not render duration and timer svg', () => {
...@@ -107,7 +72,7 @@ describe('Timeago component', () => { ...@@ -107,7 +72,7 @@ describe('Timeago component', () => {
describe('without finishedTime', () => { describe('without finishedTime', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ ...singleStageManual, duration: 0, finished_at: '' }); createComponent({ duration: 0, finished_at: '' });
}); });
it('should not render time and calendar icon', () => { it('should not render time and calendar icon', () => {
...@@ -126,7 +91,6 @@ describe('Timeago component', () => { ...@@ -126,7 +91,6 @@ describe('Timeago component', () => {
'progress state shown: $shouldShow when pipeline duration is $durationTime and finished_at is $finishedAtTime', 'progress state shown: $shouldShow when pipeline duration is $durationTime and finished_at is $finishedAtTime',
({ durationTime, finishedAtTime, shouldShow }) => { ({ durationTime, finishedAtTime, shouldShow }) => {
createComponent({ createComponent({
...mutlipleStages,
duration: durationTime, duration: durationTime,
finished_at: finishedAtTime, finished_at: finishedAtTime,
}); });
...@@ -138,24 +102,13 @@ describe('Timeago component', () => { ...@@ -138,24 +102,13 @@ describe('Timeago component', () => {
}); });
describe('skipped', () => { describe('skipped', () => {
it.each` it('should show skipped if pipeline was skipped', () => {
durationTime | finishedAtTime | shouldShow createComponent({
${10} | ${'2017-04-26T12:40:23.277Z'} | ${false} status: { label: 'skipped' },
${10} | ${''} | ${false} });
${0} | ${'2017-04-26T12:40:23.277Z'} | ${false}
${0} | ${''} | ${true}
`(
'progress state shown: $shouldShow when pipeline duration is $durationTime and finished_at is $finishedAtTime',
({ durationTime, finishedAtTime, shouldShow }) => {
createComponent({
...singleStageManual,
duration: durationTime,
finished_at: finishedAtTime,
});
expect(findSkipped().exists()).toBe(shouldShow); expect(findSkipped().exists()).toBe(true);
expect(findInProgress().exists()).toBe(false); expect(findInProgress().exists()).toBe(false);
}, });
);
}); });
}); });
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