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
8710f533
Commit
8710f533
authored
Mar 26, 2020
by
Martin Wortschack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new members count
- Adds the number of new members to the group activity analytics panel.
parent
68110a08
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
1 deletion
+52
-1
ee/app/assets/javascripts/analytics/group_analytics/components/group_activity_card.vue
...lytics/group_analytics/components/group_activity_card.vue
+4
-1
ee/app/assets/javascripts/api.js
ee/app/assets/javascripts/api.js
+6
-0
ee/spec/frontend/analytics/group_analytics/components/__snapshots__/group_activity_card_spec.js.snap
...components/__snapshots__/group_activity_card_spec.js.snap
+15
-0
ee/spec/frontend/analytics/group_analytics/components/group_activity_card_spec.js
...cs/group_analytics/components/group_activity_card_spec.js
+8
-0
ee/spec/frontend/api_spec.js
ee/spec/frontend/api_spec.js
+16
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
ee/app/assets/javascripts/analytics/group_analytics/components/group_activity_card.vue
View file @
8710f533
...
...
@@ -21,6 +21,7 @@ export default {
metrics
:
{
mergeRequests
:
{
value
:
null
,
label
:
s__
(
'
GroupActivyMetrics|Merge Requests created
'
)
},
issues
:
{
value
:
null
,
label
:
s__
(
'
GroupActivyMetrics|Issues created
'
)
},
newMembers
:
{
value
:
null
,
label
:
s__
(
'
GroupActivityMetrics|New Members created
'
)
},
},
};
},
...
...
@@ -46,10 +47,12 @@ export default {
return
Promise
.
all
([
Api
.
groupActivityMergeRequestsCount
(
groupPath
),
Api
.
groupActivityIssuesCount
(
groupPath
),
Api
.
groupActivityNewMembersCount
(
groupPath
),
])
.
then
(([
mrResponse
,
issuesResponse
])
=>
{
.
then
(([
mrResponse
,
issuesResponse
,
newMembersResponse
])
=>
{
this
.
metrics
.
mergeRequests
.
value
=
mrResponse
.
data
.
merge_requests_count
;
this
.
metrics
.
issues
.
value
=
issuesResponse
.
data
.
issues_count
;
this
.
metrics
.
newMembers
.
value
=
newMembersResponse
.
data
.
new_members_count
;
this
.
isLoading
=
false
;
})
.
catch
(()
=>
{
...
...
ee/app/assets/javascripts/api.js
View file @
8710f533
...
...
@@ -28,6 +28,7 @@ export default {
codeReviewAnalyticsPath
:
'
/api/:version/analytics/code_review
'
,
groupActivityIssuesPath
:
'
/api/:version/analytics/group_activity/issues_count
'
,
groupActivityMergeRequestsPath
:
'
/api/:version/analytics/group_activity/merge_requests_count
'
,
groupActivityNewMembersPath
:
'
/api/:version/analytics/group_activity/new_members_count
'
,
countriesPath
:
'
/-/countries
'
,
countryStatesPath
:
'
/-/country_states
'
,
paymentFormPath
:
'
/-/subscriptions/payment_form
'
,
...
...
@@ -235,6 +236,11 @@ export default {
return
axios
.
get
(
url
,
{
params
:
{
group_path
:
groupPath
}
});
},
groupActivityNewMembersCount
(
groupPath
)
{
const
url
=
Api
.
buildUrl
(
this
.
groupActivityNewMembersPath
);
return
axios
.
get
(
url
,
{
params
:
{
group_path
:
groupPath
}
});
},
getGeoReplicableItems
(
replicable
,
params
=
{})
{
const
url
=
Api
.
buildUrl
(
this
.
geoReplicationPath
).
replace
(
'
:replicable
'
,
replicable
);
return
axios
.
get
(
url
,
{
params
});
...
...
ee/spec/frontend/analytics/group_analytics/components/__snapshots__/group_activity_card_spec.js.snap
View file @
8710f533
...
...
@@ -51,6 +51,21 @@ exports[`GroupActivity component matches the snapshot 1`] = `
Issues created
</p>
</div>
<div
class="flex-grow text-center"
>
<h3
class="my-2"
>
30
</h3>
<p
class="text-secondary gl-font-size-small mb-2"
>
New Members created
</p>
</div>
</div>
</div>
...
...
ee/spec/frontend/analytics/group_analytics/components/group_activity_card_spec.js
View file @
8710f533
...
...
@@ -9,6 +9,7 @@ import waitForPromises from 'helpers/wait_for_promises';
const
TEST_GROUP_ID
=
'
gitlab-org
'
;
const
TEST_MERGE_REQUESTS_COUNT
=
{
data
:
{
merge_requests_count
:
10
}
};
const
TEST_ISSUES_COUNT
=
{
data
:
{
issues_count
:
20
}
};
const
TEST_NEW_MEMBERS_COUNT
=
{
data
:
{
new_members_count
:
30
}
};
describe
(
'
GroupActivity component
'
,
()
=>
{
let
wrapper
;
...
...
@@ -30,6 +31,10 @@ describe('GroupActivity component', () => {
.
mockReturnValue
(
Promise
.
resolve
(
TEST_MERGE_REQUESTS_COUNT
));
jest
.
spyOn
(
Api
,
'
groupActivityIssuesCount
'
).
mockReturnValue
(
Promise
.
resolve
(
TEST_ISSUES_COUNT
));
jest
.
spyOn
(
Api
,
'
groupActivityNewMembersCount
'
)
.
mockReturnValue
(
Promise
.
resolve
(
TEST_NEW_MEMBERS_COUNT
));
});
afterEach
(()
=>
{
...
...
@@ -60,6 +65,7 @@ describe('GroupActivity component', () => {
.
then
(()
=>
{
expect
(
Api
.
groupActivityMergeRequestsCount
).
toHaveBeenCalledWith
(
TEST_GROUP_ID
);
expect
(
Api
.
groupActivityIssuesCount
).
toHaveBeenCalledWith
(
TEST_GROUP_ID
);
expect
(
Api
.
groupActivityNewMembersCount
).
toHaveBeenCalledWith
(
TEST_GROUP_ID
);
waitForPromises
();
})
...
...
@@ -67,6 +73,7 @@ describe('GroupActivity component', () => {
expect
(
wrapper
.
vm
.
isLoading
).
toBe
(
false
);
expect
(
wrapper
.
vm
.
metrics
.
mergeRequests
.
value
).
toBe
(
10
);
expect
(
wrapper
.
vm
.
metrics
.
issues
.
value
).
toBe
(
20
);
expect
(
wrapper
.
vm
.
metrics
.
newMembers
.
value
).
toBe
(
30
);
});
});
...
...
@@ -80,6 +87,7 @@ describe('GroupActivity component', () => {
expect
(
findMetricCard
().
props
(
'
metrics
'
)).
toEqual
([
{
key
:
'
mergeRequests
'
,
value
:
10
,
label
:
'
Merge Requests created
'
},
{
key
:
'
issues
'
,
value
:
20
,
label
:
'
Issues created
'
},
{
key
:
'
newMembers
'
,
value
:
30
,
label
:
'
New Members created
'
},
]);
});
});
...
...
ee/spec/frontend/api_spec.js
View file @
8710f533
...
...
@@ -583,6 +583,22 @@ describe('Api', () => {
});
});
});
describe
(
'
groupActivityNewMembersCount
'
,
()
=>
{
it
(
'
fetches the number of new members created for a given group
'
,
()
=>
{
const
response
=
{
new_members_count
:
30
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/analytics/group_activity/new_members_count`
;
jest
.
spyOn
(
Api
,
'
buildUrl
'
).
mockReturnValue
(
expectedUrl
);
jest
.
spyOn
(
axios
,
'
get
'
);
mock
.
onGet
(
expectedUrl
).
reply
(
200
,
response
);
return
Api
.
groupActivityNewMembersCount
(
groupId
).
then
(({
data
})
=>
{
expect
(
data
).
toEqual
(
response
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
expectedUrl
,
{
params
:
{
group_path
:
groupId
}
});
});
});
});
});
describe
(
'
GeoReplicable
'
,
()
=>
{
...
...
locale/gitlab.pot
View file @
8710f533
...
...
@@ -10145,6 +10145,9 @@ msgstr ""
msgid "Group: %{name}"
msgstr ""
msgid "GroupActivityMetrics|New Members created"
msgstr ""
msgid "GroupActivyMetrics|Issues created"
msgstr ""
...
...
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