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
9901c3df
Commit
9901c3df
authored
Sep 08, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a JSON version of the `CycleAnalytics` page.
parent
f5b9837c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
app/controllers/projects/cycle_analytics_controller.rb
app/controllers/projects/cycle_analytics_controller.rb
+5
-0
app/models/cycle_analytics.rb
app/models/cycle_analytics.rb
+7
-0
app/policies/project_policy.rb
app/policies/project_policy.rb
+1
-0
No files found.
app/controllers/projects/cycle_analytics_controller.rb
View file @
9901c3df
...
...
@@ -3,6 +3,11 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
def
show
@cycle_analytics
=
CycleAnalytics
.
new
(
@project
,
from:
parse_start_date
)
respond_to
do
|
format
|
format
.
html
format
.
json
{
render
json:
@cycle_analytics
}
end
end
private
...
...
app/models/cycle_analytics.rb
View file @
9901c3df
...
...
@@ -6,6 +6,13 @@ class CycleAnalytics
@from
=
from
end
def
as_json
(
options
=
{})
{
issue:
issue
,
plan:
plan
,
code:
code
,
test:
test
,
review:
review
,
staging:
staging
,
production:
production
}
end
def
issue
calculate_metric
(
Queries
::
issues
(
@project
,
created_after:
@from
),
->
(
data_point
)
{
data_point
[
:issue
].
created_at
},
...
...
app/policies/project_policy.rb
View file @
9901c3df
...
...
@@ -101,6 +101,7 @@ class ProjectPolicy < BasePolicy
can!
:admin_pipeline
can!
:admin_environment
can!
:admin_deployment
can!
:read_cycle_analytics
end
def
public_access!
...
...
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