Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
cb0b16eb
Commit
cb0b16eb
authored
Nov 02, 2018
by
Shinya Maeda
Committed by
Kamil Trzciński
Nov 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scheduled flag to job entity
parent
74c79123
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
1 deletion
+17
-1
app/serializers/build_action_entity.rb
app/serializers/build_action_entity.rb
+6
-1
app/serializers/job_entity.rb
app/serializers/job_entity.rb
+1
-0
changelogs/unreleased/add-scheduled-flag-to-job-entity.yml
changelogs/unreleased/add-scheduled-flag-to-job-entity.yml
+5
-0
spec/serializers/build_action_entity_spec.rb
spec/serializers/build_action_entity_spec.rb
+4
-0
spec/serializers/job_entity_spec.rb
spec/serializers/job_entity_spec.rb
+1
-0
No files found.
app/serializers/build_action_entity.rb
View file @
cb0b16eb
...
@@ -12,7 +12,8 @@ class BuildActionEntity < Grape::Entity
...
@@ -12,7 +12,8 @@ class BuildActionEntity < Grape::Entity
end
end
expose
:playable?
,
as: :playable
expose
:playable?
,
as: :playable
expose
:scheduled_at
,
if:
->
(
build
)
{
build
.
scheduled?
}
expose
:scheduled?
,
as: :scheduled
expose
:scheduled_at
,
if:
->
(
*
)
{
scheduled?
}
expose
:unschedule_path
,
if:
->
(
build
)
{
build
.
scheduled?
}
do
|
build
|
expose
:unschedule_path
,
if:
->
(
build
)
{
build
.
scheduled?
}
do
|
build
|
unschedule_project_job_path
(
build
.
project
,
build
)
unschedule_project_job_path
(
build
.
project
,
build
)
...
@@ -25,4 +26,8 @@ class BuildActionEntity < Grape::Entity
...
@@ -25,4 +26,8 @@ class BuildActionEntity < Grape::Entity
def
playable?
def
playable?
build
.
playable?
&&
can?
(
request
.
current_user
,
:update_build
,
build
)
build
.
playable?
&&
can?
(
request
.
current_user
,
:update_build
,
build
)
end
end
def
scheduled?
build
.
scheduled?
end
end
end
app/serializers/job_entity.rb
View file @
cb0b16eb
...
@@ -33,6 +33,7 @@ class JobEntity < Grape::Entity
...
@@ -33,6 +33,7 @@ class JobEntity < Grape::Entity
end
end
expose
:playable?
,
as: :playable
expose
:playable?
,
as: :playable
expose
:scheduled?
,
as: :scheduled
expose
:scheduled_at
,
if:
->
(
*
)
{
scheduled?
}
expose
:scheduled_at
,
if:
->
(
*
)
{
scheduled?
}
expose
:created_at
expose
:created_at
expose
:updated_at
expose
:updated_at
...
...
changelogs/unreleased/add-scheduled-flag-to-job-entity.yml
0 → 100644
View file @
cb0b16eb
---
title
:
Add scheduled flag to job entity
merge_request
:
22710
author
:
type
:
other
spec/serializers/build_action_entity_spec.rb
View file @
cb0b16eb
...
@@ -26,6 +26,10 @@ describe BuildActionEntity do
...
@@ -26,6 +26,10 @@ describe BuildActionEntity do
context
'when job is scheduled'
do
context
'when job is scheduled'
do
let
(
:job
)
{
create
(
:ci_build
,
:scheduled
)
}
let
(
:job
)
{
create
(
:ci_build
,
:scheduled
)
}
it
'returns scheduled'
do
expect
(
subject
[
:scheduled
]).
to
be_truthy
end
it
'returns scheduled_at'
do
it
'returns scheduled_at'
do
expect
(
subject
[
:scheduled_at
]).
to
eq
(
job
.
scheduled_at
)
expect
(
subject
[
:scheduled_at
]).
to
eq
(
job
.
scheduled_at
)
end
end
...
...
spec/serializers/job_entity_spec.rb
View file @
cb0b16eb
...
@@ -117,6 +117,7 @@ describe JobEntity do
...
@@ -117,6 +117,7 @@ describe JobEntity do
end
end
it
'contains scheduled_at'
do
it
'contains scheduled_at'
do
expect
(
subject
[
:scheduled
]).
to
be_truthy
expect
(
subject
[
:scheduled_at
]).
to
eq
(
job
.
scheduled_at
)
expect
(
subject
[
:scheduled_at
]).
to
eq
(
job
.
scheduled_at
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment