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
98a1ed34
Commit
98a1ed34
authored
Oct 16, 2020
by
Amparo Luna
Committed by
Douglas Barbosa Alexandre
Oct 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose seats_in_use in namespace entity
parent
61759175
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
4 deletions
+32
-4
doc/api/namespaces.md
doc/api/namespaces.md
+9
-3
ee/changelogs/unreleased/al-update-namespace-api-entity.yml
ee/changelogs/unreleased/al-update-namespace-api-entity.yml
+5
-0
ee/lib/ee/api/entities/namespace.rb
ee/lib/ee/api/entities/namespace.rb
+3
-0
ee/spec/requests/api/namespaces_spec.rb
ee/spec/requests/api/namespaces_spec.rb
+15
-1
No files found.
doc/api/namespaces.md
View file @
98a1ed34
...
...
@@ -87,10 +87,12 @@ the `plan` parameter associated with a namespace:
]
```
Users on GitLab.com will also see a
`max_seats_used`
parameter.
`max_seats_used`
is the highest number of users the group had.
Users on GitLab.com will also see
`max_seats_used`
and
`seats_in_use`
parameters.
`max_seats_used`
is the highest number of users the group had.
`seats_in_use`
is
the number of license seats currently being used. Both values are updated
once a day.
`max_seats_used`
will be non-zero only for namespaces on paid plans.
`max_seats_used`
and
`seats_in_use`
will be non-zero only for namespaces on paid plans.
```
json
[
...
...
@@ -99,6 +101,7 @@ is the highest number of users the group had.
"name"
:
"user1"
,
"billable_members_count"
:
2
,
"max_seats_used"
:
3
,
"seats_in_use"
:
2
,
...
}
]
...
...
@@ -141,6 +144,7 @@ Example response:
"members_count_with_descendants"
:
2
,
"billable_members_count"
:
2
,
"max_seats_used"
:
0
,
"seats_in_use"
:
0
,
"plan"
:
"default"
,
"trial_ends_on"
:
null
,
"trial"
:
false
...
...
@@ -181,6 +185,7 @@ Example response:
"members_count_with_descendants"
:
2
,
"billable_members_count"
:
2
,
"max_seats_used"
:
0
,
"seats_in_use"
:
0
,
"plan"
:
"default"
,
"trial_ends_on"
:
null
,
"trial"
:
false
...
...
@@ -208,6 +213,7 @@ Example response:
"members_count_with_descendants"
:
2
,
"billable_members_count"
:
2
,
"max_seats_used"
:
0
,
"seats_in_use"
:
0
,
"plan"
:
"default"
,
"trial_ends_on"
:
null
,
"trial"
:
false
...
...
ee/changelogs/unreleased/al-update-namespace-api-entity.yml
0 → 100644
View file @
98a1ed34
---
title
:
Expose seats_in_use in namespace entity
merge_request
:
45316
author
:
type
:
added
ee/lib/ee/api/entities/namespace.rb
View file @
98a1ed34
...
...
@@ -18,6 +18,9 @@ module EE
expose
:billable_members_count
do
|
namespace
,
options
|
namespace
.
billable_members_count
(
options
[
:requested_hosted_plan
])
end
expose
:seats_in_use
,
if:
has_gitlab_subscription
do
|
namespace
,
_
|
namespace
.
gitlab_subscription
.
seats_in_use
end
expose
:max_seats_used
,
if:
has_gitlab_subscription
do
|
namespace
,
_
|
namespace
.
gitlab_subscription
.
max_seats_used
end
...
...
ee/spec/requests/api/namespaces_spec.rb
View file @
98a1ed34
...
...
@@ -120,7 +120,7 @@ RSpec.describe API::Namespaces do
before
do
group1
.
add_guest
(
user
)
create
(
:gitlab_subscription
,
namespace:
group1
,
max_seats_used:
1
)
create
(
:gitlab_subscription
,
namespace:
group1
,
max_seats_used:
1
,
seats_in_use:
1
)
end
it
"avoids additional N+1 database queries"
do
...
...
@@ -146,6 +146,12 @@ RSpec.describe API::Namespaces do
expect
(
json_response
.
first
[
'max_seats_used'
]).
to
eq
(
1
)
end
it
'includes seats_in_use'
do
get
api
(
"/namespaces"
,
user
)
expect
(
json_response
.
first
[
'seats_in_use'
]).
to
eq
(
1
)
end
end
context
'without gitlab subscription'
do
...
...
@@ -156,6 +162,14 @@ RSpec.describe API::Namespaces do
expect
(
resp
.
keys
).
not_to
include
(
'max_seats_used'
)
end
end
it
'does not include seats_in_use'
do
get
api
(
"/namespaces"
,
user
)
json_response
.
each
do
|
resp
|
expect
(
resp
.
keys
).
not_to
include
(
'seats_in_use'
)
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