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
d42291e9
Commit
d42291e9
authored
Apr 03, 2020
by
Aakriti Gupta
Committed by
Bob Van Landuyt
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose new members count in Group Activity API
parent
fcf2ee20
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
8 deletions
+94
-8
doc/api/api_resources.md
doc/api/api_resources.md
+1
-1
doc/api/group_activity_analytics.md
doc/api/group_activity_analytics.md
+24
-0
ee/changelogs/unreleased/ag-add-recent-members-entity.yml
ee/changelogs/unreleased/ag-add-recent-members-entity.yml
+5
-0
ee/lib/api/analytics/group_activity_analytics.rb
ee/lib/api/analytics/group_activity_analytics.rb
+29
-1
ee/lib/ee/api/entities/analytics/group_activity/new_members_count.rb
...pi/entities/analytics/group_activity/new_members_count.rb
+15
-0
ee/spec/lib/ee/api/entities/analytics/group_activity_spec.rb
ee/spec/lib/ee/api/entities/analytics/group_activity_spec.rb
+12
-2
ee/spec/requests/api/analytics/group_activity_analytics_spec.rb
...c/requests/api/analytics/group_activity_analytics_spec.rb
+8
-4
No files found.
doc/api/api_resources.md
View file @
d42291e9
...
@@ -120,7 +120,7 @@ The following API resources are available outside of project and group contexts
...
@@ -120,7 +120,7 @@ The following API resources are available outside of project and group contexts
|
[
Events
](
events.md
)
|
`/events`
,
`/users/:id/events`
(also available for projects) |
|
[
Events
](
events.md
)
|
`/events`
,
`/users/:id/events`
(also available for projects) |
|
[
Feature flags
](
features.md
)
|
`/features`
|
|
[
Feature flags
](
features.md
)
|
`/features`
|
|
[
Geo Nodes
](
geo_nodes.md
)
**(PREMIUM ONLY)**
|
`/geo_nodes`
|
|
[
Geo Nodes
](
geo_nodes.md
)
**(PREMIUM ONLY)**
|
`/geo_nodes`
|
|
[
Group Activity Analytics
](
group_activity_analytics.md
)
**(STARTER)**
|
`/analytics/group_activity/{issues_count | merge_requests_count}`
|
|
[
Group Activity Analytics
](
group_activity_analytics.md
)
**(STARTER)**
|
`/analytics/group_activity/{issues_count | merge_requests_count
| new_members_count
}`
|
|
[
Import repository from GitHub
](
import.md
)
|
`/import/github`
|
|
[
Import repository from GitHub
](
import.md
)
|
`/import/github`
|
|
[
Issues
](
issues.md
)
|
`/issues`
(also available for groups and projects) |
|
[
Issues
](
issues.md
)
|
`/issues`
(also available for groups and projects) |
|
[
Issues Statistics
](
issues_statistics.md
)
|
`/issues_statistics`
(also available for groups and projects) |
|
[
Issues Statistics
](
issues_statistics.md
)
|
`/issues_statistics`
(also available for groups and projects) |
...
...
doc/api/group_activity_analytics.md
View file @
d42291e9
...
@@ -49,3 +49,27 @@ Example response:
...
@@ -49,3 +49,27 @@ Example response:
```
json
```
json
{
"merge_requests_count"
:
10
}
{
"merge_requests_count"
:
10
}
```
```
## Get count of members recently added to group
```
plaintext
GET /analytics/group_activity/new_members_count
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`group_path`
| string | yes | Group path |
Example request:
```
shell
curl
--header
"PRIVATE-TOKEN: <your_access_token>"
https://gitlab.example.com/api/v4/analytics/group_activity/new_members_count?group_path
=
gitlab-org
```
Example response:
```
json
{
"new_members_count"
:
10
}
```
ee/changelogs/unreleased/ag-add-recent-members-entity.yml
0 → 100644
View file @
d42291e9
---
title
:
Add API endpoint for new members' count in Group Activity Analytics
merge_request
:
26601
author
:
type
:
added
ee/lib/api/analytics/group_activity_analytics.rb
View file @
d42291e9
...
@@ -9,7 +9,6 @@ module API
...
@@ -9,7 +9,6 @@ module API
before
do
before
do
authenticate!
authenticate!
not_found!
unless
Feature
.
enabled?
(
:group_activity_analytics
)
end
end
helpers
do
helpers
do
...
@@ -35,7 +34,11 @@ module API
...
@@ -35,7 +34,11 @@ module API
end
end
get
'issues_count'
do
get
'issues_count'
do
not_found!
unless
Feature
.
enabled?
(
:group_activity_analytics
,
group
)
authorize!
:read_group_activity_analytics
,
group
authorize!
:read_group_activity_analytics
,
group
present
(
present
(
calculator
,
calculator
,
with:
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
IssuesCount
with:
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
IssuesCount
...
@@ -52,12 +55,37 @@ module API
...
@@ -52,12 +55,37 @@ module API
end
end
get
'merge_requests_count'
do
get
'merge_requests_count'
do
not_found!
unless
Feature
.
enabled?
(
:group_activity_analytics
,
group
)
authorize!
:read_group_activity_analytics
,
group
authorize!
:read_group_activity_analytics
,
group
present
(
present
(
calculator
,
calculator
,
with:
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
MergeRequestsCount
with:
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
MergeRequestsCount
)
)
end
end
desc
'Get count of recently created group members'
do
detail
DESCRIPTION_DETAIL
success
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
NewMembersCount
end
params
do
requires
:group_path
,
type:
String
,
desc:
'Group Path'
end
get
'new_members_count'
do
not_found!
unless
Feature
.
enabled?
(
:group_activity_analytics
,
group
)
authorize!
:read_group_activity_analytics
,
group
present
(
calculator
,
with:
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
NewMembersCount
)
end
end
end
end
end
end
end
...
...
ee/lib/ee/api/entities/analytics/group_activity/new_members_count.rb
0 → 100644
View file @
d42291e9
# frozen_string_literal: true
module
EE
module
API
module
Entities
module
Analytics
module
GroupActivity
class
NewMembersCount
<
Grape
::
Entity
expose
:new_members_count
end
end
end
end
end
end
ee/spec/lib/ee/api/entities/analytics/group_activity_spec.rb
View file @
d42291e9
...
@@ -16,10 +16,20 @@ describe EE::API::Entities::Analytics::GroupActivity do
...
@@ -16,10 +16,20 @@ describe EE::API::Entities::Analytics::GroupActivity do
end
end
context
'issues count'
do
context
'issues count'
do
it_behaves_like
'exposes count'
,
'issues_count'
,
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
IssuesCount
it_behaves_like
'exposes count'
,
'issues_count'
,
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
IssuesCount
end
end
context
'merge requests count'
do
context
'merge requests count'
do
it_behaves_like
'exposes count'
,
'merge_requests_count'
,
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
MergeRequestsCount
it_behaves_like
'exposes count'
,
'merge_requests_count'
,
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
MergeRequestsCount
end
context
'new members count'
do
it_behaves_like
'exposes count'
,
'new_members_count'
,
EE
::
API
::
Entities
::
Analytics
::
GroupActivity
::
NewMembersCount
end
end
end
end
ee/spec/requests/api/analytics/group_activity_analytics_spec.rb
View file @
d42291e9
...
@@ -11,7 +11,7 @@ describe API::Analytics::GroupActivityAnalytics do
...
@@ -11,7 +11,7 @@ describe API::Analytics::GroupActivityAnalytics do
let_it_be
(
:anonymous_user
)
{
create
(
:user
)
}
let_it_be
(
:anonymous_user
)
{
create
(
:user
)
}
shared_examples
'GET group_activity'
do
|
activity
|
shared_examples
'GET group_activity'
do
|
activity
,
count
|
let
(
:feature_enabled
)
{
true
}
let
(
:feature_enabled
)
{
true
}
let
(
:params
)
{
{
group_path:
group
.
full_path
}
}
let
(
:params
)
{
{
group_path:
group
.
full_path
}
}
let
(
:current_user
)
{
reporter
}
let
(
:current_user
)
{
reporter
}
...
@@ -29,7 +29,7 @@ describe API::Analytics::GroupActivityAnalytics do
...
@@ -29,7 +29,7 @@ describe API::Analytics::GroupActivityAnalytics do
end
end
it
'is returns a count'
do
it
'is returns a count'
do
expect
(
response
.
parsed_body
).
to
eq
({
"
#{
activity
}
_count"
=>
0
})
expect
(
response
.
parsed_body
).
to
eq
({
"
#{
activity
}
_count"
=>
count
})
end
end
context
'when feature is not available in plan'
do
context
'when feature is not available in plan'
do
...
@@ -58,10 +58,14 @@ describe API::Analytics::GroupActivityAnalytics do
...
@@ -58,10 +58,14 @@ describe API::Analytics::GroupActivityAnalytics do
end
end
context
'GET /group_activity/issues_count'
do
context
'GET /group_activity/issues_count'
do
it_behaves_like
'GET group_activity'
,
'issues'
it_behaves_like
'GET group_activity'
,
'issues'
,
0
end
end
context
'GET /group_activity/merge_requests_count'
do
context
'GET /group_activity/merge_requests_count'
do
it_behaves_like
'GET group_activity'
,
'merge_requests'
it_behaves_like
'GET group_activity'
,
'merge_requests'
,
0
end
context
'GET /group_activity/new_members_count'
do
it_behaves_like
'GET group_activity'
,
'new_members'
,
1
# reporter
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