Commit 0ee3c032 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'jswain_trueup_enhancment' into 'master'

Add additional license information

See merge request gitlab-org/gitlab!22866
parents ade92598 d0c5b557
...@@ -6,8 +6,8 @@ module LicenseHelper ...@@ -6,8 +6,8 @@ module LicenseHelper
delegate :new_admin_license_path, to: 'Gitlab::Routing.url_helpers' delegate :new_admin_license_path, to: 'Gitlab::Routing.url_helpers'
def active_user_count def current_active_user_count
User.active.count License.current&.current_active_users_count || active_user_count
end end
def guest_user_count def guest_user_count
...@@ -131,4 +131,10 @@ module LicenseHelper ...@@ -131,4 +131,10 @@ module LicenseHelper
end end
extend self extend self
private
def active_user_count
User.active.count
end
end end
...@@ -13,44 +13,50 @@ ...@@ -13,44 +13,50 @@
- else - else
- users_over_license = 0 - users_over_license = 0
- true_up_url = 'https://about.gitlab.com/license-faq/'
- true_up_link_start = '<a href="%{url}">'.html_safe % { url: true_up_url }
- link_end = '</a>'.html_safe
.license-panel.prepend-top-default .license-panel.prepend-top-default
.row .d-flex.pb-2
.col-sm-4 .col-sm-6.d-flex.pl-0
.info-well.dark-well .info-well.dark-well
.well-segment.well-centered .well-segment.well-centered
%h3.center %h3.center
Users in License: = _('Users in License:')
= licensed_users = licensed_users
%hr %hr
- if @license.will_expire? - if @license.will_expire?
Your license is valid from = _('Your license is valid from')
%strong
#{@license.starts_at} to
%strong<> %strong<>
#{@license.expires_at} = _(' %{start} to %{end}') % { start: @license.starts_at, end: @license.expires_at }
\. \.
The = _('The %{link_start}true-up model%{link_end} allows having more users, and additional users will incur a retroactive charge on renewal.').html_safe % { link_start: true_up_link_start, link_end: link_end }
%a{ href: 'https://about.gitlab.com/license-faq/' } true-up model
allows having more users, and additional users will incur a retroactive charge on renewal.
= seats_calculation_message = seats_calculation_message
.col-sm-4 .col-sm-6.d-flex.pr-0
.info-well.dark-well .info-well.dark-well
.well-segment.well-centered .well-segment.well-centered
%h3.center %h3.center
Maximum Users: = _('Active Users:')
= current_active_user_count
%hr
%p
= _('This is the number of currently active users on your installation, and this is the minimum number you need to purchase when you renew your license.')
.d-flex.pb-3
.col-sm-6.d-flex.pl-0
.info-well.dark-well.flex-fill
.well-segment.well-centered
%h3.center
= _('Maximum Users:')
= number_with_delimiter max_user_count = number_with_delimiter max_user_count
%hr %hr
This is the highest peak of users on your installation since the license started, and = _('This is the highest peak of users on your installation since the license started.')
this is the minimum number you need to purchase when you renew your license. .col-sm-6.d-flex.pr-0
.col-sm-4
.info-well.dark-well .info-well.dark-well
.well-segment.well-centered .well-segment.well-centered
%h3.center %h3.center
Users over License: = _('Users over License:')
= number_with_delimiter users_over_license = number_with_delimiter users_over_license
%hr %hr
The - support_link_start = '<a href="%{url}">'.html_safe % { url: ::EE::CUSTOMER_SUPPORT_URL }
%a{ href: 'https://about.gitlab.com/licensing-faq/' } true-up model = _('The %{true_up_link_start}true-up model%{link_end} has a retroactive charge for these users at the next renewal. If you want to update your license sooner to prevent this, %{support_link_start}please contact our Support team%{link_end}.').html_safe % { support_link_start: support_link_start, true_up_link_start: true_up_link_start, link_end: link_end }
has a retroactive charge for these users at the next renewal. If you want to update your
license sooner to prevent this, please contact
%a{ href: 'https://support.gitlab.com' } Support.
---
title: Add additional license information to admin dashboard
merge_request: 22866
author:
type: added
...@@ -60,9 +60,24 @@ describe LicenseHelper do ...@@ -60,9 +60,24 @@ describe LicenseHelper do
end end
end end
describe '#active_user_count' do describe '#current_active_user_count' do
it 'returns the number of active users' do let(:license) { create(:license) }
expect(active_user_count).to eq(User.active.count)
context 'when there is a license' do
it 'returns License#current_active_users_count' do
allow(License).to receive(:current).and_return(license)
expect(license).to receive(:current_active_users_count).and_return(311)
expect(current_active_user_count).to eq(311)
end
end
context 'when there is NOT a license' do
it 'returns the number of active users' do
allow(License).to receive(:current).and_return(nil)
expect(current_active_user_count).to eq(User.active.count)
end
end end
end end
......
...@@ -16,6 +16,9 @@ msgstr "" ...@@ -16,6 +16,9 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
msgid " %{start} to %{end}"
msgstr ""
msgid " (from %{timeoutSource})" msgid " (from %{timeoutSource})"
msgstr "" msgstr ""
...@@ -994,6 +997,9 @@ msgstr "" ...@@ -994,6 +997,9 @@ msgstr ""
msgid "Active Sessions" msgid "Active Sessions"
msgstr "" msgstr ""
msgid "Active Users:"
msgstr ""
msgid "Activity" msgid "Activity"
msgstr "" msgstr ""
...@@ -11574,6 +11580,9 @@ msgstr "" ...@@ -11574,6 +11580,9 @@ msgstr ""
msgid "Max seats used" msgid "Max seats used"
msgstr "" msgstr ""
msgid "Maximum Users:"
msgstr ""
msgid "Maximum allowable lifetime for personal access token (days)" msgid "Maximum allowable lifetime for personal access token (days)"
msgstr "" msgstr ""
...@@ -18532,6 +18541,12 @@ msgstr "" ...@@ -18532,6 +18541,12 @@ msgstr ""
msgid "The \"Require approval from CODEOWNERS\" setting was moved to %{banner_link_start}Protected Branches%{banner_link_end}" msgid "The \"Require approval from CODEOWNERS\" setting was moved to %{banner_link_start}Protected Branches%{banner_link_end}"
msgstr "" msgstr ""
msgid "The %{link_start}true-up model%{link_end} allows having more users, and additional users will incur a retroactive charge on renewal."
msgstr ""
msgid "The %{true_up_link_start}true-up model%{link_end} has a retroactive charge for these users at the next renewal. If you want to update your license sooner to prevent this, %{support_link_start}please contact our Support team%{link_end}."
msgstr ""
msgid "The %{type} contains the following error:" msgid "The %{type} contains the following error:"
msgid_plural "The %{type} contains the following errors:" msgid_plural "The %{type} contains the following errors:"
msgstr[0] "" msgstr[0] ""
...@@ -19187,9 +19202,15 @@ msgstr "" ...@@ -19187,9 +19202,15 @@ msgstr ""
msgid "This is the author's first Merge Request to this project." msgid "This is the author's first Merge Request to this project."
msgstr "" msgstr ""
msgid "This is the highest peak of users on your installation since the license started."
msgstr ""
msgid "This is the maximum number of users that have existed at the same time since the license started. This is the minimum number of seats you will need to buy when you renew your license." msgid "This is the maximum number of users that have existed at the same time since the license started. This is the minimum number of seats you will need to buy when you renew your license."
msgstr "" msgstr ""
msgid "This is the number of currently active users on your installation, and this is the minimum number you need to purchase when you renew your license."
msgstr ""
msgid "This is your current session" msgid "This is your current session"
msgstr "" msgstr ""
...@@ -20778,12 +20799,18 @@ msgstr "" ...@@ -20778,12 +20799,18 @@ msgstr ""
msgid "Users" msgid "Users"
msgstr "" msgstr ""
msgid "Users in License:"
msgstr ""
msgid "Users or groups set as approvers in the project's or merge request's settings." msgid "Users or groups set as approvers in the project's or merge request's settings."
msgstr "" msgstr ""
msgid "Users outside of license" msgid "Users outside of license"
msgstr "" msgstr ""
msgid "Users over License:"
msgstr ""
msgid "Users requesting access to" msgid "Users requesting access to"
msgstr "" msgstr ""
...@@ -21907,6 +21934,9 @@ msgstr "" ...@@ -21907,6 +21934,9 @@ msgstr ""
msgid "Your issues will be imported in the background. Once finished, you'll get a confirmation email." msgid "Your issues will be imported in the background. Once finished, you'll get a confirmation email."
msgstr "" msgstr ""
msgid "Your license is valid from"
msgstr ""
msgid "Your message here" msgid "Your message here"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment