diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-11-14 14:11:27 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-11-14 14:11:27 +0300 |
commit | 1048ed4d862196febaeae43ed82263386b48ec86 (patch) | |
tree | de9c6ae2b31e6020b35f6aae84854c7d844313f2 /app/serializers/environment_status_entity.rb | |
parent | f139ccf796f7892a027ce50c5ea768528a78ff3e (diff) |
Avoid returning deployment metrics url to MR widget when the deployment is not successful
Diffstat (limited to 'app/serializers/environment_status_entity.rb')
-rw-r--r-- | app/serializers/environment_status_entity.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/environment_status_entity.rb b/app/serializers/environment_status_entity.rb index 4c6664e9e25..f6321b9e520 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? && environment.has_metrics? } do |es| + expose :metrics_url, if: ->(*) { can_read_environment? && deployment.has_metrics? } do |es| metrics_project_environment_deployment_path(es.project, es.environment, es.deployment) end @@ -45,6 +45,10 @@ class EnvironmentStatusEntity < Grape::Entity object.environment end + def deployment + object.deployment + end + def project object.environment.project end |