Commit 3348876c authored by James Fargher's avatar James Fargher

Merge branch '237868-add-an-upgrade-option-to-the-admin-license-page-mvc' into 'master'

Add an upgrade link to the Admin > License page(v2)

Closes #237868

See merge request gitlab-org/gitlab!39974
parents 3c3cc03d b2fc59b8
......@@ -132,10 +132,10 @@ ul.content-list {
a {
color: $gl-text-color;
}
.member-group-link {
color: $blue-600;
&.inline-link {
color: $blue-600;
}
}
.description {
......
......@@ -180,10 +180,6 @@
word-break: break-all;
}
.member-group-link {
display: inline-block;
}
.form-control {
width: inherit;
}
......
......@@ -7,8 +7,8 @@
dismissible: true.to_s } }
= notice[:message].html_safe
- if show_license_breakdown?
= render_if_exists 'admin/licenses/breakdown', license: @license
- if @license.present? && show_license_breakdown?
= render_if_exists 'admin/licenses/breakdown'
.admin-dashboard.gl-mt-3
.row
......
......@@ -33,7 +33,7 @@
- if source.instance_of?(Group) && source != @group
·
= link_to source.full_name, source, class: "member-group-link"
= link_to source.full_name, source, class: "gl-display-inline-block inline-link"
.cgray
- if member.request?
......
- return unless local_assigns.fetch(:license)
- if license.restricted?(:active_user_count)
- restricted = license.restrictions[:active_user_count]
- if @license.restricted?(:active_user_count)
- restricted = @license.restrictions[:active_user_count]
- licensed_users = number_with_delimiter(restricted)
- else
- licensed_users = _('Unlimited')
......
- return unless local_assigns.fetch(:license)
.row
.col-md-6
.card
......@@ -18,6 +16,12 @@
%li
%span.light= _('Plan:')
%strong= @license.plan.capitalize
= ' - '
= link_to _('How to upgrade'),
help_page_path('subscriptions/index.md', anchor: 'upgrade-your-self-managed-subscription-tier'),
class: 'inline-link',
target: :_blank,
rel: :noreferrer
%li
%span.light= _('Uploaded:')
%strong= time_ago_with_tooltip @license.created_at
......
- return unless local_assigns.fetch(:licenses)
- local_assigns.fetch(:license)
- licensee_keys = @licenses.first.licensee.keys
%h4= _('License History')
......
......@@ -19,7 +19,9 @@
%h4.gl-alert-title= _('You do not have an active license')
= _('You have a license that activates at a future date. Please see the License History table below.')
= render 'info', license: @license
= render 'breakdown', license: @license
- if @license.present?
= render 'info'
= render 'breakdown'
= render 'license_history', license: @license, licenses: @licenses
- if @licenses.present?
= render 'license_history'
---
title: Add How-to-upgrade link to admin license page
merge_request: 39974
author:
type: changed
......@@ -14,27 +14,40 @@ RSpec.describe 'admin/dashboard/index.html.haml' do
assign(:projects, create_list(:project, 1))
assign(:users, create_list(:user, 1))
assign(:groups, create_list(:group, 1))
assign(:license, create(:license))
allow(view).to receive(:admin?).and_return(true)
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
allow(view).to receive(:show_license_breakdown?).and_return(true)
end
it 'includes notices above license breakdown' do
assign(:notices, [{ type: :alert, message: 'An alert' }])
context 'when license is present' do
before do
assign(:license, create(:license))
end
it 'includes notices above license breakdown' do
assign(:notices, [{ type: :alert, message: 'An alert' }])
render
render
expect(rendered).to have_content /An alert.*Users in License/
end
expect(rendered).to have_content /An alert.*Users in License/
it 'includes license breakdown' do
render
expect(rendered).to have_content "Users in License:"
expect(rendered).to have_content "Active Users"
expect(rendered).to have_content "Maximum Users"
expect(rendered).to have_content "Users over License"
end
end
it 'includes license breakdown' do
render
context 'when license is not present' do
it 'does not show content' do
render
expect(rendered).to have_content "Users in License"
expect(rendered).to have_content "Active Users"
expect(rendered).to have_content "Maximum Users"
expect(rendered).to have_content "Users over License"
expect(rendered).not_to have_content('Users in License:')
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/licenses/_info' do
let_it_be(:license) { create(:license) }
before do
assign(:license, license)
end
context 'when observing licensees' do
it 'shows "How to upgrade" link' do
render
expect(rendered).to have_content('Plan: Starter - How to upgrade')
expect(rendered).to have_link('How to upgrade')
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/licenses/show.html.haml' do
let_it_be(:license) { create(:license) }
before do
stub_feature_flags(licenses_app: false)
end
context 'when trial license is present' do
before do
trial_license = create(:license, trial: true)
assign(:license, trial_license)
end
it 'shows content as expected' do
render
expect(rendered).to have_content('Buy License')
end
end
context 'when non trial license is present' do
before do
assign(:license, license)
end
it 'shows content as expected' do
render
expect(rendered).not_to have_content('Buy License')
expect(rendered).to have_content('Licensed to')
expect(rendered).to have_content('Users in License:')
expect(rendered).to have_content('Upload New License')
end
end
context 'when license is not present' do
it 'does not show content' do
render
expect(rendered).not_to have_content('Licensed to')
expect(rendered).not_to have_content('Users in License:')
expect(rendered).to have_content('Upload New License')
end
end
context 'when licenses are present' do
before do
assign(:licenses, [license])
end
it 'shows content as expected' do
render
expect(rendered).to have_content('License History')
end
end
context 'when licenses are empty' do
before do
assign(:licenses, [])
end
it 'does not show content' do
render
expect(rendered).not_to have_content('License History')
end
end
context 'when licenses are not defined' do
it 'does not show content' do
render
expect(rendered).not_to have_content('License History')
end
end
end
......@@ -12593,6 +12593,9 @@ msgstr ""
msgid "How many users will be evaluating the trial?"
msgstr ""
msgid "How to upgrade"
msgstr ""
msgid "However, you are already a member of this %{member_source}. Sign in using a different account to accept the invitation."
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