From b07aa831c8bbe3c4b7a36ae7a276ceb74b2b6b10 Mon Sep 17 00:00:00 2001 From: Briley Sandlin Date: Tue, 6 May 2025 18:34:26 -0500 Subject: [PATCH 1/4] Add review flow to pipeline page Changelog: added --- app/assets/javascripts/ci/constants.js | 3 + .../header/components/header_badges.vue | 25 +++-- .../components/pipeline_approval_alert.vue | 105 ++++++++++++++++++ .../components/pipeline_error_alert.vue | 56 ++++++++++ .../get_pipeline_header_data.query.graphql | 1 + .../header/pipeline_header.vue | 52 ++++++++- .../ci/pipeline_details/pipeline_header.js | 6 + .../components/pipeline_labels.vue | 21 +++- .../components/pipeline_status_badge.vue | 14 +-- app/helpers/projects/pipeline_helper.rb | 5 +- app/views/projects/pipelines/show.html.haml | 15 +-- locale/gitlab.pot | 18 +++ .../header/pipeline_header_spec.js | 44 ++++++++ .../frontend/ci/pipeline_details/mock_data.js | 17 +++ spec/frontend/fixtures/pipeline_header.rb | 24 ++++ .../projects/pipelines/show.html.haml_spec.rb | 29 ----- 16 files changed, 368 insertions(+), 67 deletions(-) create mode 100644 app/assets/javascripts/ci/pipeline_details/header/components/pipeline_approval_alert.vue create mode 100644 app/assets/javascripts/ci/pipeline_details/header/components/pipeline_error_alert.vue diff --git a/app/assets/javascripts/ci/constants.js b/app/assets/javascripts/ci/constants.js index 07bf90910f6e67..5bfd3a4b1a62f2 100644 --- a/app/assets/javascripts/ci/constants.js +++ b/app/assets/javascripts/ci/constants.js @@ -48,3 +48,6 @@ export const PIPELINE_POLL_INTERVAL_BACKOFF = 1.2; export const FOUR_MINUTES_IN_MS = 1000 * 60 * 4; export const NETWORK_STATUS_READY = 7; + +// For pipelines that need human approval +export const AI_REVIEW_TEXT = `code should be reviewed by a non-AI user`; diff --git a/app/assets/javascripts/ci/pipeline_details/header/components/header_badges.vue b/app/assets/javascripts/ci/pipeline_details/header/components/header_badges.vue index 0ada6bd95afc00..348864ddb550a1 100644 --- a/app/assets/javascripts/ci/pipeline_details/header/components/header_badges.vue +++ b/app/assets/javascripts/ci/pipeline_details/header/components/header_badges.vue @@ -21,6 +21,11 @@ export default { GlTooltip: GlTooltipDirective, }, props: { + isUnderReview: { + type: Boolean, + required: false, + default: false, + }, pipeline: { type: Object, required: true, @@ -58,26 +63,26 @@ export default { return this.pipeline.configSource === AUTO_DEVOPS_SOURCE; }, yamlErrorMessage() { - return this.pipeline?.errorMessages.nodes[0].content || ''; + return this.pipeline?.errorMessages?.nodes[0]?.content || ''; }, triggeredByPath() { return this.pipeline?.triggeredByPath; }, badges() { return { - schedule: this.isScheduledPipeline, - trigger: this.pipeline.trigger, - invalid: this.hasPipelineErrorMessages, + autoDevops: this.isAutoDevopsPipeline, + branchPipeline: this.isBranchPipeline, child: this.pipeline.child, + detached: this.isDetachedPipeline, + failed: Boolean(this.failureReason) && !this.isUnderReview, + invalid: this.hasPipelineErrorMessages && !this.isUnderReview, latest: this.pipeline.latest, - mergeTrainPipeline: this.isMergeTrainPipeline, mergedResultsPipeline: this.isMergedResultsPipeline, - branchPipeline: this.isBranchPipeline, - tagPipeline: this.isTagPipeline, - detached: this.isDetachedPipeline, - failed: Boolean(this.failureReason), - autoDevops: this.isAutoDevopsPipeline, + mergeTrainPipeline: this.isMergeTrainPipeline, + schedule: this.isScheduledPipeline, stuck: this.pipeline.stuck, + tagPipeline: this.isTagPipeline, + trigger: this.pipeline.trigger, }; }, }, diff --git a/app/assets/javascripts/ci/pipeline_details/header/components/pipeline_approval_alert.vue b/app/assets/javascripts/ci/pipeline_details/header/components/pipeline_approval_alert.vue new file mode 100644 index 00000000000000..ca2945b32c6434 --- /dev/null +++ b/app/assets/javascripts/ci/pipeline_details/header/components/pipeline_approval_alert.vue @@ -0,0 +1,105 @@ + + + diff --git a/app/assets/javascripts/ci/pipeline_details/header/components/pipeline_error_alert.vue b/app/assets/javascripts/ci/pipeline_details/header/components/pipeline_error_alert.vue new file mode 100644 index 00000000000000..3ff94e93385fe4 --- /dev/null +++ b/app/assets/javascripts/ci/pipeline_details/header/components/pipeline_error_alert.vue @@ -0,0 +1,56 @@ + + + diff --git a/app/assets/javascripts/ci/pipeline_details/header/graphql/queries/get_pipeline_header_data.query.graphql b/app/assets/javascripts/ci/pipeline_details/header/graphql/queries/get_pipeline_header_data.query.graphql index e4f52276ea836a..10865eb0995804 100644 --- a/app/assets/javascripts/ci/pipeline_details/header/graphql/queries/get_pipeline_header_data.query.graphql +++ b/app/assets/javascripts/ci/pipeline_details/header/graphql/queries/get_pipeline_header_data.query.graphql @@ -51,6 +51,7 @@ query getPipelineHeaderData($fullPath: ID!, $iid: ID!) { name totalJobs refText + ref type triggeredByPath stuck diff --git a/app/assets/javascripts/ci/pipeline_details/header/pipeline_header.vue b/app/assets/javascripts/ci/pipeline_details/header/pipeline_header.vue index 2928617ed02296..8b30421adcd045 100644 --- a/app/assets/javascripts/ci/pipeline_details/header/pipeline_header.vue +++ b/app/assets/javascripts/ci/pipeline_details/header/pipeline_header.vue @@ -1,5 +1,6 @@