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
893e2410
Commit
893e2410
authored
Apr 27, 2020
by
Pavel Shutsin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce not filters for code review analytics
Adds support of negative filters for labels and milestone
parent
33b2c1fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
ee/changelogs/unreleased/206955-not-filters-for-code-review-analytics.yml
...released/206955-not-filters-for-code-review-analytics.yml
+5
-0
ee/lib/api/analytics/code_review_analytics.rb
ee/lib/api/analytics/code_review_analytics.rb
+11
-7
ee/spec/requests/api/analytics/code_review_analytics_spec.rb
ee/spec/requests/api/analytics/code_review_analytics_spec.rb
+10
-0
No files found.
ee/changelogs/unreleased/206955-not-filters-for-code-review-analytics.yml
0 → 100644
View file @
893e2410
---
title
:
Introduce negative filters for code review analytics
merge_request
:
30506
author
:
type
:
added
ee/lib/api/analytics/code_review_analytics.rb
View file @
893e2410
...
@@ -21,21 +21,25 @@ module API
...
@@ -21,21 +21,25 @@ module API
attempt_project_search_optimizations:
true
attempt_project_search_optimizations:
true
}
}
finder_options
=
params
.
slice
(
*
MergeRequestsFinder
.
valid_params
).
merge
(
finder_options
)
MergeRequestsFinder
.
new
(
current_user
,
declared_params
.
merge
(
finder_options
))
MergeRequestsFinder
.
new
(
current_user
,
finder_options
)
end
end
end
end
params
:negatable_params
do
optional
:label_name
,
type:
Array
,
desc:
'Array of label names to filter by'
optional
:milestone_title
,
type:
String
,
desc:
'Milestone title to filter by'
end
end
end
resource
:analytics
do
resource
:analytics
do
desc
'List code review information about project'
do
desc
'List code review information about project'
end
params
do
params
do
requires
:project_id
,
type:
Integer
,
desc:
'Project ID'
requires
:project_id
,
type:
Integer
,
desc:
'Project ID'
optional
:label_name
,
type:
Array
,
desc:
'Array of label names to filter by'
use
:negatable_params
optional
:milestone_title
,
type:
String
,
desc:
'Milestone title to filter by'
use
:pagination
use
:pagination
optional
:not
,
type:
Hash
do
use
:negatable_params
end
end
end
get
'code_review'
do
get
'code_review'
do
authorize!
:read_code_review_analytics
,
project
authorize!
:read_code_review_analytics
,
project
...
...
ee/spec/requests/api/analytics/code_review_analytics_spec.rb
View file @
893e2410
...
@@ -54,6 +54,16 @@ describe API::Analytics::CodeReviewAnalytics do
...
@@ -54,6 +54,16 @@ describe API::Analytics::CodeReviewAnalytics do
expect
(
json_response
.
map
{
|
mr
|
mr
[
'id'
]}).
to
match_array
([
merge_request_3
.
id
])
expect
(
json_response
.
map
{
|
mr
|
mr
[
'id'
]}).
to
match_array
([
merge_request_3
.
id
])
end
end
end
end
context
'with negation filters'
do
let
(
:query_params
)
{
super
().
merge
(
not:
{
label_name:
[
label
.
title
]
})
}
it
'applies filter'
do
api_call
expect
(
json_response
.
map
{
|
mr
|
mr
[
'id'
]
}).
to
match_array
([
merge_request_1
.
id
])
end
end
end
end
context
'when user has no authorization'
do
context
'when user has no authorization'
do
...
...
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