summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-03 15:17:12 +0900
committerShinya Maeda <shinya@gitlab.com>2018-10-03 15:17:12 +0900
commit137f74b56396bc8feee87ead9c827ccc0fb47cd2 (patch)
treea5a4f6d2efdaffdbcf7ee5f92d77604e0b107ed6 /app/serializers
parent66b3bd5e2689c735675dc192746c972ebf627a97 (diff)
downloadgitlab-ce-137f74b56396bc8feee87ead9c827ccc0fb47cd2.tar.gz
Add job_entity_spec
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/job_entity.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/serializers/job_entity.rb b/app/serializers/job_entity.rb
index dd6c2fa1a6d..0b19cb16955 100644
--- a/app/serializers/job_entity.rb
+++ b/app/serializers/job_entity.rb
@@ -24,8 +24,12 @@ class JobEntity < Grape::Entity
path_to(:play_namespace_project_job, build)
end
+ expose :unschedule_path, if: -> (*) { scheduled? } do |build|
+ path_to(:unschedule_namespace_project_job, build)
+ end
+
expose :playable?, as: :playable
- expose :scheduled_at
+ expose :scheduled_at, if: -> (*) { scheduled? }
expose :created_at
expose :updated_at
expose :detailed_status, as: :status, with: DetailedStatusEntity
@@ -48,6 +52,10 @@ class JobEntity < Grape::Entity
build.playable? && can?(request.current_user, :update_build, build)
end
+ def scheduled?
+ build.scheduled?
+ end
+
def detailed_status
build.detailed_status(request.current_user)
end