summaryrefslogtreecommitdiff
path: root/app/serializers/pipeline_details_entity.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-05-26 10:31:42 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-05-31 21:44:53 +0200
commit68569584b728ac2dd5100593e9db302f362994f5 (patch)
tree1558a088e7aa5ad988e30cea791ec938a6d63ded /app/serializers/pipeline_details_entity.rb
parent47a0276e53de4635df43124607ac1a101d6f1b70 (diff)
downloadgitlab-ce-68569584b728ac2dd5100593e9db302f362994f5.tar.gz
Create PipelineDetailsEntity
Now we have a PipelineEntity which is a bit smaller, mostly in bytes needing to send to the frontend. PipelineDetailsEntity is the default for the PipelineSerializer, limiting the changes needed. This commit also incorporates the review.
Diffstat (limited to 'app/serializers/pipeline_details_entity.rb')
-rw-r--r--app/serializers/pipeline_details_entity.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/serializers/pipeline_details_entity.rb b/app/serializers/pipeline_details_entity.rb
new file mode 100644
index 00000000000..e80685dd4e3
--- /dev/null
+++ b/app/serializers/pipeline_details_entity.rb
@@ -0,0 +1,21 @@
+class PipelineDetailsEntity < PipelineEntity
+ expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? }
+
+ expose :details do
+ expose :detailed_status, as: :status, with: StatusEntity
+ expose :duration
+ expose :finished_at
+ expose :stages, using: StageEntity
+ expose :artifacts, using: BuildArtifactEntity
+ expose :manual_actions, using: BuildActionEntity
+ end
+
+ expose :flags do
+ expose :latest?, as: :latest
+ expose :triggered?, as: :triggered
+ expose :stuck?, as: :stuck
+ expose :has_yaml_errors?, as: :yaml_errors
+ expose :can_retry?, as: :retryable
+ expose :can_cancel?, as: :cancelable
+ end
+end