diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-12-20 12:39:09 +0300 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2018-12-20 12:39:09 +0300 |
commit | 9f0983a4b160fac67552b0795f445b08e940ef16 (patch) | |
tree | d01b0f29b4255773857e57cba0ad40cc19537676 /app/serializers | |
parent | 70ba4ba2851f42ed1d3a31e4994d89b59c619570 (diff) |
Resolve "Hide cluster features that don't work yet with Group Clusters"
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/environment_entity.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index 07a13c33b89..4a7d13915dd 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -23,6 +23,10 @@ class EnvironmentEntity < Grape::Entity stop_project_environment_path(environment.project, environment) end + expose :cluster_type, if: ->(environment, _) { cluster_platform_kubernetes? } do |environment| + cluster.cluster_type + end + expose :terminal_path, if: ->(*) { environment.has_terminals? && can_access_terminal? } do |environment| terminal_project_environment_path(environment.project, environment) end @@ -48,4 +52,16 @@ class EnvironmentEntity < Grape::Entity def can_access_terminal? can?(request.current_user, :create_environment_terminal, environment) end + + def cluster_platform_kubernetes? + deployment_platform && deployment_platform.is_a?(Clusters::Platforms::Kubernetes) + end + + def deployment_platform + environment.deployment_platform + end + + def cluster + deployment_platform.cluster + end end |