summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 18:08:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 18:08:58 +0000
commit1ca9950d5f890cd8f185e1eda158b969a7244fe2 (patch)
tree6f62715938a4b2b001705c51c697609a8e0850ae /app/serializers
parentbcc77054ee9aefd1e332e04a4189390fd5a3112e (diff)
downloadgitlab-ce-1ca9950d5f890cd8f185e1eda158b969a7244fe2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/projects/serverless/service_entity.rb88
1 files changed, 14 insertions, 74 deletions
diff --git a/app/serializers/projects/serverless/service_entity.rb b/app/serializers/projects/serverless/service_entity.rb
index 10360e575bb..05beb562e40 100644
--- a/app/serializers/projects/serverless/service_entity.rb
+++ b/app/serializers/projects/serverless/service_entity.rb
@@ -5,91 +5,31 @@ module Projects
class ServiceEntity < Grape::Entity
include RequestAwareEntity
- expose :name do |service|
- service.dig('metadata', 'name')
- end
-
- expose :namespace do |service|
- service.dig('metadata', 'namespace')
- end
-
- expose :environment_scope do |service|
- service.dig('environment_scope')
- end
-
- expose :cluster_id do |service|
- service.dig('cluster_id')
- end
+ expose :name
+ expose :namespace
+ expose :environment_scope
+ expose :podcount
+ expose :created_at
+ expose :image
+ expose :description
+ expose :url
expose :detail_url do |service|
project_serverless_path(
request.project,
- service.dig('environment_scope'),
- service.dig('metadata', 'name'))
- end
-
- expose :podcount do |service|
- service.dig('podcount')
+ service.environment_scope,
+ service.name)
end
expose :metrics_url do |service|
project_serverless_metrics_path(
request.project,
- service.dig('environment_scope'),
- service.dig('metadata', 'name')) + ".json"
- end
-
- expose :created_at do |service|
- service.dig('metadata', 'creationTimestamp')
- end
-
- expose :url do |service|
- knative_06_07_url(service) || knative_05_url(service)
- end
-
- expose :description do |service|
- knative_07_description(service) || knative_05_06_description(service)
+ service.environment_scope,
+ service.name, format: :json)
end
- expose :image do |service|
- service.dig(
- 'spec',
- 'runLatest',
- 'configuration',
- 'build',
- 'template',
- 'name')
- end
-
- private
-
- def knative_07_description(service)
- service.dig(
- 'spec',
- 'template',
- 'metadata',
- 'annotations',
- 'Description'
- )
- end
-
- def knative_05_url(service)
- "http://#{service.dig('status', 'domain')}"
- end
-
- def knative_06_07_url(service)
- service.dig('status', 'url')
- end
-
- def knative_05_06_description(service)
- service.dig(
- 'spec',
- 'runLatest',
- 'configuration',
- 'revisionTemplate',
- 'metadata',
- 'annotations',
- 'Description')
+ expose :cluster_id do |service|
+ service.cluster&.id
end
end
end