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
a453ea9b
Commit
a453ea9b
authored
Aug 30, 2019
by
manojmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not add Project, User, Group counts in API
parent
1f1257a2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
25 deletions
+4
-25
app/controllers/admin/dashboard_controller.rb
app/controllers/admin/dashboard_controller.rb
+1
-2
lib/api/entities.rb
lib/api/entities.rb
+0
-12
lib/api/statistics.rb
lib/api/statistics.rb
+1
-1
spec/fixtures/api/schemas/statistics.json
spec/fixtures/api/schemas/statistics.json
+0
-6
spec/requests/api/statistics_spec.rb
spec/requests/api/statistics_spec.rb
+2
-4
No files found.
app/controllers/admin/dashboard_controller.rb
View file @
a453ea9b
...
...
@@ -3,8 +3,7 @@
class
Admin::DashboardController
<
Admin
::
ApplicationController
include
CountHelper
COUNTED_ITEMS
=
[
Project
,
User
,
Group
,
ForkNetworkMember
,
ForkNetwork
,
Issue
,
MergeRequest
,
Note
,
Snippet
,
Key
,
Milestone
].
freeze
COUNTED_ITEMS
=
[
Project
,
User
,
Group
].
freeze
# rubocop: disable CodeReuse/ActiveRecord
def
index
...
...
lib/api/entities.rb
View file @
a453ea9b
...
...
@@ -1199,18 +1199,6 @@ module API
approximate_count_with_delimiters
(
counts
,
::
Milestone
)
end
expose
:users
do
|
counts
|
approximate_count_with_delimiters
(
counts
,
::
User
)
end
expose
:projects
do
|
counts
|
approximate_count_with_delimiters
(
counts
,
::
Project
)
end
expose
:groups
do
|
counts
|
approximate_count_with_delimiters
(
counts
,
::
Group
)
end
expose
:active_users
do
|
_
|
number_with_delimiter
(
::
User
.
active
.
count
)
end
...
...
lib/api/statistics.rb
View file @
a453ea9b
...
...
@@ -4,7 +4,7 @@ module API
class
Statistics
<
Grape
::
API
before
{
authenticated_as_admin!
}
COUNTED_ITEMS
=
[
Project
,
User
,
Group
,
ForkNetworkMember
,
ForkNetwork
,
Issue
,
COUNTED_ITEMS
=
[
ForkNetworkMember
,
ForkNetwork
,
Issue
,
MergeRequest
,
Note
,
Snippet
,
Key
,
Milestone
].
freeze
desc
'Get the current application statistics'
do
...
...
spec/fixtures/api/schemas/statistics.json
View file @
a453ea9b
...
...
@@ -8,9 +8,6 @@
"snippets"
,
"ssh_keys"
,
"milestones"
,
"users"
,
"projects"
,
"groups"
,
"active_users"
],
"properties"
:
{
...
...
@@ -21,9 +18,6 @@
"snippets'"
:
{
"type"
:
"string"
},
"ssh_keys'"
:
{
"type"
:
"string"
},
"milestones'"
:
{
"type"
:
"string"
},
"users'"
:
{
"type"
:
"string"
},
"projects'"
:
{
"type"
:
"string"
},
"groups'"
:
{
"type"
:
"string"
},
"active_users'"
:
{
"type"
:
"string"
}
}
}
spec/requests/api/statistics_spec.rb
View file @
a453ea9b
# frozen_string_literal: true
require
'spec_helper'
describe
API
::
Statistics
,
'Statistics'
do
...
...
@@ -36,7 +38,6 @@ describe API::Statistics, 'Statistics' do
projects
=
create_list
(
:project
,
4
,
namespace:
create
(
:namespace
,
owner:
admin
))
issues
=
create_list
(
:issue
,
2
,
project:
projects
.
first
,
updated_by:
admin
)
create_list
(
:group
,
2
)
create_list
(
:snippet
,
2
,
:public
,
author:
admin
)
create_list
(
:note
,
2
,
author:
admin
,
project:
projects
.
first
,
noteable:
issues
.
first
)
create_list
(
:milestone
,
3
,
project:
projects
.
first
)
...
...
@@ -52,9 +53,6 @@ describe API::Statistics, 'Statistics' do
expect
(
json_response
[
'forks'
]).
to
eq
(
'0'
)
expect
(
json_response
[
'ssh_keys'
]).
to
eq
(
'1'
)
expect
(
json_response
[
'milestones'
]).
to
eq
(
'3'
)
expect
(
json_response
[
'users'
]).
to
eq
(
'1'
)
expect
(
json_response
[
'projects'
]).
to
eq
(
'4'
)
expect
(
json_response
[
'groups'
]).
to
eq
(
'2'
)
expect
(
json_response
[
'active_users'
]).
to
eq
(
'1'
)
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