Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0286eafe
Commit
0286eafe
authored
Jan 08, 2019
by
Filipa Lacerda
Committed by
Kamil Trzciński
Jan 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds expanded triggered pipeline in the API
parent
1486304d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+1
-1
ee/app/serializers/triggered_pipeline_entity.rb
ee/app/serializers/triggered_pipeline_entity.rb
+12
-0
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
0286eafe
...
...
@@ -69,7 +69,7 @@ class Projects::PipelinesController < Projects::ApplicationController
render
json:
PipelineSerializer
.
new
(
project:
@project
,
current_user:
@current_user
)
.
represent
(
@pipeline
,
grouped:
true
)
.
represent
(
@pipeline
,
grouped:
true
,
expanded:
params
[
:expanded
].
to_a
)
end
end
end
...
...
ee/app/serializers/triggered_pipeline_entity.rb
View file @
0286eafe
...
...
@@ -15,8 +15,12 @@ class TriggeredPipelineEntity < Grape::Entity
expose
:details
do
expose
:detailed_status
,
as: :status
,
with:
DetailedStatusEntity
expose
:ordered_stages
,
as: :stages
,
using:
StageEntity
,
if:
->
(
_
,
opts
)
{
expand?
(
opts
)
}
end
expose
:triggered_by_pipeline
,
as: :triggered_by
,
with:
TriggeredPipelineEntity
,
if:
->
(
_
,
opts
)
{
expand_for_path?
(
opts
,
:triggered_by
)
}
expose
:triggered_pipelines
,
as: :triggered
,
using:
TriggeredPipelineEntity
,
if:
->
(
_
,
opts
)
{
expand_for_path?
(
opts
,
:triggered
)
}
expose
:project
,
using:
ProjectEntity
private
...
...
@@ -26,4 +30,12 @@ class TriggeredPipelineEntity < Grape::Entity
def
detailed_status
pipeline
.
detailed_status
(
request
.
current_user
)
end
def
expand?
(
opts
)
opts
[
:expanded
].
to_a
.
include?
(
pipeline
.
id
)
end
def
expand_for_path?
(
opts
,
path
)
opts
[
:attr_path
].
last
==
path
&&
expand?
(
opts
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment