Commit 8ef00188 authored by Payton Burdette's avatar Payton Burdette Committed by Savas Vedova

Add warning icon beside in progress if stuck

parent 8ada13ae
...@@ -25,6 +25,9 @@ export default { ...@@ -25,6 +25,9 @@ export default {
skipped() { skipped() {
return this.pipeline?.details?.status?.label === 'skipped'; return this.pipeline?.details?.status?.label === 'skipped';
}, },
stuck() {
return this.pipeline.flags.stuck;
},
durationFormatted() { durationFormatted() {
const date = new Date(this.duration * 1000); const date = new Date(this.duration * 1000);
...@@ -67,7 +70,20 @@ export default { ...@@ -67,7 +70,20 @@ export default {
</div> </div>
<div :class="legacyTableMobileClass"> <div :class="legacyTableMobileClass">
<span v-if="showInProgress" data-testid="pipeline-in-progress"> <span v-if="showInProgress" data-testid="pipeline-in-progress">
<gl-icon name="hourglass" class="gl-vertical-align-baseline! gl-mr-2" :size="12" /> <gl-icon
v-if="stuck"
name="warning"
class="gl-mr-2"
:size="12"
data-testid="warning-icon"
/>
<gl-icon
v-else
name="hourglass"
class="gl-vertical-align-baseline! gl-mr-2"
:size="12"
data-testid="hourglass-icon"
/>
{{ s__('Pipeline|In progress') }} {{ s__('Pipeline|In progress') }}
</span> </span>
......
---
title: Add warning icon beside in progress text if pipeline is stuck
merge_request: 58427
author:
type: changed
import { GlIcon } from '@gitlab/ui'; import { GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import TimeAgo from '~/pipelines/components/pipelines_list/time_ago.vue'; import TimeAgo from '~/pipelines/components/pipelines_list/time_ago.vue';
describe('Timeago component', () => { describe('Timeago component', () => {
let wrapper; let wrapper;
const createComponent = (props = {}) => { const defaultProps = { duration: 0, finished_at: '' };
wrapper = shallowMount(TimeAgo, {
propsData: { const createComponent = (props = defaultProps, stuck = false) => {
pipeline: { wrapper = extendedWrapper(
details: { shallowMount(TimeAgo, {
...props, propsData: {
pipeline: {
details: {
...props,
},
flags: {
stuck,
},
}, },
}, },
}, data() {
data() { return {
return { iconTimerSvg: `<svg></svg>`,
iconTimerSvg: `<svg></svg>`, };
}; },
}, }),
}); );
}; };
afterEach(() => { afterEach(() => {
...@@ -29,8 +37,10 @@ describe('Timeago component', () => { ...@@ -29,8 +37,10 @@ describe('Timeago component', () => {
const duration = () => wrapper.find('.duration'); const duration = () => wrapper.find('.duration');
const finishedAt = () => wrapper.find('.finished-at'); const finishedAt = () => wrapper.find('.finished-at');
const findInProgress = () => wrapper.find('[data-testid="pipeline-in-progress"]'); const findInProgress = () => wrapper.findByTestId('pipeline-in-progress');
const findSkipped = () => wrapper.find('[data-testid="pipeline-skipped"]'); const findSkipped = () => wrapper.findByTestId('pipeline-skipped');
const findHourGlassIcon = () => wrapper.findByTestId('hourglass-icon');
const findWarningIcon = () => wrapper.findByTestId('warning-icon');
describe('with duration', () => { describe('with duration', () => {
beforeEach(() => { beforeEach(() => {
...@@ -47,7 +57,7 @@ describe('Timeago component', () => { ...@@ -47,7 +57,7 @@ describe('Timeago component', () => {
describe('without duration', () => { describe('without duration', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ duration: 0, finished_at: '' }); createComponent();
}); });
it('should not render duration and timer svg', () => { it('should not render duration and timer svg', () => {
...@@ -72,7 +82,7 @@ describe('Timeago component', () => { ...@@ -72,7 +82,7 @@ describe('Timeago component', () => {
describe('without finishedTime', () => { describe('without finishedTime', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ duration: 0, finished_at: '' }); createComponent();
}); });
it('should not render time and calendar icon', () => { it('should not render time and calendar icon', () => {
...@@ -99,6 +109,15 @@ describe('Timeago component', () => { ...@@ -99,6 +109,15 @@ describe('Timeago component', () => {
expect(findSkipped().exists()).toBe(false); expect(findSkipped().exists()).toBe(false);
}, },
); );
it('should show warning icon beside in progress if pipeline is stuck', () => {
const stuck = true;
createComponent(defaultProps, stuck);
expect(findWarningIcon().exists()).toBe(true);
expect(findHourGlassIcon().exists()).toBe(false);
});
}); });
describe('skipped', () => { describe('skipped', () => {
......
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