Commit 6e0ecc1f authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'pb-fix-in-progress-for-single-stage-manual-pipelines' into 'master'

Add skipped state to duration cell

See merge request gitlab-org/gitlab!56669
parents d262a196 a06ceaa0
......@@ -48,8 +48,16 @@ export default {
legacyTableMobileClass() {
return !this.glFeatures.newPipelinesTable ? 'table-mobile-content' : '';
},
singleStagePipelineManual() {
return (
this.pipeline.details.manual_actions.length > 0 && this.pipeline.details.stages.length === 1
);
},
showInProgress() {
return !this.duration && !this.finishedTime;
return !this.duration && !this.finishedTime && !this.singleStagePipelineManual;
},
showSkipped() {
return !this.duration && !this.finishedTime && this.singleStagePipelineManual;
},
},
};
......@@ -65,6 +73,11 @@ export default {
{{ s__('Pipeline|In progress') }}
</span>
<span v-if="showSkipped" data-testid="pipeline-skipped">
<gl-icon name="status_skipped_borderless" class="gl-mr-2" :size="16" />
{{ s__('Pipeline|Skipped') }}
</span>
<p v-if="duration" class="duration">
<gl-icon name="timer" class="gl-vertical-align-baseline!" :size="12" />
{{ durationFormatted }}
......
---
title: Adds skipped state to duration cell for single stage manual pipelines
merge_request: 56669
author:
type: changed
......@@ -5,6 +5,41 @@ import TimeAgo from '~/pipelines/components/pipelines_list/time_ago.vue';
describe('Timeago component', () => {
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 = {}) => {
wrapper = shallowMount(TimeAgo, {
propsData: {
......@@ -30,6 +65,7 @@ describe('Timeago component', () => {
const duration = () => wrapper.find('.duration');
const finishedAt = () => wrapper.find('.finished-at');
const findInProgress = () => wrapper.find('[data-testid="pipeline-in-progress"]');
const findSkipped = () => wrapper.find('[data-testid="pipeline-skipped"]');
describe('with duration', () => {
beforeEach(() => {
......@@ -46,7 +82,7 @@ describe('Timeago component', () => {
describe('without duration', () => {
beforeEach(() => {
createComponent({ duration: 0, finished_at: '' });
createComponent({ ...singleStageManual, duration: 0, finished_at: '' });
});
it('should not render duration and timer svg', () => {
......@@ -71,7 +107,7 @@ describe('Timeago component', () => {
describe('without finishedTime', () => {
beforeEach(() => {
createComponent({ duration: 0, finished_at: '' });
createComponent({ ...singleStageManual, duration: 0, finished_at: '' });
});
it('should not render time and calendar icon', () => {
......@@ -89,9 +125,36 @@ describe('Timeago component', () => {
`(
'progress state shown: $shouldShow when pipeline duration is $durationTime and finished_at is $finishedAtTime',
({ durationTime, finishedAtTime, shouldShow }) => {
createComponent({ duration: durationTime, finished_at: finishedAtTime });
createComponent({
...mutlipleStages,
duration: durationTime,
finished_at: finishedAtTime,
});
expect(findInProgress().exists()).toBe(shouldShow);
expect(findSkipped().exists()).toBe(false);
},
);
});
describe('skipped', () => {
it.each`
durationTime | finishedAtTime | shouldShow
${10} | ${'2017-04-26T12:40:23.277Z'} | ${false}
${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(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