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
delegate :new_admin_license_path, to: 'Gitlab::Routing.url_helpers'
def active_user_count
User.active.count
def current_active_user_count
License.current&.current_active_users_count || active_user_count
end
def guest_user_count
......@@ -131,4 +131,10 @@ module LicenseHelper
end
extend self
private
def active_user_count
User.active.count
end
end
......@@ -13,44 +13,50 @@
- else
- 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
.row
.col-sm-4
.d-flex.pb-2
.col-sm-6.d-flex.pl-0
.info-well.dark-well
.well-segment.well-centered
%h3.center
Users in License:
= _('Users in License:')
= licensed_users
%hr
- if @license.will_expire?
Your license is valid from
%strong
#{@license.starts_at} to
= _('Your license is valid from')
%strong<>
#{@license.expires_at}
= _(' %{start} to %{end}') % { start: @license.starts_at, end: @license.expires_at }
\.
The
%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.
= _('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 }
= seats_calculation_message
.col-sm-4
.col-sm-6.d-flex.pr-0
.info-well.dark-well
.well-segment.well-centered
%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
%hr
This is the highest peak of users on your installation since the license started, and
this is the minimum number you need to purchase when you renew your license.
.col-sm-4
= _('This is the highest peak of users on your installation since the license started.')
.col-sm-6.d-flex.pr-0
.info-well.dark-well
.well-segment.well-centered
%h3.center
Users over License:
= _('Users over License:')
= number_with_delimiter users_over_license
%hr
The
%a{ href: 'https://about.gitlab.com/licensing-faq/' } true-up model
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.
- support_link_start = '<a href="%{url}">'.html_safe % { url: ::EE::CUSTOMER_SUPPORT_URL }
= _('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 }
---
title: Add additional license information to admin dashboard
merge_request: 22866
author:
type: added
......@@ -60,9 +60,24 @@ describe LicenseHelper do
end
end
describe '#active_user_count' do
describe '#current_active_user_count' do
let(:license) { create(:license) }
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
expect(active_user_count).to eq(User.active.count)
allow(License).to receive(:current).and_return(nil)
expect(current_active_user_count).to eq(User.active.count)
end
end
end
......
......@@ -16,6 +16,9 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
msgid " %{start} to %{end}"
msgstr ""
msgid " (from %{timeoutSource})"
msgstr ""
......@@ -994,6 +997,9 @@ msgstr ""
msgid "Active Sessions"
msgstr ""
msgid "Active Users:"
msgstr ""
msgid "Activity"
msgstr ""
......@@ -11574,6 +11580,9 @@ msgstr ""
msgid "Max seats used"
msgstr ""
msgid "Maximum Users:"
msgstr ""
msgid "Maximum allowable lifetime for personal access token (days)"
msgstr ""
......@@ -18532,6 +18541,12 @@ msgstr ""
msgid "The \"Require approval from CODEOWNERS\" setting was moved to %{banner_link_start}Protected Branches%{banner_link_end}"
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_plural "The %{type} contains the following errors:"
msgstr[0] ""
......@@ -19187,9 +19202,15 @@ msgstr ""
msgid "This is the author's first Merge Request to this project."
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."
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"
msgstr ""
......@@ -20778,12 +20799,18 @@ msgstr ""
msgid "Users"
msgstr ""
msgid "Users in License:"
msgstr ""
msgid "Users or groups set as approvers in the project's or merge request's settings."
msgstr ""
msgid "Users outside of license"
msgstr ""
msgid "Users over License:"
msgstr ""
msgid "Users requesting access to"
msgstr ""
......@@ -21907,6 +21934,9 @@ msgstr ""
msgid "Your issues will be imported in the background. Once finished, you'll get a confirmation email."
msgstr ""
msgid "Your license is valid from"
msgstr ""
msgid "Your message here"
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