BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2178bd5f
Commit
2178bd5f
authored
Apr 23, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stage.json endpoint
parent
551f8c4b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
23 deletions
+18
-23
pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+1
-1
stage_details_entity.rb
app/serializers/stage_details_entity.rb
+0
-21
stage_entity.rb
app/serializers/stage_entity.rb
+16
-0
stage_serializer.rb
app/serializers/stage_serializer.rb
+1
-1
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
2178bd5f
...
...
@@ -106,7 +106,7 @@ class Projects::PipelinesController < Projects::ApplicationController
render
json:
StageSerializer
.
new
(
project:
@project
,
current_user:
@current_user
)
.
represent
(
@
pipelin
e
)
.
represent
(
@
stage
,
details:
tru
e
)
end
def
retry
...
...
app/serializers/stage_details_entity.rb
deleted
100644 → 0
View file @
551f8c4b
class
StageDetailsEntity
<
Grape
::
Entity
include
RequestAwareEntity
expose
:name
expose
:title
do
|
stage
|
"
#{
stage
.
name
}
:
#{
detailed_status
.
label
}
"
end
expose
:statuses
,
with:
JobEntity
expose
:detailed_status
,
as: :status
,
with:
StatusEntity
private
alias_method
:stage
,
:object
def
detailed_status
stage
.
detailed_status
(
request
.
current_user
)
end
end
app/serializers/stage_entity.rb
View file @
2178bd5f
...
...
@@ -11,6 +11,12 @@ class StageEntity < Grape::Entity
if:
->
(
_
,
opts
)
{
opts
[
:grouped
]
},
with:
JobGroupEntity
expose
:latest_statuses
,
if:
->
(
_
,
opts
)
{
opts
[
:details
]
},
with:
JobEntity
do
|
stage
|
latest_statuses
end
expose
:detailed_status
,
as: :status
,
with:
StatusEntity
expose
:path
do
|
stage
|
...
...
@@ -35,4 +41,14 @@ class StageEntity < Grape::Entity
def
detailed_status
stage
.
detailed_status
(
request
.
current_user
)
end
def
grouped_statuses
@grouped_statuses
||=
stage
.
statuses
.
latest_ordered
.
group_by
(
&
:status
)
end
def
latest_statuses
HasStatus
::
ORDERED_STATUSES
.
map
do
|
ordered_status
|
grouped_statuses
.
fetch
(
ordered_status
,
[])
end
.
flatten
end
end
app/serializers/stage_serializer.rb
View file @
2178bd5f
...
...
@@ -3,5 +3,5 @@ class StageSerializer < BaseSerializer
InvalidResourceError
=
Class
.
new
(
StandardError
)
entity
Stage
Details
Entity
entity
StageEntity
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