diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-07-01 12:40:59 +0300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2019-07-08 00:13:21 +0300 |
commit | d2ba2951f737082edd568505f985ebf9a0808be7 (patch) | |
tree | 7da25a607c16810546f6ea57e5354ba145029918 /app/serializers | |
parent | 1b5b0dea5228ae7fd520c8bca3f03c4799a4d31d (diff) |
Extract deployment_metrics into own object
We can now share project so that we don't have to load project twice.
Also, this extracts non-relevant logic out of Deployment.
Update DeploymentsController accordingly
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/environment_status_entity.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/serializers/environment_status_entity.rb b/app/serializers/environment_status_entity.rb index f6321b9e520..811cc2ad5af 100644 --- a/app/serializers/environment_status_entity.rb +++ b/app/serializers/environment_status_entity.rb @@ -11,7 +11,7 @@ class EnvironmentStatusEntity < Grape::Entity project_environment_path(es.project, es.environment) end - expose :metrics_url, if: ->(*) { can_read_environment? && deployment.has_metrics? } do |es| + expose :metrics_url, if: ->(*) { can_read_environment? && has_metrics? } do |es| metrics_project_environment_deployment_path(es.project, es.environment, es.deployment) end @@ -45,8 +45,8 @@ class EnvironmentStatusEntity < Grape::Entity object.environment end - def deployment - object.deployment + def has_metrics? + object.has_metrics? end def project |