Commit 80bea93f authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '327484_remove_old_license_page_logic' into 'master'

Remove old license page logic

See merge request gitlab-org/gitlab!65978
parents 0e4e821a a90ec139
...@@ -454,7 +454,6 @@ RSpec/AnyInstanceOf: ...@@ -454,7 +454,6 @@ RSpec/AnyInstanceOf:
- 'ee/spec/features/admin/admin_audit_logs_spec.rb' - 'ee/spec/features/admin/admin_audit_logs_spec.rb'
- 'ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb' - 'ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb'
- 'ee/spec/features/admin/admin_users_spec.rb' - 'ee/spec/features/admin/admin_users_spec.rb'
- 'ee/spec/features/admin/licenses/admin_views_license_spec.rb'
- 'ee/spec/features/boards/scoped_issue_board_spec.rb' - 'ee/spec/features/boards/scoped_issue_board_spec.rb'
- 'ee/spec/features/ci_shared_runner_warnings_spec.rb' - 'ee/spec/features/ci_shared_runner_warnings_spec.rb'
- 'ee/spec/features/groups/group_settings_spec.rb' - 'ee/spec/features/groups/group_settings_spec.rb'
......
<script>
import { GlModal, GlLink, GlIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import trialLicenseActivatedSvg from 'ee_icons/_ee_trial_license_activated.svg';
import csrf from '~/lib/utils/csrf';
import { __ } from '~/locale';
export default {
name: 'UploadTrialLicenseModal',
components: {
GlModal,
GlLink,
GlIcon,
},
directives: {
SafeHtml,
},
props: {
licenseKey: {
type: String,
required: true,
},
adminLicensePath: {
type: String,
required: true,
},
initialShow: {
type: Boolean,
required: false,
default: true,
},
},
data() {
return {
visible: this.initialShow,
};
},
methods: {
submitForm() {
this.$refs.form.submit();
},
},
csrf,
cancelOptions: {
text: __('Cancel'),
},
primaryOptions: {
text: __('Install license'),
attributes: [
{
variant: 'confirm',
category: 'primary',
},
],
},
trialLicenseActivatedSvg,
};
</script>
<template>
<gl-modal
ref="modal"
:visible="visible"
modal-id="modal-upload-trial-license"
body-class="modal-upload-trial-license"
:action-primary="$options.primaryOptions"
:action-cancel="$options.cancelOptions"
@primary.prevent="submitForm"
>
<div class="trial-activated-graphic gl-display-flex gl-justify-content-center gl-mt-5">
<span v-safe-html="$options.trialLicenseActivatedSvg" class="svg-container"></span>
</div>
<h3 class="gl-text-center">{{ __('Your trial license was issued!') }}</h3>
<p class="gl-text-center gl-text-gray-500 mw-70p m-auto gl-font-size-h2 gl-line-height-28">
{{
__(
'Your trial license was issued and activated. Install it to enjoy GitLab Ultimate for 30 days.',
)
}}
</p>
<form
id="new_license"
ref="form"
:action="adminLicensePath"
enctype="multipart/form-data"
method="post"
>
<div class="gl-mt-5">
<gl-link
id="hide-license"
href="#hide-license"
class="hide-license gl-text-gray-600 gl-text-center"
>{{ __('Show license key') }}<gl-icon name="chevron-down"
/></gl-link>
<gl-link
id="show-license"
href="#show-license"
class="show-license gl-text-gray-600 gl-text-center"
>{{ __('Hide license key') }}<gl-icon name="chevron-up"
/></gl-link>
<div class="card trial-license-preview gl-overflow-y-auto gl-word-break-all gl-mt-5">
{{ licenseKey }}
</div>
</div>
<input :value="$options.csrf.token" type="hidden" name="authenticity_token" />
<input id="license_data" :value="licenseKey" type="hidden" name="license[data]" />
</form>
</gl-modal>
</template>
import Vue from 'vue';
import UploadTrialLicenseModal from './components/upload_trial_license_modal.vue';
export default function initUploadTrialLicenseModal() {
const el = document.querySelector('.js-upload-trial-license-modal');
if (!el) {
return false;
}
const { licenseKey, adminLicensePath } = el.dataset;
return new Vue({
el,
render(h) {
return h(UploadTrialLicenseModal, {
props: {
licenseKey,
adminLicensePath,
},
});
},
});
}
import initUploadTrialLicenseModal from 'ee/admin/licenses/init_trial_license_modal';
import { shouldQrtlyReconciliationMount } from 'ee/billings/qrtly_reconciliation';
shouldQrtlyReconciliationMount();
initUploadTrialLicenseModal();
...@@ -3,28 +3,15 @@ ...@@ -3,28 +3,15 @@
class Admin::LicensesController < Admin::ApplicationController class Admin::LicensesController < Admin::ApplicationController
include Admin::LicenseRequest include Admin::LicenseRequest
before_action :license, only: [:show, :download, :destroy] before_action :license, only: [:download, :destroy]
before_action :require_license, only: [:download, :destroy] before_action :require_license, only: [:download, :destroy]
before_action :check_cloud_license, only: [:show]
respond_to :html respond_to :html
feature_category :license feature_category :license
def show
if @license.present? || License.future_dated_only?
@licenses = License.history
else
render :missing
end
end
def download
send_data @license.data, filename: @license.data_filename, disposition: 'attachment'
end
def new def new
build_license @license ||= License.new(data: params[:trial_key])
end end
def create def create
...@@ -34,7 +21,7 @@ class Admin::LicensesController < Admin::ApplicationController ...@@ -34,7 +21,7 @@ class Admin::LicensesController < Admin::ApplicationController
return upload_license_error if @license.cloud_license? return upload_license_error if @license.cloud_license?
respond_with(@license, location: admin_license_path) do respond_with(@license, location: admin_subscription_path) do
if @license.save if @license.save
notice = if @license.started? notice = if @license.started?
_('The license was successfully uploaded and is now active. You can see the details below.') _('The license was successfully uploaded and is now active. You can see the details below.')
...@@ -56,11 +43,11 @@ class Admin::LicensesController < Admin::ApplicationController ...@@ -56,11 +43,11 @@ class Admin::LicensesController < Admin::ApplicationController
flash[:alert] = _('The license was removed. GitLab now no longer has a valid license.') flash[:alert] = _('The license was removed. GitLab now no longer has a valid license.')
end end
redirect_to admin_license_path, status: :found redirect_to admin_subscription_path, status: :found
rescue Licenses::DestroyService::DestroyCloudLicenseError => e rescue Licenses::DestroyService::DestroyCloudLicenseError => e
flash[:error] = e.message flash[:error] = e.message
redirect_to admin_license_path, status: :found redirect_to admin_subscription_path, status: :found
end end
def sync_seat_link def sync_seat_link
...@@ -77,14 +64,6 @@ class Admin::LicensesController < Admin::ApplicationController ...@@ -77,14 +64,6 @@ class Admin::LicensesController < Admin::ApplicationController
private private
def build_license
@license ||= License.new(data: params[:trial_key])
end
def check_cloud_license
redirect_to admin_subscription_path
end
def license_params def license_params
license_params = params.require(:license).permit(:data_file, :data) license_params = params.require(:license).permit(:data_file, :data)
license_params.delete(:data) if license_params[:data_file] license_params.delete(:data) if license_params[:data_file]
......
...@@ -57,7 +57,7 @@ class Projects::PathLocksController < Projects::ApplicationController ...@@ -57,7 +57,7 @@ class Projects::PathLocksController < Projects::ApplicationController
def check_license def check_license
unless @project.feature_available?(:file_locks) unless @project.feature_available?(:file_locks)
flash[:alert] = _('You need a different license to enable FileLocks feature') flash[:alert] = _('You need a different license to enable FileLocks feature')
redirect_to admin_license_path redirect_to admin_subscription_path
end end
end end
......
...@@ -325,12 +325,6 @@ class License < ApplicationRecord ...@@ -325,12 +325,6 @@ class License < ApplicationRecord
Gitlab::SafeRequestStore.delete(:future_dated_license) Gitlab::SafeRequestStore.delete(:future_dated_license)
end end
def future_dated_only?
return false if current.present?
future_dated.present?
end
def previous def previous
Gitlab::SafeRequestStore.fetch(:previous_license) { load_previous } Gitlab::SafeRequestStore.fetch(:previous_license) { load_previous }
end end
......
- return if Gitlab::Geo.license_allows? - return if Gitlab::Geo.license_allows?
.js-vue-alert{ 'v-cloak': true, data: { variant: 'tip', .js-vue-alert{ 'v-cloak': true, data: { variant: 'tip',
primary_button_text: _('Manage your license'), primary_button_text: _('Manage your license'),
primary_button_link: admin_license_path, primary_button_link: admin_subscription_path,
dismissible: 'true' } } dismissible: 'true' } }
= _('This GitLab instance is licensed at the %{insufficient_license} tier. Geo is only available for users who have at least a Premium license.') % { insufficient_license: current_license_title } = _('This GitLab instance is licensed at the %{insufficient_license} tier. Geo is only available for users who have at least a Premium license.') % { insufficient_license: current_license_title }
.row
.col-md-6
.gl-card.gl-mb-5
.gl-card-header
= _('Licensed to')
.gl-card-body
%ul.content-list
- @license.licensee.each do |label, value|
%li
%span.light= succeed(':') { label }
%strong= value
.gl-card.js-license-info-panel.gl-mb-5
.gl-card-header
= _('Details')
.gl-card-body
%ul.content-list
%li
%span.light= _('Plan:')
%strong{ data: { "qa-selector": "plan_name" } }= @license.plan.capitalize
- unless @license.ultimate?
= ' - '
= link_to _('Contact Sales to upgrade'),
'https://about.gitlab.com/sales/?inapplink=contactsalessm',
class: 'inline-link',
target: :_blank,
rel: :noreferrer
%li
%span.light= _('Uploaded:')
%strong= time_ago_with_tooltip @license.created_at
%li
%span.light= _('Started:')
%strong= time_ago_with_tooltip @license.starts_at
%li
%span.light
= render 'license_status'
- if @license.expired?
%span.badge.badge-danger.float-right
%strong= _('Expired')
%li
%span.light= _('License ID:')
%strong= @license.license_id
= clipboard_button(text: @license.license_id, title: _("Copy ID"), class: "btn-transparent btn-clipboard")
.col-md-6
.gl-card.border-info.gl-mb-5
.gl-card-header.bg-info.text-white
= _('Download license')
.gl-card-body
%p= html_escape(_('Your license will be included in your GitLab backup and will survive upgrades, so in normal usage you should never need to re-upload your %{code_open}.gitlab-license%{code_close} file.')) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe }
%p= _('Still, we recommend keeping a backup saved somewhere. Otherwise, if you ever need it and have lost it, you will need to request GitLab Inc. to send it to you again.')
%br
= link_to _('Download license'), download_admin_license_path, class: 'gl-button btn btn-info'
= link_to _('Customer Portal'), 'https://customers.gitlab.com', class: 'gl-button btn btn-info btn-inverted', data: { track_event: 'click_text', track_label: 'license_dashboard', track_property: 'customer_portal' }, target: '_blank', rel: 'noopener noreferrer'
.gl-card.border-danger.gl-mb-5
.gl-card-header.bg-danger.text-white
= _('Remove license')
.gl-card-body
%p= _('If you remove this license, GitLab will fall back on the previous license, if any.')
%p= _('If there is no previous license or if the previous license has expired, some GitLab functionality will be blocked until a new, valid license is uploaded.')
%br
= link_to _('Remove license'), admin_license_path, data: { confirm: _('Are you sure you want to remove the license?') }, method: :delete, class: 'gl-button btn btn-danger'
- licensee_keys = @licenses.first.licensee.keys
%h4= _('License History')
%table.gl-table.table#license_history
%thead
%tr
- licensee_keys.each do |label|
%th= label
%th= _('Plan')
%th= _('Uploaded on')
%th= _('Valid from')
%th= _('Expires on')
%th= _('Users in License')
%tbody
- @licenses.each do |license|
%tr{ class: ('gl-bg-blue-50 font-weight-bold gl-text-blue-500' if license == @license), data: { testid: ('license-current' if license == @license) } }
- licensee_keys.each do |label|
%td= license.licensee[label]
%td
%span
= license.plan.capitalize
%td
%span
= l(license.created_at, format: :with_timezone)
%td
%span
= l(license.starts_at)
%td
%span
= license.expires_at.present? ? l(license.expires_at) : _('Never')
%td
%span
- if license.restricted?(:active_user_count)
= license.restrictions[:active_user_count]
- else
= _('Unlimited')
#repeat-trial-info.bs-callout.bs-callout-info.gl-alert.fade.in.show{ role: "alert" }
%button.js-close.gl-alert-dismiss{ type: 'button', 'aria-label' => _('Dismiss') }
= sprite_icon('close', size: 16, css_class: 'gl-icon')
%h4
= _('Free Trial')
%p
= _('Thank you for signing up for your free trial! You will get additional instructions in your inbox shortly.')
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
%strong= @license.licensee_name %strong= @license.licensee_name
= "(#{@license.licensee_email})" = "(#{@license.licensee_email})"
%div %div
= link_to 'View details', admin_license_path, class: "gl-button btn btn-default" = link_to 'View details', admin_subscription_path, class: "gl-button btn btn-default"
= link_to _('Buy License'), ::EE::SUBSCRIPTIONS_PLANS_URL, target: '_blank', rel: 'noopener noreferrer nofollow', class: 'gl-button btn btn-confirm-secondary float-right btn-buy-license'
= link_to _('Upload New License'), new_admin_license_path, class: 'gl-button btn btn-default float-right btn-upload-license gl-mr-3', data: { qa_selector: 'license_upload_link' }
- page_title s_('License|License')
%h3.page-title
= s_('License|Your License')
= render "upload_buy_license"
- if params[:trial_key].present?
.js-upload-trial-license-modal{ data: { license_key: params[:trial_key], admin_license_path: admin_license_path } }
%hr
- if params.key?(:trial_key) && params[:trial_key].blank?
= render "repeat_trial_info"
.container.blank-state-container
.text-center
= custom_icon("missing_license")
%h4{ data: { qa_selector: 'missing_license_content' } }
= s_('License|You do not have a license.')
- if License.eligible_for_trial?
%p.trial-description= s_('License|You can start a free trial of GitLab Ultimate without any obligation or payment details.')
= link_to 'Start free trial', new_trial_url, target: '_blank', class: "gl-button btn btn-confirm btn-start-trial gl-mt-3"
- else
%p.trial-description
= s_('License|Your free trial of GitLab Ultimate expired on %{trial_ends_on}.').html_safe % {trial_ends_on: License.trial_ends_on}
= s_('License|You can restore access to the Gold features at any time by upgrading.')
= link_to s_('License|Buy license'), ::EE::SUBSCRIPTIONS_PLANS_URL, target: '_blank', rel: 'noopener noreferrer nofollow', class: "gl-button btn btn-confirm btn-buy-license"
- page_title _('License')
= render_if_exists 'shared/qrtly_reconciliation_alert'
%h3.page-title
= _('Your License')
- if @license&.trial?
= render 'upload_buy_license'
- else
= link_to _('Upload New License'), new_admin_license_path, class: 'gl-button btn btn-confirm float-right'
%hr
- if License.future_dated_only?
= render 'shared/global_alert',
title: _('You do not have an active license'),
variant: :info,
is_contained: true,
dismissible: false do
.gl-alert-body
= _('You have a license that activates at a future date. Please see the License History table below.')
- if @license.present?
= render 'info'
.license-panel.gl-mt-5
= render 'breakdown'
- if @licenses.present?
= render 'license_history'
<svg xmlns="http://www.w3.org/2000/svg" width="78" height="82" viewBox="0 0 78 82"><g fill="none" fill-rule="evenodd"><path fill="#F9F9F9" d="M2.12 42c-.08.99-.12 1.99-.12 3 0 20.435 16.565 37 37 37s37-16.565 37-37c0-1.01-.04-2.01-.12-3C74.353 61.032 58.425 76 39 76 19.575 76 3.647 61.032 2.12 42z"/><path fill="#EEE" fill-rule="nonzero" d="M39 78C17.46 78 0 60.54 0 39S17.46 0 39 0s39 17.46 39 39-17.46 39-39 39zm0-4c19.33 0 35-15.67 35-35S58.33 4 39 4 4 19.67 4 39s15.67 35 35 35z"/><path fill="#6B4FBB" d="M36.6 44.687l-7.314-6.82a3 3 0 1 0-4.092 4.388l9.508 8.866a2.99 2.99 0 0 0 2.15.804 2.99 2.99 0 0 0 2.09-.952l15.686-16.821a3 3 0 1 0-4.388-4.092L36.6 44.687z"/></g></svg>
\ No newline at end of file
...@@ -43,14 +43,14 @@ RSpec.describe Admin::LicensesController do ...@@ -43,14 +43,14 @@ RSpec.describe Admin::LicensesController do
expect(response.body).to include('The license key is invalid. Make sure it is exactly as you received it from GitLab Inc.') expect(response.body).to include('The license key is invalid. Make sure it is exactly as you received it from GitLab Inc.')
end end
it 'redirects to show when a valid license is entered/uploaded' do it 'redirects to the subscription page when a valid license is entered/uploaded' do
license = build_license license = build_license
expect do expect do
post :create, params: { license: { data: license.data } } post :create, params: { license: { data: license.data } }
end.to change(License, :count).by(1) end.to change(License, :count).by(1)
expect(response).to redirect_to(admin_license_path) expect(response).to redirect_to(admin_subscription_path)
end end
context 'Trials' do context 'Trials' do
...@@ -58,14 +58,14 @@ RSpec.describe Admin::LicensesController do ...@@ -58,14 +58,14 @@ RSpec.describe Admin::LicensesController do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
end end
it 'redirects to show when a valid trial license is entered/uploaded' do it 'redirects to the subscription page when a valid trial license is entered/uploaded' do
license = build_license(restrictions: { trial: true }) license = build_license(restrictions: { trial: true })
expect do expect do
post :create, params: { license: { data: license.data } } post :create, params: { license: { data: license.data } }
end.to change(License, :count).by(1) end.to change(License, :count).by(1)
expect(response).to redirect_to(admin_license_path) expect(response).to redirect_to(admin_subscription_path)
end end
end end
...@@ -87,28 +87,6 @@ RSpec.describe Admin::LicensesController do ...@@ -87,28 +87,6 @@ RSpec.describe Admin::LicensesController do
end end
end end
describe 'GET show' do
context 'with an existent license' do
it 'redirects to new path when a valid license is entered/uploaded' do
allow(License).to receive(:current).and_return(create(:license))
get :show
expect(response).to redirect_to(admin_subscription_path)
end
end
context 'without a license' do
it 'renders missing license page' do
allow(License).to receive(:current).and_return(nil)
get :show
expect(response).to redirect_to(admin_subscription_path)
end
end
end
describe 'POST sync_seat_link' do describe 'POST sync_seat_link' do
let_it_be(:historical_data) { create(:historical_data, recorded_at: Time.current) } let_it_be(:historical_data) { create(:historical_data, recorded_at: Time.current) }
...@@ -152,7 +130,7 @@ RSpec.describe Admin::LicensesController do ...@@ -152,7 +130,7 @@ RSpec.describe Admin::LicensesController do
it 'is can not be removed' do it 'is can not be removed' do
delete :destroy delete :destroy
expect(response).to redirect_to(admin_license_path) expect(response).to redirect_to(admin_subscription_path)
expect(flash[:error]).to match('Cloud licenses can not be removed.') expect(flash[:error]).to match('Cloud licenses can not be removed.')
expect(cloud_licenses).to be_present expect(cloud_licenses).to be_present
end end
...@@ -164,7 +142,7 @@ RSpec.describe Admin::LicensesController do ...@@ -164,7 +142,7 @@ RSpec.describe Admin::LicensesController do
it 'is can be removed' do it 'is can be removed' do
delete :destroy delete :destroy
expect(response).to redirect_to(admin_license_path) expect(response).to redirect_to(admin_subscription_path)
expect(flash[:notice]).to match('The license was removed. GitLab has fallen back on the previous license.') expect(flash[:notice]).to match('The license was removed. GitLab has fallen back on the previous license.')
expect(cloud_licenses).to be_empty expect(cloud_licenses).to be_empty
end end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin views license' do
before do
admin = create(:admin)
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
end
it 'gets redirected to the new subscription page' do
visit(admin_license_path)
expect(page).to have_current_path(admin_subscription_path)
end
end
import { GlModal } from '@gitlab/ui';
import UploadTrialLicenseModal from 'ee/admin/licenses/components/upload_trial_license_modal.vue';
import { stubComponent } from 'helpers/stub_component';
import { mountExtended } from 'helpers/vue_test_utils_helper';
jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' }));
describe('UploadTrialLicenseModal', () => {
let wrapper;
let formSubmitSpy;
function createComponent(props = {}) {
return mountExtended(UploadTrialLicenseModal, {
propsData: {
initialShow: true,
...props,
},
stubs: {
GlModal: stubComponent(GlModal, {
template: '<div><slot></slot><slot name="modal-footer"></slot></div>',
}),
},
});
}
beforeEach(() => {
formSubmitSpy = jest.spyOn(HTMLFormElement.prototype, 'submit').mockImplementation();
});
afterEach(() => {
wrapper.destroy();
});
const findModal = () => wrapper.findComponent(GlModal);
const findForm = () => wrapper.find('form');
const findAuthenticityToken = () => new FormData(findForm().element).get('authenticity_token');
const findLicenseData = () => new FormData(findForm().element).get('license[data]');
describe('template', () => {
const licenseKey = '12345abcde';
const adminLicensePath = '/admin/license';
describe('form', () => {
beforeEach(() => {
wrapper = createComponent({ licenseKey, adminLicensePath });
});
it('displays the form with the correct action and inputs', () => {
expect(findForm().exists()).toBe(true);
expect(findForm().attributes('action')).toBe(adminLicensePath);
expect(findAuthenticityToken()).toBe('mock-csrf-token');
expect(findLicenseData()).toBe(licenseKey);
});
it('submits the form when the primary action is clicked', () => {
const mockEvent = { preventDefault: jest.fn() };
findModal().vm.$emit('primary', mockEvent);
expect(formSubmitSpy).toHaveBeenCalled();
});
});
});
});
...@@ -612,57 +612,6 @@ RSpec.describe License do ...@@ -612,57 +612,6 @@ RSpec.describe License do
end end
end end
describe '.future_dated_only?' do
before do
described_class.reset_future_dated
end
context 'when licenses table does not exist' do
it 'returns false' do
allow(described_class).to receive(:table_exists?).and_return(false)
expect(described_class.future_dated_only?).to be_falsey
end
end
context 'when there is no license' do
it 'returns false' do
allow(described_class).to receive(:last_hundred).and_return([])
expect(described_class.future_dated_only?).to be_falsey
end
end
context 'when the license is invalid' do
it 'returns false' do
license = build(:license, data: build(:gitlab_license, starts_at: Date.current + 1.month).export)
allow(described_class).to receive(:last_hundred).and_return([license])
allow(license).to receive(:valid?).and_return(false)
expect(described_class.future_dated_only?).to be_falsey
end
end
context 'when the license is valid' do
context 'when there is a current license' do
it 'returns the false' do
expect(described_class.future_dated_only?).to be_falsey
end
end
context 'when the license is future-dated' do
it 'returns the true' do
create(:license, data: create(:gitlab_license, starts_at: Date.current + 1.month).export)
allow(described_class).to receive(:current).and_return(nil)
expect(described_class.future_dated_only?).to be_truthy
end
end
end
end
describe '.future_dated' do describe '.future_dated' do
before do before do
described_class.reset_future_dated described_class.reset_future_dated
......
...@@ -39,7 +39,7 @@ RSpec.describe 'admin/dashboard/index.html.haml' do ...@@ -39,7 +39,7 @@ RSpec.describe 'admin/dashboard/index.html.haml' do
expect(rendered).to have_content "Plan:" expect(rendered).to have_content "Plan:"
expect(rendered).to have_content "Expires:" expect(rendered).to have_content "Expires:"
expect(rendered).to have_content "Licensed to:" expect(rendered).to have_content "Licensed to:"
expect(rendered).to have_link 'View details', href: admin_license_path expect(rendered).to have_link 'View details', href: admin_subscription_path
end end
it 'includes license breakdown' do it 'includes license breakdown' do
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/licenses/_info' do
context 'when observing the license' do
before do
assign(:license, license)
end
context 'when plan can be upgraded' do
let(:license) { create(:license, plan: License::STARTER_PLAN) }
it 'shows "Contact Sales to upgrade" link' do
render
expect(rendered).to have_content('Plan: Starter - Contact Sales to upgrade')
expect(rendered).to have_link('Contact Sales to upgrade')
end
end
context 'when plan can not be upgraded' do
let(:license) { create(:license, plan: License::ULTIMATE_PLAN) }
it 'does not show "Contact Sales to upgrade" link' do
render
expect(rendered).to have_content('Plan: Ultimate')
expect(rendered).not_to have_link('Contact Sales to upgrade')
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/licenses/show.html.haml' do
let_it_be(:license) { create(:license) }
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')
expect(rendered).not_to have_content('License overview')
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
...@@ -5771,9 +5771,6 @@ msgstr "" ...@@ -5771,9 +5771,6 @@ msgstr ""
msgid "Buy CI Minutes" msgid "Buy CI Minutes"
msgstr "" msgstr ""
msgid "Buy License"
msgstr ""
msgid "Buy more Pipeline minutes" msgid "Buy more Pipeline minutes"
msgstr "" msgstr ""
...@@ -8511,9 +8508,6 @@ msgstr "" ...@@ -8511,9 +8508,6 @@ msgstr ""
msgid "Consistency guarantee method" msgid "Consistency guarantee method"
msgstr "" msgstr ""
msgid "Contact Sales to upgrade"
msgstr ""
msgid "Contact support" msgid "Contact support"
msgstr "" msgstr ""
...@@ -9759,9 +9753,6 @@ msgstr "" ...@@ -9759,9 +9753,6 @@ msgstr ""
msgid "Custom range (UTC)" msgid "Custom range (UTC)"
msgstr "" msgstr ""
msgid "Customer Portal"
msgstr ""
msgid "Customizable by an administrator." msgid "Customizable by an administrator."
msgstr "" msgstr ""
...@@ -11758,9 +11749,6 @@ msgstr "" ...@@ -11758,9 +11749,6 @@ msgstr ""
msgid "Download image" msgid "Download image"
msgstr "" msgstr ""
msgid "Download license"
msgstr ""
msgid "Download raw data (.csv)" msgid "Download raw data (.csv)"
msgstr "" msgstr ""
...@@ -13377,9 +13365,6 @@ msgstr "" ...@@ -13377,9 +13365,6 @@ msgstr ""
msgid "Expires in %{expires_at}" msgid "Expires in %{expires_at}"
msgstr "" msgstr ""
msgid "Expires on"
msgstr ""
msgid "Expires:" msgid "Expires:"
msgstr "" msgstr ""
...@@ -14404,9 +14389,6 @@ msgstr "" ...@@ -14404,9 +14389,6 @@ msgstr ""
msgid "Framework successfully deleted" msgid "Framework successfully deleted"
msgstr "" msgstr ""
msgid "Free Trial"
msgstr ""
msgid "Free Trial of GitLab.com Ultimate" msgid "Free Trial of GitLab.com Ultimate"
msgstr "" msgstr ""
...@@ -16293,9 +16275,6 @@ msgstr "" ...@@ -16293,9 +16275,6 @@ msgstr ""
msgid "Hide host keys manual input" msgid "Hide host keys manual input"
msgstr "" msgstr ""
msgid "Hide license key"
msgstr ""
msgid "Hide list" msgid "Hide list"
msgstr "" msgstr ""
...@@ -16550,9 +16529,6 @@ msgstr "" ...@@ -16550,9 +16529,6 @@ msgstr ""
msgid "If the number of active users exceeds the user limit, you will be charged for the number of %{users_over_license_link} at your next license reconciliation." msgid "If the number of active users exceeds the user limit, you will be charged for the number of %{users_over_license_link} at your next license reconciliation."
msgstr "" msgstr ""
msgid "If there is no previous license or if the previous license has expired, some GitLab functionality will be blocked until a new, valid license is uploaded."
msgstr ""
msgid "If this email was added in error, you can remove it here:" msgid "If this email was added in error, you can remove it here:"
msgstr "" msgstr ""
...@@ -16592,9 +16568,6 @@ msgstr "" ...@@ -16592,9 +16568,6 @@ msgstr ""
msgid "If you recently signed in and recognize the IP address, you may disregard this email." msgid "If you recently signed in and recognize the IP address, you may disregard this email."
msgstr "" msgstr ""
msgid "If you remove this license, GitLab will fall back on the previous license, if any."
msgstr ""
msgid "If you want to re-enable two-factor authentication, visit %{two_factor_link}" msgid "If you want to re-enable two-factor authentication, visit %{two_factor_link}"
msgstr "" msgstr ""
...@@ -17597,9 +17570,6 @@ msgstr "" ...@@ -17597,9 +17570,6 @@ msgstr ""
msgid "Install GitLab Runner on Kubernetes" msgid "Install GitLab Runner on Kubernetes"
msgstr "" msgstr ""
msgid "Install license"
msgstr ""
msgid "Install on clusters" msgid "Install on clusters"
msgstr "" msgstr ""
...@@ -19533,18 +19503,9 @@ msgstr "" ...@@ -19533,18 +19503,9 @@ msgstr ""
msgid "Let's talk!" msgid "Let's talk!"
msgstr "" msgstr ""
msgid "License"
msgstr ""
msgid "License Compliance" msgid "License Compliance"
msgstr "" msgstr ""
msgid "License History"
msgstr ""
msgid "License ID:"
msgstr ""
msgid "License file" msgid "License file"
msgstr "" msgstr ""
...@@ -19656,9 +19617,6 @@ msgstr "" ...@@ -19656,9 +19617,6 @@ msgstr ""
msgid "Licensed Features" msgid "Licensed Features"
msgstr "" msgstr ""
msgid "Licensed to"
msgstr ""
msgid "Licensed to:" msgid "Licensed to:"
msgstr "" msgstr ""
...@@ -19716,27 +19674,6 @@ msgstr "" ...@@ -19716,27 +19674,6 @@ msgstr ""
msgid "Licenses|View license details for your project" msgid "Licenses|View license details for your project"
msgstr "" msgstr ""
msgid "License|Buy license"
msgstr ""
msgid "License|License"
msgstr ""
msgid "License|You can restore access to the Gold features at any time by upgrading."
msgstr ""
msgid "License|You can start a free trial of GitLab Ultimate without any obligation or payment details."
msgstr ""
msgid "License|You do not have a license."
msgstr ""
msgid "License|Your License"
msgstr ""
msgid "License|Your free trial of GitLab Ultimate expired on %{trial_ends_on}."
msgstr ""
msgid "Limit display of time tracking units to hours." msgid "Limit display of time tracking units to hours."
msgstr "" msgstr ""
...@@ -24554,9 +24491,6 @@ msgstr "" ...@@ -24554,9 +24491,6 @@ msgstr ""
msgid "Plain diff" msgid "Plain diff"
msgstr "" msgstr ""
msgid "Plan"
msgstr ""
msgid "Plan:" msgid "Plan:"
msgstr "" msgstr ""
...@@ -30239,9 +30173,6 @@ msgstr "" ...@@ -30239,9 +30173,6 @@ msgstr ""
msgid "Show latest version" msgid "Show latest version"
msgstr "" msgstr ""
msgid "Show license key"
msgstr ""
msgid "Show links anyways" msgid "Show links anyways"
msgstr "" msgstr ""
...@@ -31194,9 +31125,6 @@ msgstr "" ...@@ -31194,9 +31125,6 @@ msgstr ""
msgid "Started asynchronous removal of all repository check states." msgid "Started asynchronous removal of all repository check states."
msgstr "" msgstr ""
msgid "Started:"
msgstr ""
msgid "Starting..." msgid "Starting..."
msgstr "" msgstr ""
...@@ -31419,9 +31347,6 @@ msgstr "" ...@@ -31419,9 +31347,6 @@ msgstr ""
msgid "Step 4." msgid "Step 4."
msgstr "" msgstr ""
msgid "Still, we recommend keeping a backup saved somewhere. Otherwise, if you ever need it and have lost it, you will need to request GitLab Inc. to send it to you again."
msgstr ""
msgid "Stop Terminal" msgid "Stop Terminal"
msgstr "" msgstr ""
...@@ -32519,9 +32444,6 @@ msgstr "" ...@@ -32519,9 +32444,6 @@ msgstr ""
msgid "Text style" msgid "Text style"
msgstr "" msgstr ""
msgid "Thank you for signing up for your free trial! You will get additional instructions in your inbox shortly."
msgstr ""
msgid "Thank you for your business." msgid "Thank you for your business."
msgstr "" msgstr ""
...@@ -35403,9 +35325,6 @@ msgstr "" ...@@ -35403,9 +35325,6 @@ msgstr ""
msgid "Upload New File" msgid "Upload New File"
msgstr "" msgstr ""
msgid "Upload New License"
msgstr ""
msgid "Upload a certificate for your domain with all intermediates" msgid "Upload a certificate for your domain with all intermediates"
msgstr "" msgstr ""
...@@ -35430,12 +35349,6 @@ msgstr "" ...@@ -35430,12 +35349,6 @@ msgstr ""
msgid "UploadLink|click to upload" msgid "UploadLink|click to upload"
msgstr "" msgstr ""
msgid "Uploaded on"
msgstr ""
msgid "Uploaded:"
msgstr ""
msgid "Uploading changes to terminal" msgid "Uploading changes to terminal"
msgstr "" msgstr ""
...@@ -36123,9 +36036,6 @@ msgstr "" ...@@ -36123,9 +36036,6 @@ msgstr ""
msgid "Using the %{codeStart}needs%{codeEnd} keyword makes jobs run before their stage is reached. Jobs run as soon as their %{codeStart}needs%{codeEnd} relationships are met, which speeds up your pipelines." msgid "Using the %{codeStart}needs%{codeEnd} keyword makes jobs run before their stage is reached. Jobs run as soon as their %{codeStart}needs%{codeEnd} relationships are met, which speeds up your pipelines."
msgstr "" msgstr ""
msgid "Valid from"
msgstr ""
msgid "Validate" msgid "Validate"
msgstr "" msgstr ""
...@@ -37701,9 +37611,6 @@ msgstr "" ...@@ -37701,9 +37611,6 @@ msgstr ""
msgid "You didn't renew your subscription for %{strong}%{namespace_name}%{strong_close} so it was downgraded to the free plan." msgid "You didn't renew your subscription for %{strong}%{namespace_name}%{strong_close} so it was downgraded to the free plan."
msgstr "" msgstr ""
msgid "You do not have an active license"
msgstr ""
msgid "You do not have any subscriptions yet" msgid "You do not have any subscriptions yet"
msgstr "" msgstr ""
...@@ -37767,9 +37674,6 @@ msgstr "" ...@@ -37767,9 +37674,6 @@ msgstr ""
msgid "You don’t have access to Value Stream Analytics for this group" msgid "You don’t have access to Value Stream Analytics for this group"
msgstr "" msgstr ""
msgid "You have a license that activates at a future date. Please see the License History table below."
msgstr ""
msgid "You have been granted %{access_level} access to the %{source_link} %{source_type}." msgid "You have been granted %{access_level} access to the %{source_link} %{source_type}."
msgstr "" msgstr ""
...@@ -38052,9 +37956,6 @@ msgstr "" ...@@ -38052,9 +37956,6 @@ msgstr ""
msgid "Your Groups" msgid "Your Groups"
msgstr "" msgstr ""
msgid "Your License"
msgstr ""
msgid "Your Personal Access Token was revoked" msgid "Your Personal Access Token was revoked"
msgstr "" msgstr ""
...@@ -38208,9 +38109,6 @@ msgstr "" ...@@ -38208,9 +38109,6 @@ msgstr ""
msgid "Your license is valid from" msgid "Your license is valid from"
msgstr "" msgstr ""
msgid "Your license will be included in your GitLab backup and will survive upgrades, so in normal usage you should never need to re-upload your %{code_open}.gitlab-license%{code_close} file."
msgstr ""
msgid "Your membership in %{group} no longer expires." msgid "Your membership in %{group} no longer expires."
msgstr "" msgstr ""
...@@ -38301,12 +38199,6 @@ msgstr "" ...@@ -38301,12 +38199,6 @@ msgstr ""
msgid "Your subscription will expire in %{remaining_days}." msgid "Your subscription will expire in %{remaining_days}."
msgstr "" msgstr ""
msgid "Your trial license was issued and activated. Install it to enjoy GitLab Ultimate for 30 days."
msgstr ""
msgid "Your trial license was issued!"
msgstr ""
msgid "Your username is %{username}." msgid "Your username is %{username}."
msgstr "" msgstr ""
......
...@@ -5,10 +5,6 @@ module QA ...@@ -5,10 +5,6 @@ module QA
module Page module Page
module Admin module Admin
class License < QA::Page::Base class License < QA::Page::Base
view 'ee/app/views/admin/licenses/missing.html.haml' do
element :missing_license_content
end
view 'ee/app/assets/javascripts/admin/subscriptions/show/components/subscription_activation_card.vue' do view 'ee/app/assets/javascripts/admin/subscriptions/show/components/subscription_activation_card.vue' do
element :license_upload_link element :license_upload_link
end end
......
...@@ -90,8 +90,8 @@ tests = [ ...@@ -90,8 +90,8 @@ tests = [
{ {
explanation: 'EE views should map to respective spec', explanation: 'EE views should map to respective spec',
source: 'ee/app/views/admin/licenses/show.html.haml', source: 'ee/app/views/subscriptions/new.html.haml',
expected: ['ee/spec/views/admin/licenses/show.html.haml_spec.rb'] expected: ['ee/spec/views/subscriptions/new.html.haml_spec.rb']
}, },
{ {
......
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