Commit 6dcc1acd authored by Scott Hampton's avatar Scott Hampton

Merge branch 'pb-add-hourglass-icon-to-empty-duration-cell' into 'master'

Display in progress for pipeline duration cell

See merge request gitlab-org/gitlab!56266
parents 2f62d2af dbdbf9e2
...@@ -8,6 +8,7 @@ import PipelinesMixin from '~/pipelines/mixins/pipelines_mixin'; ...@@ -8,6 +8,7 @@ import PipelinesMixin from '~/pipelines/mixins/pipelines_mixin';
import PipelinesService from '~/pipelines/services/pipelines_service'; import PipelinesService from '~/pipelines/services/pipelines_service';
import PipelineStore from '~/pipelines/stores/pipelines_store'; import PipelineStore from '~/pipelines/stores/pipelines_store';
import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue'; import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
components: { components: {
...@@ -19,7 +20,7 @@ export default { ...@@ -19,7 +20,7 @@ export default {
TablePagination, TablePagination,
SvgBlankState, SvgBlankState,
}, },
mixins: [PipelinesMixin], mixins: [PipelinesMixin, glFeatureFlagMixin()],
props: { props: {
endpoint: { endpoint: {
type: String, type: String,
...@@ -90,6 +91,9 @@ export default { ...@@ -90,6 +91,9 @@ export default {
canRenderPipelineButton() { canRenderPipelineButton() {
return this.latestPipelineDetachedFlag; return this.latestPipelineDetachedFlag;
}, },
pipelineButtonClass() {
return !this.glFeatures.newPipelinesTable ? 'gl-md-display-none' : 'gl-lg-display-none';
},
isForkMergeRequest() { isForkMergeRequest() {
return this.sourceProjectFullPath !== this.targetProjectFullPath; return this.sourceProjectFullPath !== this.targetProjectFullPath;
}, },
...@@ -192,7 +196,8 @@ export default { ...@@ -192,7 +196,8 @@ export default {
<gl-button <gl-button
v-if="canRenderPipelineButton" v-if="canRenderPipelineButton"
block block
class="gl-mt-3 gl-mb-3 gl-md-display-none" class="gl-mt-3 gl-mb-3"
:class="pipelineButtonClass"
variant="success" variant="success"
data-testid="run_pipeline_button_mobile" data-testid="run_pipeline_button_mobile"
:loading="state.isRunningMergeRequestPipeline" :loading="state.isRunningMergeRequestPipeline"
......
...@@ -48,6 +48,9 @@ export default { ...@@ -48,6 +48,9 @@ export default {
legacyTableMobileClass() { legacyTableMobileClass() {
return !this.glFeatures.newPipelinesTable ? 'table-mobile-content' : ''; return !this.glFeatures.newPipelinesTable ? 'table-mobile-content' : '';
}, },
showInProgress() {
return !this.duration && !this.finishedTime;
},
}, },
}; };
</script> </script>
...@@ -57,6 +60,11 @@ export default { ...@@ -57,6 +60,11 @@ export default {
{{ s__('Pipeline|Duration') }} {{ s__('Pipeline|Duration') }}
</div> </div>
<div :class="legacyTableMobileClass"> <div :class="legacyTableMobileClass">
<span v-if="showInProgress" data-testid="pipeline-in-progress">
<gl-icon name="hourglass" class="gl-vertical-align-baseline! gl-mr-2" :size="12" />
{{ s__('Pipeline|In progress') }}
</span>
<p v-if="duration" class="duration"> <p v-if="duration" class="duration">
<gl-icon name="timer" class="gl-vertical-align-baseline!" :size="12" /> <gl-icon name="timer" class="gl-vertical-align-baseline!" :size="12" />
{{ durationFormatted }} {{ durationFormatted }}
......
---
title: Display in progress for pipeline duration cell when pipeline has not finished running
merge_request: 56266
author:
type: changed
...@@ -22501,6 +22501,9 @@ msgstr "" ...@@ -22501,6 +22501,9 @@ msgstr ""
msgid "Pipeline|Failed" msgid "Pipeline|Failed"
msgstr "" msgstr ""
msgid "Pipeline|In progress"
msgstr ""
msgid "Pipeline|Key" msgid "Pipeline|Key"
msgstr "" msgstr ""
......
...@@ -29,6 +29,7 @@ describe('Timeago component', () => { ...@@ -29,6 +29,7 @@ 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"]');
describe('with duration', () => { describe('with duration', () => {
beforeEach(() => { beforeEach(() => {
...@@ -77,4 +78,21 @@ describe('Timeago component', () => { ...@@ -77,4 +78,21 @@ describe('Timeago component', () => {
expect(finishedAt().exists()).toBe(false); expect(finishedAt().exists()).toBe(false);
}); });
}); });
describe('in progress', () => {
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({ duration: durationTime, finished_at: finishedAtTime });
expect(findInProgress().exists()).toBe(shouldShow);
},
);
});
}); });
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