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
Tatuya Kamada
gitlab-ce
Commits
d4726112
Commit
d4726112
authored
Oct 24, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added cycle analytics events controller and started integration spec
parent
3cdc9af7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
app/controllers/projects/cycle_analytics/events_controller.rb
...controllers/projects/cycle_analytics/events_controller.rb
+34
-0
config/routes/project.rb
config/routes/project.rb
+6
-0
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+24
-0
No files found.
app/controllers/projects/cycle_analytics/events_controller.rb
0 → 100644
View file @
d4726112
class
Projects::CycleAnalytics::EventsController
<
Projects
::
ApplicationController
#before_action :authorize_read_cycle_analytics!
def
issues
respond_to
do
|
format
|
format
.
html
format
.
json
{
render
json:
events
.
issue_events
}
end
end
private
# TODO refactor this
def
start_date
case
events_params
[
:start_date
]
when
'30'
then
30
.
days
.
ago
when
'90'
then
90
.
days
.
ago
else
90
.
days
.
ago
end
end
def
events
@events
||=
Gitlab
::
CycleAnalytics
::
Events
.
new
(
project:
project
,
from:
start_date
)
end
def
events_params
return
{}
unless
params
[
:events
].
present?
{
start_date:
params
[
:events
][
:start_date
]
}
end
end
\ No newline at end of file
config/routes/project.rb
View file @
d4726112
...
...
@@ -153,6 +153,12 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only:
resource
:cycle_analytics
,
only:
[
:show
]
namespace
:cycle_analytics
do
scope
:events
,
controller:
'/projects/cycle_analytics/events'
do
get
:issues
end
end
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
collection
do
post
:cancel_all
...
...
spec/requests/projects/cycle_analytics_events_spec.rb
0 → 100644
View file @
d4726112
require
'spec_helper'
describe
'cycle analytics events'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
before
do
project
.
team
<<
[
user
,
:developer
]
login_as
(
user
)
end
it
'lists the issue events'
do
get
namespace_project_cycle_analytics_issues_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
).
to
eq
([])
end
end
def
json_response
JSON
.
parse
(
response
.
body
)
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