Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-09-11 12:06:33 +0300
committerKushal Pandya <kushalspandya@gmail.com>2019-09-11 12:06:33 +0300
commit48b98b5898e15ab4bb1db47e201fef8db68dc34d (patch)
tree70edcf4953d88d542243fe1d288ff249c02c9d9f /lib
parentbfaa96d586668678893e295062495f2c35b73c2a (diff)
Enables Run Pipeline button to be rendered
In the Merge Request view, under pipelines tab the user can see a run pipeline button Adds axios post request to button click Adds the logic to handle the user click, refresh the table and disable the button while thee request is being made Updates UI for desktop and mobile Adds specs Regenerates potfile Follow-up after review Uses .finally to avoid code repetition
Diffstat (limited to 'lib')
-rw-r--r--lib/api/merge_requests.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 64ee82cd775..4c092f10729 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -317,6 +317,26 @@ module API
present paginate(pipelines), with: Entities::PipelineBasic
end
+ desc 'Create a pipeline for merge request' do
+ success Entities::Pipeline
+ end
+ post ':id/merge_requests/:merge_request_iid/pipelines' do
+ authorize! :create_pipeline, user_project
+
+ pipeline = ::MergeRequests::CreatePipelineService
+ .new(user_project, current_user, allow_duplicate: true)
+ .execute(find_merge_request_with_access(params[:merge_request_iid]))
+
+ if pipeline.nil?
+ not_allowed!
+ elsif pipeline.persisted?
+ status :ok
+ present pipeline, with: Entities::Pipeline
+ else
+ render_validation_error!(pipeline)
+ end
+ end
+
desc 'Update a merge request' do
success Entities::MergeRequest
end