summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-06-14 16:23:41 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-06-14 16:23:41 +0800
commit931ab01adba637f6c36a976a19250e93096bc552 (patch)
tree8c2e0de40b88abc7d2b92bb0705351e28c1ec425 /app/serializers
parentf99cee8e9cfcc8eaf340e487503682bb5699591a (diff)
parentb29bf62602b6e962ceb31dd7535743a7d8c4864c (diff)
downloadgitlab-ce-931ab01adba637f6c36a976a19250e93096bc552.tar.gz
Merge remote-tracking branch 'upstream/master' into 33149-rename-more-builds
* upstream/master: (34 commits) Revert "Merge branch 'karma-headless-chrome' into 'master'" Make small pipeline schedules UI enhancements. Remove js classes from vue component that are not needed in vue component Update tests and application Adds "Pipeline" to job's sidebar Change border color of job's scroll controllers to $border-color Add database helpers 'add_timestamps_with_timezone' and 'timestamps_with_timezone' Added Tectonic to the page. Always check read_issue permissions when loading issue Handle legacy jobs without name Do not expose internal artifacts hash in build entity Use wait_for_requests instead of sleep 0.3 Limit wiki container width Fix migrations testing support RSpec hooks order Rename BuildEntity to JobEntity Fix support for external_url for commit statuses Allow to access pipelines even if they are disabled, but only present jobs and commit statuses without giving ability to access them add CHANGELOG.md entry for !12036 remove phantomjs-specific test hacks update karma job to use chrome build image created by gitlab-build-images!41 ...
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/build_details_entity.rb9
-rw-r--r--app/serializers/build_serializer.rb2
-rw-r--r--app/serializers/deployment_entity.rb4
-rw-r--r--app/serializers/job_entity.rb (renamed from app/serializers/build_entity.rb)4
-rw-r--r--app/serializers/job_group_entity.rb2
5 files changed, 9 insertions, 12 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb
index b04a42105aa..eeb5399aa8b 100644
--- a/app/serializers/build_details_entity.rb
+++ b/app/serializers/build_details_entity.rb
@@ -1,18 +1,15 @@
-class BuildDetailsEntity < BuildEntity
+class BuildDetailsEntity < JobEntity
expose :coverage, :erased_at, :duration
expose :tag_list, as: :tags
-
expose :user, using: UserEntity
+ expose :runner, using: RunnerEntity
+ expose :pipeline, using: PipelineEntity
expose :erased_by, if: -> (*) { build.erased? }, using: UserEntity
expose :erase_path, if: -> (*) { build.erasable? && can?(current_user, :update_build, project) } do |build|
erase_namespace_project_job_path(project.namespace, project, build)
end
- expose :artifacts, using: BuildArtifactEntity
- expose :runner, using: RunnerEntity
- expose :pipeline, using: PipelineEntity
-
expose :merge_request, if: -> (*) { can?(current_user, :read_merge_request, build.merge_request) } do
expose :iid do |build|
build.merge_request.iid
diff --git a/app/serializers/build_serializer.rb b/app/serializers/build_serializer.rb
index 79b67001199..bae9932847f 100644
--- a/app/serializers/build_serializer.rb
+++ b/app/serializers/build_serializer.rb
@@ -1,5 +1,5 @@
class BuildSerializer < BaseSerializer
- entity BuildEntity
+ entity JobEntity
def represent_status(resource)
data = represent(resource, { only: [:status] })
diff --git a/app/serializers/deployment_entity.rb b/app/serializers/deployment_entity.rb
index 8b3de1bed0f..e493c9162fd 100644
--- a/app/serializers/deployment_entity.rb
+++ b/app/serializers/deployment_entity.rb
@@ -24,6 +24,6 @@ class DeploymentEntity < Grape::Entity
expose :user, using: UserEntity
expose :commit, using: CommitEntity
- expose :deployable, using: BuildEntity
- expose :manual_actions, using: BuildEntity
+ expose :deployable, using: JobEntity
+ expose :manual_actions, using: JobEntity
end
diff --git a/app/serializers/build_entity.rb b/app/serializers/job_entity.rb
index 67001f4547d..d6de43bcbcb 100644
--- a/app/serializers/build_entity.rb
+++ b/app/serializers/job_entity.rb
@@ -1,11 +1,11 @@
-class BuildEntity < Grape::Entity
+class JobEntity < Grape::Entity
include RequestAwareEntity
expose :id
expose :name
expose :build_path do |build|
- path_to(:namespace_project_job, build)
+ build.target_url || path_to(:namespace_project_job, build)
end
expose :retry_path, if: -> (*) { retryable? } do |build|
diff --git a/app/serializers/job_group_entity.rb b/app/serializers/job_group_entity.rb
index 04487e59009..8554de55517 100644
--- a/app/serializers/job_group_entity.rb
+++ b/app/serializers/job_group_entity.rb
@@ -4,7 +4,7 @@ class JobGroupEntity < Grape::Entity
expose :name
expose :size
expose :detailed_status, as: :status, with: StatusEntity
- expose :jobs, with: BuildEntity
+ expose :jobs, with: JobEntity
private