Commit c39c4f85 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'vs-move-users-over-license-banner-to-admin' into 'master'

Show license overage warning on admin dashboard

Closes #231501

See merge request gitlab-org/gitlab!39704
parents 2405d955 17efce6c
......@@ -21,18 +21,19 @@ module LicenseMonitoringHelper
current_user&.admin? && active_user_count_threshold_reached?
end
private
def license_not_available_or_trial?
current_license.nil? || current_license.trial?
end
def license_is_over_capacity?
return if ::Gitlab.com?
return if license_not_available_or_trial?
current_license_overage > 0
end
private
def license_not_available_or_trial?
current_license.nil? || current_license.trial?
end
def active_user_count_threshold_reached?
return if current_active_users_count <= 1
......
......@@ -6,8 +6,8 @@
- max_user_count = maximum_user_count
- if restricted && max_user_count > restricted
- users_over_license = max_user_count - restricted
- if license_is_over_capacity?
- users_over_license = current_license_overage
- else
- users_over_license = 0
......@@ -74,5 +74,9 @@
= _('Users over License:')
= number_with_delimiter users_over_license
%hr
- 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 }
- if license_is_over_capacity?
.gl-alert.gl-alert-info.gl-mb-3{ role: 'alert' }
= sprite_icon('information-o', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
.gl-alert-body
= s_('Your instance has exceeded your subscription\'s licensed user count.')
= _('You\'ll be charged for %{true_up_link_start}users over license%{link_end} on a quartely or annual basis, depending on the terms of your agreement.').html_safe % { true_up_link_start: true_up_link_start, link_end: link_end }
---
title: Show license overage warning on admin dashboard
merge_request: 39704
author:
type: added
......@@ -10,29 +10,47 @@ RSpec.describe 'Admin Dashboard' do
sign_in(create(:admin))
end
context 'for tooltip' do
describe 'license' do
before do
allow(License).to receive(:current).and_return(license)
visit admin_dashboard_stats_path
end
context 'when license is empty' do
let(:license) { nil }
context 'for tooltip' do
before do
visit admin_dashboard_stats_path
end
it { expect(page).not_to have_css('span.has-tooltip') }
end
context 'when license is empty' do
let(:license) { nil }
it { expect(page).not_to have_css('span.has-tooltip') }
end
context 'when license is on a plan Ultimate' do
let(:license) { create(:license, plan: License::ULTIMATE_PLAN) }
context 'when license is on a plan Ultimate' do
let(:license) { create(:license, plan: License::ULTIMATE_PLAN) }
it { expect(page).to have_css('span.has-tooltip') }
end
it { expect(page).to have_css('span.has-tooltip') }
context 'when license is on a plan other than Ultimate' do
let(:license) { create(:license, plan: License::PREMIUM_PLAN) }
it { expect(page).not_to have_css('span.has-tooltip') }
end
end
context 'when license is on a plan other than Ultimate' do
let(:license) { create(:license, plan: License::PREMIUM_PLAN) }
context 'when user count over license maximum' do
let_it_be(:license_seats_limit) { 5 }
let(:license) { create(:license, restrictions: { active_user_count: license_seats_limit }) }
before do
create(:historical_data, date: license.created_at, active_user_count: license_seats_limit + 1)
visit admin_root_path
end
it { expect(page).not_to have_css('span.has-tooltip') }
it { expect(page).to have_content("Your instance has exceeded your subscription\'s licensed user count.") }
end
end
......
......@@ -24424,9 +24424,6 @@ 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] ""
......@@ -28557,6 +28554,9 @@ msgstr ""
msgid "You won't be able to pull or push project code via SSH until you add an SSH key to your profile"
msgstr ""
msgid "You'll be charged for %{true_up_link_start}users over license%{link_end} on a quartely or annual basis, depending on the terms of your agreement."
msgstr ""
msgid "You'll be signed out from your current account automatically."
msgstr ""
......@@ -28749,6 +28749,9 @@ msgstr ""
msgid "Your instance has %{remaining_user_count} users remaining of the %{total_user_count} included in your subscription. You can add more users than the number included in your license, and we will include the overage in your next bill."
msgstr ""
msgid "Your instance has exceeded your subscription's licensed user count."
msgstr ""
msgid "Your instance is approaching its licensed user count"
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