Commit 9e30c4dc authored by Jose Ivan Vargas's avatar Jose Ivan Vargas Committed by Olena Horal-Koretska

Add UI tip for merge trains

This adds a UI tip to the pipeline stages
dropdowns indicating that merge train based
pipelines can only be retried as a whole
and not individually
parent 10aef600
...@@ -38,6 +38,11 @@ export default { ...@@ -38,6 +38,11 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
isMergeTrain: {
type: Boolean,
required: false,
default: true,
},
}, },
data() { data() {
return { return {
...@@ -126,6 +131,21 @@ export default { ...@@ -126,6 +131,21 @@ export default {
@pipelineActionRequestComplete="pipelineActionRequestComplete" @pipelineActionRequestComplete="pipelineActionRequestComplete"
/> />
</li> </li>
<template v-if="isMergeTrain">
<li class="gl-new-dropdown-divider" role="presentation">
<hr role="separator" aria-orientation="horizontal" class="dropdown-divider" />
</li>
<li>
<div
class="gl-display-flex gl-align-items-center"
data-testid="warning-message-merge-trains"
>
<div class="menu-item gl-font-sm gl-text-gray-300!">
{{ s__('Pipeline|Merge train pipeline jobs can not be retried') }}
</div>
</div>
</li>
</template>
</ul> </ul>
</gl-dropdown> </gl-dropdown>
</template> </template>
...@@ -15,6 +15,7 @@ import PipelineArtifacts from '~/pipelines/components/pipelines_list/pipelines_a ...@@ -15,6 +15,7 @@ import PipelineArtifacts from '~/pipelines/components/pipelines_list/pipelines_a
import PipelineStage from '~/pipelines/components/pipelines_list/stage.vue'; import PipelineStage from '~/pipelines/components/pipelines_list/stage.vue';
import CiIcon from '~/vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue';
import { MT_MERGE_STRATEGY } from '../constants';
export default { export default {
name: 'MRWidgetPipeline', name: 'MRWidgetPipeline',
...@@ -80,6 +81,11 @@ export default { ...@@ -80,6 +81,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
mergeStrategy: {
type: String,
required: false,
default: '',
},
}, },
computed: { computed: {
hasPipeline() { hasPipeline() {
...@@ -130,6 +136,9 @@ export default { ...@@ -130,6 +136,9 @@ export default {
this.buildsWithCoverage.length, this.buildsWithCoverage.length,
); );
}, },
isMergeTrain() {
return this.mergeStrategy === MT_MERGE_STRATEGY;
},
}, },
errorText: s__( errorText: s__(
'Pipeline|Could not retrieve the pipeline status. For troubleshooting steps, read the %{linkStart}documentation%{linkEnd}.', 'Pipeline|Could not retrieve the pipeline status. For troubleshooting steps, read the %{linkStart}documentation%{linkEnd}.',
...@@ -249,7 +258,7 @@ export default { ...@@ -249,7 +258,7 @@ export default {
class="stage-container dropdown mr-widget-pipeline-stages" class="stage-container dropdown mr-widget-pipeline-stages"
data-testid="widget-mini-pipeline-graph" data-testid="widget-mini-pipeline-graph"
> >
<pipeline-stage :stage="stage" /> <pipeline-stage :stage="stage" :is-merge-train="isMergeTrain" />
</div> </div>
</template> </template>
</span> </span>
......
...@@ -4,6 +4,7 @@ import { isNumber } from 'lodash'; ...@@ -4,6 +4,7 @@ import { isNumber } from 'lodash';
import { sanitize } from '~/lib/dompurify'; import { sanitize } from '~/lib/dompurify';
import { n__ } from '~/locale'; import { n__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import MergeRequestStore from '../stores/mr_widget_store';
import ArtifactsApp from './artifacts_list_app.vue'; import ArtifactsApp from './artifacts_list_app.vue';
import MrCollapsibleExtension from './mr_collapsible_extension.vue'; import MrCollapsibleExtension from './mr_collapsible_extension.vue';
import MrWidgetContainer from './mr_widget_container.vue'; import MrWidgetContainer from './mr_widget_container.vue';
...@@ -84,6 +85,15 @@ export default { ...@@ -84,6 +85,15 @@ export default {
this.deployments.length, this.deployments.length,
); );
}, },
preferredAutoMergeStrategy() {
if (this.glFeatures.mergeRequestWidgetGraphql) {
return MergeRequestStore.getPreferredAutoMergeStrategy(
this.mr.availableAutoMergeStrategies,
);
}
return this.mr.preferredAutoMergeStrategy;
},
}, },
}; };
</script> </script>
...@@ -100,6 +110,7 @@ export default { ...@@ -100,6 +110,7 @@ export default {
:source-branch-link="branchLink" :source-branch-link="branchLink"
:mr-troubleshooting-docs-path="mr.mrTroubleshootingDocsPath" :mr-troubleshooting-docs-path="mr.mrTroubleshootingDocsPath"
:ci-troubleshooting-docs-path="mr.ciTroubleshootingDocsPath" :ci-troubleshooting-docs-path="mr.ciTroubleshootingDocsPath"
:merge-strategy="preferredAutoMergeStrategy"
/> />
<template #footer> <template #footer>
<div v-if="mr.exposedArtifactsPath" class="js-exposed-artifacts"> <div v-if="mr.exposedArtifactsPath" class="js-exposed-artifacts">
......
---
title: Add warning message to pipeline stage dropdowns in merge trains
merge_request: 55437
author:
type: changed
...@@ -22328,6 +22328,9 @@ msgstr "" ...@@ -22328,6 +22328,9 @@ msgstr ""
msgid "Pipeline|Merge train pipeline" msgid "Pipeline|Merge train pipeline"
msgstr "" msgstr ""
msgid "Pipeline|Merge train pipeline jobs can not be retried"
msgstr ""
msgid "Pipeline|Merged result pipeline" msgid "Pipeline|Merged result pipeline"
msgstr "" msgstr ""
......
...@@ -48,6 +48,7 @@ describe('Pipelines stage component', () => { ...@@ -48,6 +48,7 @@ describe('Pipelines stage component', () => {
const findDropdownMenu = () => const findDropdownMenu = () =>
wrapper.find('[data-testid="mini-pipeline-graph-dropdown-menu-list"]'); wrapper.find('[data-testid="mini-pipeline-graph-dropdown-menu-list"]');
const findCiActionBtn = () => wrapper.find('.js-ci-action'); const findCiActionBtn = () => wrapper.find('.js-ci-action');
const findMergeTrainWarning = () => wrapper.find('[data-testid="warning-message-merge-trains"]');
const openStageDropdown = () => { const openStageDropdown = () => {
findDropdownToggle().trigger('click'); findDropdownToggle().trigger('click');
...@@ -172,4 +173,40 @@ describe('Pipelines stage component', () => { ...@@ -172,4 +173,40 @@ describe('Pipelines stage component', () => {
expect(wrapper.emitted('pipelineActionRequestComplete')).toHaveLength(1); expect(wrapper.emitted('pipelineActionRequestComplete')).toHaveLength(1);
}); });
}); });
describe('With merge trains enabled', () => {
beforeEach(async () => {
mock.onGet(dropdownPath).reply(200, stageReply);
createComponent({
isMergeTrain: true,
});
await openStageDropdown();
await axios.waitForAll();
});
it('shows a warning on the dropdown', () => {
const warning = findMergeTrainWarning();
expect(warning.text()).toBe('Merge train pipeline jobs can not be retried');
});
});
describe('With merge trains disabled', () => {
beforeEach(async () => {
mock.onGet(dropdownPath).reply(200, stageReply);
createComponent({
isMergeTrain: false,
});
await openStageDropdown();
await axios.waitForAll();
});
it('does not show a warning on the dropdown', () => {
const warning = findMergeTrainWarning();
expect(warning.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