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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d3e794e2
Commit
d3e794e2
authored
Mar 28, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optionally filter by deployment time
parent
73203873
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
app/controllers/projects/deployments_controller.rb
app/controllers/projects/deployments_controller.rb
+5
-3
spec/controllers/projects/deployments_controller_spec.rb
spec/controllers/projects/deployments_controller_spec.rb
+1
-1
No files found.
app/controllers/projects/deployments_controller.rb
View file @
d3e794e2
...
...
@@ -2,9 +2,11 @@ class Projects::DeploymentsController < Projects::ApplicationController
before_action
:authorize_read_deployment!
def
index
serializer
=
DeploymentSerializer
.
new
(
user:
@current_user
)
deployments
=
environment
.
deployments
.
where
(
'created_at > ?'
,
8
.
hours
.
ago
)
.
map
{
|
d
|
serializer
.
represent
(
d
)
}
serializer
=
DeploymentSerializer
.
new
(
user:
@current_user
,
project:
project
)
deployments
=
environment
.
deployments
.
reorder
(
created_at: :desc
)
deployments
=
deployments
.
where
(
'created_at > ?'
,
params
[
:after
].
to_time
)
if
params
[
:after
]
&
.
to_time
deployments
=
deployments
.
map
{
|
deployment
|
serializer
.
represent
(
deployment
)
}
render
json:
{
deployments:
deployments
}
end
...
...
spec/controllers/projects/deployments_controller_spec.rb
View file @
d3e794e2
...
...
@@ -20,7 +20,7 @@ describe Projects::DeploymentsController do
create
(
:deployment
,
environment:
environment
,
created_at:
7
.
hours
.
ago
)
create
(
:deployment
,
environment:
environment
)
get
:index
,
environment_params
get
:index
,
environment_params
(
:after
=>
8
.
hours
.
ago
)
expect
(
response
).
to
be_ok
...
...
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