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
c9fdeaf7
Commit
c9fdeaf7
authored
Feb 22, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PipelineDetailsEntity for last_pipeline
parent
123f8077
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
30 deletions
+10
-30
ee/app/serializers/dashboard_operations_project_entity.rb
ee/app/serializers/dashboard_operations_project_entity.rb
+1
-21
ee/spec/serializers/dashboard_operations_project_entity_spec.rb
...c/serializers/dashboard_operations_project_entity_spec.rb
+9
-9
No files found.
ee/app/serializers/dashboard_operations_project_entity.rb
View file @
c9fdeaf7
...
...
@@ -10,15 +10,7 @@ class DashboardOperationsProjectEntity < Grape::Entity
end
expose
:last_pipeline
,
if:
->
(
*
)
{
last_pipeline
}
do
|
_
,
options
|
pipeline_entity_for
(
last_pipeline
,
options
)
end
expose
:upstream_pipeline
,
if:
->
(
*
)
{
upstream_pipeline
}
do
|
_
,
options
|
pipeline_entity_for
(
upstream_pipeline
,
options
)
end
expose
:downstream_pipelines
,
if:
->
(
*
)
{
downstream_pipelines
}
do
|
_
,
options
|
pipeline_entity_for
(
downstream_pipelines
,
options
)
PipelineDetailsEntity
.
represent
(
last_pipeline
,
options
.
merge
(
request:
new_request
))
end
expose
:last_deployment
,
if:
->
(
*
)
{
last_deployment?
}
do
|
dashboard_project_object
,
options
|
...
...
@@ -50,18 +42,6 @@ class DashboardOperationsProjectEntity < Grape::Entity
dashboard_project
.
project
.
last_pipeline
end
def
upstream_pipeline
last_pipeline
&
.
source_pipeline
&
.
source_pipeline
end
def
downstream_pipelines
last_pipeline
&
.
sourced_pipelines
&
.
map
(
&
:source_pipeline
)
end
def
pipeline_entity_for
(
objects
,
options
)
PipelineEntity
.
represent
(
objects
,
options
.
merge
(
request:
new_request
))
end
def
last_deployment?
dashboard_project
.
last_deployment
end
...
...
ee/spec/serializers/dashboard_operations_project_entity_spec.rb
View file @
c9fdeaf7
...
...
@@ -33,8 +33,8 @@ describe DashboardOperationsProjectEntity do
create
(
:ci_sources_pipeline
,
pipeline:
pipeline
,
source_job:
bridge
)
end
it
'has the
upstream
pipeline field'
do
expect
(
subject
).
to
include
(
:upstream_pipeline
)
it
'has the
triggered_by
pipeline field'
do
expect
(
subject
[
:last_pipeline
]).
to
include
(
:triggered_by
)
end
end
...
...
@@ -45,8 +45,8 @@ describe DashboardOperationsProjectEntity do
create
(
:ci_sources_pipeline
,
source_job:
build
)
end
it
'has the
downstream
pipeline field'
do
expect
(
subject
).
to
include
(
:downstream_pipelines
)
it
'has the
triggered
pipeline field'
do
expect
(
subject
[
:last_pipeline
]).
to
include
(
:triggered
)
end
context
'when there are multiple downstream statuses'
do
...
...
@@ -55,8 +55,8 @@ describe DashboardOperationsProjectEntity do
end
it
'has the downstream pipeline field'
do
expect
(
subject
).
to
include
(
:downstream_pipelines
)
expect
(
subject
[
:
downstream_pipelines
].
count
).
to
eq
(
6
)
expect
(
subject
[
:last_pipeline
]).
to
include
(
:triggered
)
expect
(
subject
[
:
last_pipeline
][
:triggered
].
count
).
to
eq
(
6
)
end
end
end
...
...
@@ -71,12 +71,12 @@ describe DashboardOperationsProjectEntity do
end
it
'has the upstream pipeline field'
do
expect
(
subject
).
to
include
(
:upstream_pipeline
)
expect
(
subject
[
:last_pipeline
]).
to
include
(
:triggered_by
)
end
it
'has the downstream pipeline field'
do
expect
(
subject
).
to
include
(
:downstream_pipelines
)
expect
(
subject
[
:
downstream_pipelines
].
count
).
to
eq
(
5
)
expect
(
subject
[
:last_pipeline
]).
to
include
(
:triggered
)
expect
(
subject
[
:
last_pipeline
][
:triggered
].
count
).
to
eq
(
5
)
end
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