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
af9b73cc
Commit
af9b73cc
authored
Jul 03, 2019
by
Thiago Presa
Committed by
Fatih Acet
Jul 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix License App user count
parent
dbfa39ca
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
57 additions
and
14 deletions
+57
-14
ee/app/assets/javascripts/licenses/components/cards/license_card.vue
...ts/javascripts/licenses/components/cards/license_card.vue
+3
-2
ee/app/assets/javascripts/licenses/components/cards/license_card_body.vue
...vascripts/licenses/components/cards/license_card_body.vue
+11
-2
ee/app/assets/javascripts/licenses/index.js
ee/app/assets/javascripts/licenses/index.js
+4
-2
ee/app/helpers/license_helper.rb
ee/app/helpers/license_helper.rb
+7
-2
ee/changelogs/unreleased/tpresa-fix-license-app-user-count.yml
...angelogs/unreleased/tpresa-fix-license-app-user-count.yml
+5
-0
ee/spec/features/admin/licenses/licenses_app_spec.rb
ee/spec/features/admin/licenses/licenses_app_spec.rb
+7
-1
ee/spec/frontend/licenses/components/cards/__snapshots__/license_card_body_spec.js.snap
...onents/cards/__snapshots__/license_card_body_spec.js.snap
+2
-2
ee/spec/frontend/licenses/components/cards/__snapshots__/license_card_spec.js.snap
.../components/cards/__snapshots__/license_card_spec.js.snap
+2
-1
ee/spec/frontend/licenses/components/cards/license_card_body_spec.js
...ntend/licenses/components/cards/license_card_body_spec.js
+2
-1
ee/spec/frontend/licenses/components/cards/license_card_spec.js
...c/frontend/licenses/components/cards/license_card_spec.js
+2
-1
ee/spec/helpers/license_helper_spec.rb
ee/spec/helpers/license_helper_spec.rb
+12
-0
No files found.
ee/app/assets/javascripts/licenses/components/cards/license_card.vue
View file @
af9b73cc
...
...
@@ -27,7 +27,7 @@ export default {
},
},
computed
:
{
...
mapState
([
'
currentActive
UserCount
'
,
'
deleteQueue
'
,
'
downloadLicensePath
'
]),
...
mapState
([
'
activeUserCount
'
,
'
guest
UserCount
'
,
'
deleteQueue
'
,
'
downloadLicensePath
'
]),
isRemoving
()
{
return
this
.
deleteQueue
.
includes
(
this
.
license
.
id
);
},
...
...
@@ -76,7 +76,8 @@ export default {
<
license
-
card
-
body
:
license
=
"
license
"
:
is
-
removing
=
"
isRemoving
"
:
current
-
active
-
user
-
count
=
"
currentActiveUserCount
"
:
active
-
user
-
count
=
"
activeUserCount
"
:
guest
-
user
-
count
=
"
guestUserCount
"
/>
<
/div
>
<
/template
>
ee/app/assets/javascripts/licenses/components/cards/license_card_body.vue
View file @
af9b73cc
...
...
@@ -29,7 +29,11 @@ export default {
required
:
false
,
default
:
false
,
},
currentActiveUserCount
:
{
activeUserCount
:
{
type
:
Number
,
required
:
true
,
},
guestUserCount
:
{
type
:
Number
,
required
:
true
,
},
...
...
@@ -51,6 +55,11 @@ export default {
seatsInUseComponent
()
{
return
this
.
license
.
plan
===
'
ultimate
'
?
'
info-cell
'
:
'
cell
'
;
},
seatsInUseForThisLicense
()
{
return
this
.
license
.
plan
===
'
ultimate
'
?
this
.
activeUserCount
-
this
.
guestUserCount
:
this
.
activeUserCount
;
},
},
methods
:
{
licenseeValue
(
key
)
{
...
...
@@ -76,7 +85,7 @@ export default {
<component
:is=
"seatsInUseComponent"
:title=
"__('Seats currently in use')"
:value=
"
currentActiveUserCount
"
:value=
"
seatsInUseForThisLicense
"
:popover-content=
"info.currentActiveUserCount"
/>
<info-cell
...
...
ee/app/assets/javascripts/licenses/index.js
View file @
af9b73cc
...
...
@@ -7,7 +7,8 @@ export default function mountInstanceLicenseApp(mountElement) {
if
(
!
mountElement
)
return
undefined
;
const
{
currentActiveUserCount
,
activeUserCount
,
guestUserCount
,
licensesPath
,
deleteLicensePath
,
newLicensePath
,
...
...
@@ -23,7 +24,8 @@ export default function mountInstanceLicenseApp(mountElement) {
deleteLicensePath
,
newLicensePath
,
downloadLicensePath
,
currentActiveUserCount
:
parseInt
(
currentActiveUserCount
,
10
),
activeUserCount
:
parseInt
(
activeUserCount
,
10
),
guestUserCount
:
parseInt
(
guestUserCount
,
10
),
});
this
.
fetchLicenses
();
...
...
ee/app/helpers/license_helper.rb
View file @
af9b73cc
...
...
@@ -6,10 +6,14 @@ module LicenseHelper
delegate
:new_admin_license_path
,
to:
'Gitlab::Routing.url_helpers'
def
current_
active_user_count
def
active_user_count
User
.
active
.
count
end
def
guest_user_count
active_user_count
-
User
.
active
.
excluding_guests
.
count
end
def
max_historical_user_count
HistoricalData
.
max_historical_user_count
end
...
...
@@ -111,7 +115,8 @@ module LicenseHelper
end
def
license_app_data
{
data:
{
current_active_user_count:
current_active_user_count
,
{
data:
{
active_user_count:
active_user_count
,
guest_user_count:
guest_user_count
,
licenses_path:
api_licenses_url
,
delete_license_path:
api_license_url
(
id:
':id'
),
new_license_path:
new_admin_license_path
,
download_license_path:
download_admin_license_path
}
}
...
...
ee/changelogs/unreleased/tpresa-fix-license-app-user-count.yml
0 → 100644
View file @
af9b73cc
---
title
:
Fix License App user count for ultimate
merge_request
:
14055
author
:
type
:
fixed
ee/spec/features/admin/licenses/licenses_app_spec.rb
View file @
af9b73cc
...
...
@@ -24,7 +24,13 @@ describe "Licenses app", :js do
expect
(
seats_in_license
).
to
have_content
'Seats in license'
expect
(
seats_in_license
).
to
have_content
license
.
restrictions
[
:active_user_count
]
expect
(
seats_in_use
).
to
have_content
'Seats currently in use'
expect
(
seats_in_use
).
to
have_content
User
.
active
.
count
if
license
.
exclude_guests_from_active_count?
expect
(
seats_in_use
).
to
have_content
User
.
active
.
excluding_guests
.
count
else
expect
(
seats_in_use
).
to
have_content
User
.
active
.
count
end
expect
(
historical_max
).
to
have_content
'Max seats used'
expect
(
historical_max
).
to
have_content
license
.
historical_max
expect
(
overage
).
to
have_content
'Users outside of license'
...
...
ee/spec/frontend/licenses/components/cards/__snapshots__/license_card_body_spec.js.snap
View file @
af9b73cc
...
...
@@ -24,7 +24,7 @@ exports[`LicenseCardBody renders a license card body 1`] = `
<infocell-stub
popovercontent="Users with a Guest role or those who don't belong to any projects or groups don't count towards seats in use."
title="Seats currently in use"
value="
10
"
value="
2
"
/>
<infocell-stub
...
...
@@ -241,7 +241,7 @@ exports[`LicenseCardBody renders fallback licensee values 1`] = `
<infocell-stub
popovercontent="Users with a Guest role or those who don't belong to any projects or groups don't count towards seats in use."
title="Seats currently in use"
value="
10
"
value="
2
"
/>
<infocell-stub
...
...
ee/spec/frontend/licenses/components/cards/__snapshots__/license_card_spec.js.snap
View file @
af9b73cc
...
...
@@ -35,7 +35,8 @@ exports[`LicenseCard renders license card with a delete button and license body
</div>
<licensecardbody-stub
currentactiveusercount="10"
activeusercount="10"
guestusercount="8"
license="[object Object]"
/>
</div>
...
...
ee/spec/frontend/licenses/components/cards/license_card_body_spec.js
View file @
af9b73cc
...
...
@@ -18,7 +18,8 @@ describe('LicenseCardBody', () => {
},
},
isRemoving
:
false
,
currentActiveUserCount
:
10
,
activeUserCount
:
10
,
guestUserCount
:
8
,
};
function
createComponent
(
props
=
{})
{
...
...
ee/spec/frontend/licenses/components/cards/license_card_spec.js
View file @
af9b73cc
...
...
@@ -13,7 +13,8 @@ describe('LicenseCard', () => {
isCurrentLicense
:
false
,
};
const
defaultState
=
{
currentActiveUserCount
:
10
,
activeUserCount
:
10
,
guestUserCount
:
8
,
deleteQueue
:
[],
downloadLicensePath
:
'
/downloadLicensePath
'
,
};
...
...
ee/spec/helpers/license_helper_spec.rb
View file @
af9b73cc
...
...
@@ -56,4 +56,16 @@ describe LicenseHelper do
expect
(
api_license_url
(
id:
1
)).
to
eq
(
'http://localhost/gitlab/api/v4/license/1'
)
end
end
describe
'#active_user_count'
do
it
'returns the number of active users'
do
expect
(
active_user_count
).
to
eq
(
User
.
active
.
count
)
end
end
describe
'#guest_user_count'
do
it
'returns the number of active guest users'
do
expect
(
guest_user_count
).
to
eq
(
User
.
active
.
count
-
User
.
active
.
excluding_guests
.
count
)
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