summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-05-11 16:17:03 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2018-05-17 13:53:00 +0200
commit878ca2e69b371e6c12acee6bddd32b4406c651d7 (patch)
tree7f829cdf6d9020cf106b32b8ae63d7d9e96a629e /app/serializers
parent19428e800895ba20eacb3357285acef8d69f6d8c (diff)
downloadgitlab-ce-878ca2e69b371e6c12acee6bddd32b4406c651d7.tar.gz
Exclude coverage data from the pipelines page
When displaying a project's pipelines (Projects::PipelinesController#index) we now exclude the coverage data. This data was not used by the frontend, yet getting it would require one SQL query per pipeline. These queries in turn could be quite expensive on GitLab.com.
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/pipeline_entity.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb
index 6457294b285..f782b411b84 100644
--- a/app/serializers/pipeline_entity.rb
+++ b/app/serializers/pipeline_entity.rb
@@ -4,7 +4,11 @@ class PipelineEntity < Grape::Entity
expose :id
expose :user, using: UserEntity
expose :active?, as: :active
- expose :coverage
+
+ # Coverage isn't always necessary (e.g. when displaying project pipelines in
+ # the UI). Instead of creating an entirely different entity we just allow the
+ # disabling of this specific field whenever necessary.
+ expose :coverage, unless: proc { options[:disable_coverage] }
expose :source
expose :created_at, :updated_at