From cee56b8f8e61ac6433ee4f8c4428825865226b11 Mon Sep 17 00:00:00 2001 From: fdegier Date: Mon, 8 Sep 2025 16:25:15 +0200 Subject: [PATCH] Add Fix pipeline button to MR pipeline widget Changelog: added EE: true --- .../components/mr_widget_pipeline.vue | 51 ++++++++ .../vue_merge_request_widget/index.js | 3 + .../components/mr_widget_pipeline_spec.js | 119 ++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 ee/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue index 087b9e59f78f27..96f2970094f9e8 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue @@ -9,6 +9,7 @@ import { GlTooltipDirective, GlButton, } from '@gitlab/ui'; +import DuoWorkflowAction from 'ee_component/ai/components/duo_workflow_action.vue'; import SafeHtml from '~/vue_shared/directives/safe_html'; import { s__, n__ } from '~/locale'; import CiIcon from '~/vue_shared/components/ci_icon/ci_icon.vue'; @@ -19,6 +20,7 @@ import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue'; import HelpPopover from '~/vue_shared/components/help_popover.vue'; import HelpIcon from '~/vue_shared/components/help_icon/help_icon.vue'; +import { AGENT_PRIVILEGES } from '~/duo_agent_platform/constants'; import mergeRequestEventTypeQuery from '../queries/merge_request_event_type.query.graphql'; import runPipelineMixin from '../mixins/run_pipeline'; import { @@ -59,12 +61,18 @@ export default { TooltipOnTruncate, HelpPopover, HelpIcon, + DuoWorkflowAction, }, directives: { GlTooltip: GlTooltipDirective, SafeHtml, }, mixins: [runPipelineMixin], + inject: { + mergeRequestPath: { + default: null, + }, + }, props: { pipeline: { type: Object, @@ -194,11 +202,42 @@ export default { return PIPELINE_EVENT_TYPE_MAP[eventTypeName] || { title: '', content: '' }; }, + getPipelinePath() { + if (this.pipeline?.path) { + return `${gon.gitlab_url}${this.pipeline.path}`; + } + return null; + }, + showDuoWorkflowAction() { + return this.hasPipeline && this.status.group === 'failed' && !this.retargeted; + }, + getAdditionalContext() { + return [ + { + Category: 'merge_request', + Content: JSON.stringify({ + url: this.mergeRequestPath, + }), + }, + { + Category: 'pipeline', + Content: JSON.stringify({ + source_branch: this.sourceBranch, + }), + }, + ]; + }, }, errorText: s__( 'Pipeline|Could not retrieve the pipeline status. For troubleshooting steps, read the %{linkStart}documentation%{linkEnd}.', ), monitoringPipelineText: s__('Pipeline|Checking pipeline status.'), + AGENT_PRIVILEGES: [ + AGENT_PRIVILEGES.READ_WRITE_FILES, + AGENT_PRIVILEGES.READ_ONLY_GITLAB, + AGENT_PRIVILEGES.READ_WRITE_GITLAB, + AGENT_PRIVILEGES.USE_GIT, + ], };