Commit 1977c6a4 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

Closes #237868

See merge request gitlab-org/gitlab!39597
parents a94d8ce1 500d8789
......@@ -132,11 +132,11 @@ ul.content-list {
a {
color: $gl-text-color;
}
.member-group-link {
&.inline-link {
color: $blue-600;
}
}
.description {
@include str-truncated;
......
......@@ -180,10 +180,6 @@
word-break: break-all;
}
.member-group-link {
display: inline-block;
}
.form-control {
width: inherit;
}
......
......@@ -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: 39597
author:
type: changed
# 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