Commit 098ee9d6 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch '331925-replace-legacy-with-file' into 'master'

Replace legacy license with license file

See merge request gitlab-org/gitlab!62680
parents 36520e30 319af498
<script> <script>
import { GlCard, GlLink, GlSprintf } from '@gitlab/ui'; import { GlCard, GlLink, GlSprintf } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
import { activateSubscription, howToActivateSubscription, uploadLegacyLicense } from '../constants'; import { activateSubscription, howToActivateSubscription, uploadLicenseFile } from '../constants';
import SubscriptionActivationErrors from './subscription_activation_errors.vue'; import SubscriptionActivationErrors from './subscription_activation_errors.vue';
import SubscriptionActivationForm from './subscription_activation_form.vue'; import SubscriptionActivationForm from './subscription_activation_form.vue';
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
i18n: { i18n: {
activateSubscription, activateSubscription,
howToActivateSubscription, howToActivateSubscription,
uploadLegacyLicense, uploadLicenseFile,
}, },
components: { components: {
GlCard, GlCard,
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
/> />
<template #footer> <template #footer>
<gl-link v-if="licenseUploadPath" data-testid="upload-license-link" :href="licenseUploadPath" <gl-link v-if="licenseUploadPath" data-testid="upload-license-link" :href="licenseUploadPath"
>{{ $options.i18n.uploadLegacyLicense }} >{{ $options.i18n.uploadLicenseFile }}
</gl-link> </gl-link>
</template> </template>
</gl-card> </gl-card>
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
removeLicense, removeLicense,
removeLicenseConfirm, removeLicenseConfirm,
subscriptionDetailsHeaderText, subscriptionDetailsHeaderText,
subscriptionType, subscriptionTypes,
syncSubscriptionButtonText, syncSubscriptionButtonText,
uploadLicense, uploadLicense,
} from '../constants'; } from '../constants';
...@@ -76,10 +76,10 @@ export default { ...@@ -76,10 +76,10 @@ export default {
return this.subscriptionSyncPath && this.isCloudType; return this.subscriptionSyncPath && this.isCloudType;
}, },
canUploadLicense() { canUploadLicense() {
return this.licenseUploadPath && this.isLegacyType; return this.licenseUploadPath && this.isLicenseFileType;
}, },
canRemoveLicense() { canRemoveLicense() {
return this.licenseRemovePath && this.isLegacyType; return this.licenseRemovePath && this.isLicenseFileType;
}, },
hasSubscription() { hasSubscription() {
return Boolean(Object.keys(this.subscription).length); return Boolean(Object.keys(this.subscription).length);
...@@ -88,10 +88,10 @@ export default { ...@@ -88,10 +88,10 @@ export default {
return Boolean(this.subscriptionList.length); return Boolean(this.subscriptionList.length);
}, },
isCloudType() { isCloudType() {
return this.subscription.type === subscriptionType.CLOUD; return this.subscription.type === subscriptionTypes.CLOUD;
}, },
isLegacyType() { isLicenseFileType() {
return this.subscription.type === subscriptionType.LEGACY; return this.subscription.type === subscriptionTypes.LICENSE_FILE;
}, },
shouldShowFooter() { shouldShowFooter() {
return ( return (
......
...@@ -2,8 +2,13 @@ ...@@ -2,8 +2,13 @@
import { GlBadge, GlTable } from '@gitlab/ui'; import { GlBadge, GlTable } from '@gitlab/ui';
import { kebabCase } from 'lodash'; import { kebabCase } from 'lodash';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import sprintf from '~/locale/sprintf'; import {
import { detailsLabels, subscriptionTable, subscriptionTypeText } from '../constants'; cloudLicenseText,
detailsLabels,
licenseFileText,
subscriptionTable,
subscriptionTypes,
} from '../constants';
const DEFAULT_BORDER_CLASSES = 'gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid!'; const DEFAULT_BORDER_CLASSES = 'gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid!';
const DEFAULT_TH_CLASSES = 'gl-bg-white! gl-border-t-0! gl-pb-5! gl-px-5! gl-text-gray-700!'; const DEFAULT_TH_CLASSES = 'gl-bg-white! gl-border-t-0! gl-pb-5! gl-px-5! gl-text-gray-700!';
...@@ -96,7 +101,7 @@ export default { ...@@ -96,7 +101,7 @@ export default {
{ {
key: 'type', key: 'type',
formatter: (v, k, item) => formatter: (v, k, item) =>
sprintf(subscriptionTypeText, { type: capitalizeFirstCharacter(item.type) }), item.type === subscriptionTypes.LICENSE_FILE ? licenseFileText : cloudLicenseText,
label: subscriptionTable.type, label: subscriptionTable.type,
tdAttr, tdAttr,
tdClass: this.cellClass, tdClass: this.cellClass,
......
...@@ -23,7 +23,8 @@ export const licensedToHeaderText = s__('SuperSonics|Licensed to'); ...@@ -23,7 +23,8 @@ export const licensedToHeaderText = s__('SuperSonics|Licensed to');
export const manageSubscriptionButtonText = s__('SuperSonics|Manage'); export const manageSubscriptionButtonText = s__('SuperSonics|Manage');
export const syncSubscriptionButtonText = s__('SuperSonics|Sync subscription details'); export const syncSubscriptionButtonText = s__('SuperSonics|Sync subscription details');
export const copySubscriptionIdButtonText = __('Copy'); export const copySubscriptionIdButtonText = __('Copy');
export const subscriptionTypeText = __('%{type} License'); export const licenseFileText = __('License file');
export const cloudLicenseText = __('SuperSonics|Cloud license');
export const usersInSubscriptionUnlimited = __('Unlimited'); export const usersInSubscriptionUnlimited = __('Unlimited');
export const detailsLabels = { export const detailsLabels = {
address: __('Address'), address: __('Address'),
...@@ -40,7 +41,7 @@ export const detailsLabels = { ...@@ -40,7 +41,7 @@ export const detailsLabels = {
export const removeLicense = __('Remove license'); export const removeLicense = __('Remove license');
export const removeLicenseConfirm = __('Are you sure you want to remove the license?'); export const removeLicenseConfirm = __('Are you sure you want to remove the license?');
export const uploadLicense = __('Upload license'); export const uploadLicense = __('Upload license');
export const uploadLegacyLicense = s__('SuperSonics|Upload a legacy license'); export const uploadLicenseFile = s__('SuperSonics|Upload a license file');
export const billableUsersTitle = s__('SuperSonics|Billable users'); export const billableUsersTitle = s__('SuperSonics|Billable users');
export const maximumUsersTitle = s__('SuperSonics|Maximum users'); export const maximumUsersTitle = s__('SuperSonics|Maximum users');
export const usersInSubscriptionTitle = s__('SuperSonics|Users in subscription'); export const usersInSubscriptionTitle = s__('SuperSonics|Users in subscription');
...@@ -85,9 +86,9 @@ export const subscriptionSyncStatus = { ...@@ -85,9 +86,9 @@ export const subscriptionSyncStatus = {
SYNC_FAILURE: 'SYNC_FAILURE', SYNC_FAILURE: 'SYNC_FAILURE',
SYNC_SUCCESS: 'SYNC_SUCCESS', SYNC_SUCCESS: 'SYNC_SUCCESS',
}; };
export const subscriptionType = { export const subscriptionTypes = {
CLOUD: 'cloud', CLOUD: 'cloud',
LEGACY: 'legacy', LICENSE_FILE: 'legacy',
}; };
export const subscriptionQueries = { export const subscriptionQueries = {
......
...@@ -117,10 +117,10 @@ RSpec.describe 'Admin views Cloud License', :js do ...@@ -117,10 +117,10 @@ RSpec.describe 'Admin views Cloud License', :js do
end end
end end
context 'Upload Legacy License' do context 'Upload a legacy license' do
it 'shows a link to upload a legacy license' do it 'shows a link to upload a license file' do
page.within(find('#content-body', match: :first)) do page.within(find('#content-body', match: :first)) do
expect(page).to have_link('Upload a legacy license', href: new_admin_license_path) expect(page).to have_link('Upload a license file', href: new_admin_license_path)
end end
end end
end end
......
...@@ -7,7 +7,7 @@ import SubscriptionActivationErrors from 'ee/pages/admin/cloud_licenses/componen ...@@ -7,7 +7,7 @@ import SubscriptionActivationErrors from 'ee/pages/admin/cloud_licenses/componen
import SubscriptionActivationForm, { import SubscriptionActivationForm, {
SUBSCRIPTION_ACTIVATION_FAILURE_EVENT, SUBSCRIPTION_ACTIVATION_FAILURE_EVENT,
} from 'ee/pages/admin/cloud_licenses/components/subscription_activation_form.vue'; } from 'ee/pages/admin/cloud_licenses/components/subscription_activation_form.vue';
import { CONNECTIVITY_ERROR } from 'ee/pages/admin/cloud_licenses/constants'; import { CONNECTIVITY_ERROR, uploadLicenseFile } from 'ee/pages/admin/cloud_licenses/constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
describe('CloudLicenseApp', () => { describe('CloudLicenseApp', () => {
...@@ -57,7 +57,7 @@ describe('CloudLicenseApp', () => { ...@@ -57,7 +57,7 @@ describe('CloudLicenseApp', () => {
}); });
it('shows a link when provided', () => { it('shows a link when provided', () => {
expect(findUploadLink().text()).toBe('Upload a legacy license'); expect(findUploadLink().text()).toBe(uploadLicenseFile);
}); });
it('shows an help link', () => { it('shows an help link', () => {
......
...@@ -18,7 +18,7 @@ import { ...@@ -18,7 +18,7 @@ import {
licensedToHeaderText, licensedToHeaderText,
subscriptionSyncStatus, subscriptionSyncStatus,
subscriptionDetailsHeaderText, subscriptionDetailsHeaderText,
subscriptionType, subscriptionTypes,
} from 'ee/pages/admin/cloud_licenses/constants'; } from 'ee/pages/admin/cloud_licenses/constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
...@@ -30,7 +30,7 @@ describe('Subscription Breakdown', () => { ...@@ -30,7 +30,7 @@ describe('Subscription Breakdown', () => {
let wrapper; let wrapper;
let glModalDirective; let glModalDirective;
const [, legacyLicense] = subscriptionHistory; const [, licenseFile] = subscriptionHistory;
const connectivityHelpURL = 'connectivity/help/url'; const connectivityHelpURL = 'connectivity/help/url';
const customersPortalUrl = 'customers.dot'; const customersPortalUrl = 'customers.dot';
const licenseRemovePath = '/license/remove/'; const licenseRemovePath = '/license/remove/';
...@@ -154,12 +154,12 @@ describe('Subscription Breakdown', () => { ...@@ -154,12 +154,12 @@ describe('Subscription Breakdown', () => {
describe('footer buttons', () => { describe('footer buttons', () => {
it.each` it.each`
url | type | shouldShow url | type | shouldShow
${subscriptionSyncPath} | ${subscriptionType.CLOUD} | ${true} ${subscriptionSyncPath} | ${subscriptionTypes.CLOUD} | ${true}
${subscriptionSyncPath} | ${subscriptionType.LEGACY} | ${false} ${subscriptionSyncPath} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${''} | ${subscriptionType.CLOUD} | ${false} ${''} | ${subscriptionTypes.CLOUD} | ${false}
${''} | ${subscriptionType.LEGACY} | ${false} ${''} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${undefined} | ${subscriptionType.CLOUD} | ${false} ${undefined} | ${subscriptionTypes.CLOUD} | ${false}
${undefined} | ${subscriptionType.LEGACY} | ${false} ${undefined} | ${subscriptionTypes.LICENSE_FILE} | ${false}
`( `(
'with url is $url and type is $type the sync button is shown: $shouldShow', 'with url is $url and type is $type the sync button is shown: $shouldShow',
({ url, type, shouldShow }) => { ({ url, type, shouldShow }) => {
...@@ -180,12 +180,12 @@ describe('Subscription Breakdown', () => { ...@@ -180,12 +180,12 @@ describe('Subscription Breakdown', () => {
it.each` it.each`
url | type | shouldShow url | type | shouldShow
${licenseUploadPath} | ${subscriptionType.LEGACY} | ${true} ${licenseUploadPath} | ${subscriptionTypes.LICENSE_FILE} | ${true}
${licenseUploadPath} | ${subscriptionType.CLOUD} | ${false} ${licenseUploadPath} | ${subscriptionTypes.CLOUD} | ${false}
${''} | ${subscriptionType.LEGACY} | ${false} ${''} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${''} | ${subscriptionType.CLOUD} | ${false} ${''} | ${subscriptionTypes.CLOUD} | ${false}
${undefined} | ${subscriptionType.LEGACY} | ${false} ${undefined} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${undefined} | ${subscriptionType.CLOUD} | ${false} ${undefined} | ${subscriptionTypes.CLOUD} | ${false}
`( `(
'with url is $url and type is $type the upload button is shown: $shouldShow', 'with url is $url and type is $type the upload button is shown: $shouldShow',
({ url, type, shouldShow }) => { ({ url, type, shouldShow }) => {
...@@ -225,12 +225,12 @@ describe('Subscription Breakdown', () => { ...@@ -225,12 +225,12 @@ describe('Subscription Breakdown', () => {
it.each` it.each`
url | type | shouldShow url | type | shouldShow
${licenseRemovePath} | ${subscriptionType.LEGACY} | ${true} ${licenseRemovePath} | ${subscriptionTypes.LICENSE_FILE} | ${true}
${licenseRemovePath} | ${subscriptionType.CLOUD} | ${false} ${licenseRemovePath} | ${subscriptionTypes.CLOUD} | ${false}
${''} | ${subscriptionType.LEGACY} | ${false} ${''} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${''} | ${subscriptionType.CLOUD} | ${false} ${''} | ${subscriptionTypes.CLOUD} | ${false}
${undefined} | ${subscriptionType.LEGACY} | ${false} ${undefined} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${undefined} | ${subscriptionType.CLOUD} | ${false} ${undefined} | ${subscriptionTypes.CLOUD} | ${false}
`( `(
'with url is $url and type is $type the remove button is shown: $shouldShow', 'with url is $url and type is $type the remove button is shown: $shouldShow',
({ url, type, shouldShow }) => { ({ url, type, shouldShow }) => {
...@@ -250,10 +250,10 @@ describe('Subscription Breakdown', () => { ...@@ -250,10 +250,10 @@ describe('Subscription Breakdown', () => {
); );
}); });
describe('with a legacy license', () => { describe('with a license file', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
props: { subscription: legacyLicense }, props: { subscription: licenseFile },
stubs: { GlCard, SubscriptionDetailsCard }, stubs: { GlCard, SubscriptionDetailsCard },
}); });
}); });
......
import { GlBadge } from '@gitlab/ui'; import { GlBadge } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import SubscriptionDetailsHistory from 'ee/pages/admin/cloud_licenses/components/subscription_details_history.vue'; import SubscriptionDetailsHistory from 'ee/pages/admin/cloud_licenses/components/subscription_details_history.vue';
import { cloudLicenseText } from 'ee/pages/admin/cloud_licenses/constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { license, subscriptionHistory } from '../mock_data'; import { license, subscriptionHistory } from '../mock_data';
...@@ -42,8 +43,8 @@ describe('Subscription Details History', () => { ...@@ -42,8 +43,8 @@ describe('Subscription Details History', () => {
}); });
it('has the correct license type', () => { it('has the correct license type', () => {
expect(findCurrentRow().text()).toContain('Cloud License'); expect(findCurrentRow().text()).toContain(cloudLicenseText);
expect(findTableRows().at(0).text()).toContain('Legacy License'); expect(findTableRows().at(0).text()).toContain('License file');
}); });
it('has a badge for the license type', () => { it('has a badge for the license type', () => {
...@@ -82,7 +83,7 @@ describe('Subscription Details History', () => { ...@@ -82,7 +83,7 @@ describe('Subscription Details History', () => {
it('displays the correct value for the type cell', () => { it('displays the correct value for the type cell', () => {
const cellTestId = `subscription-cell-type`; const cellTestId = `subscription-cell-type`;
expect(findCellByTestid(cellTestId).text()).toBe('Cloud License'); expect(findCellByTestid(cellTestId).text()).toBe(cloudLicenseText);
}); });
it('displays the correct value for the plan cell', () => { it('displays the correct value for the plan cell', () => {
......
import { CONNECTIVITY_ERROR, subscriptionType } from 'ee/pages/admin/cloud_licenses/constants'; import { CONNECTIVITY_ERROR, subscriptionTypes } from 'ee/pages/admin/cloud_licenses/constants';
export const license = { export const license = {
ULTIMATE: { ULTIMATE: {
...@@ -13,7 +13,7 @@ export const license = { ...@@ -13,7 +13,7 @@ export const license = {
name: 'Jane Doe', name: 'Jane Doe',
plan: 'ultimate', plan: 'ultimate',
startsAt: '2021-03-11', startsAt: '2021-03-11',
type: subscriptionType.CLOUD, type: subscriptionTypes.CLOUD,
usersInLicenseCount: '10', usersInLicenseCount: '10',
usersOverLicenseCount: '0', usersOverLicenseCount: '0',
}, },
...@@ -29,7 +29,7 @@ export const subscriptionHistory = [ ...@@ -29,7 +29,7 @@ export const subscriptionHistory = [
name: 'Jane Doe', name: 'Jane Doe',
plan: 'ultimate', plan: 'ultimate',
startsAt: '2021-03-11', startsAt: '2021-03-11',
type: subscriptionType.CLOUD, type: subscriptionTypes.CLOUD,
usersInLicenseCount: '10', usersInLicenseCount: '10',
}, },
{ {
...@@ -41,7 +41,7 @@ export const subscriptionHistory = [ ...@@ -41,7 +41,7 @@ export const subscriptionHistory = [
name: 'Jane Doe', name: 'Jane Doe',
plan: 'premium', plan: 'premium',
startsAt: '2020-03-16', startsAt: '2020-03-16',
type: subscriptionType.LEGACY, type: subscriptionTypes.LICENSE_FILE,
usersInLicenseCount: '5', usersInLicenseCount: '5',
}, },
]; ];
......
...@@ -960,9 +960,6 @@ msgstr "" ...@@ -960,9 +960,6 @@ msgstr ""
msgid "%{total} warnings found: showing first %{warningsDisplayed}" msgid "%{total} warnings found: showing first %{warningsDisplayed}"
msgstr "" msgstr ""
msgid "%{type} License"
msgstr ""
msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc." msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc."
msgstr "" msgstr ""
...@@ -19599,6 +19596,9 @@ msgstr "" ...@@ -19599,6 +19596,9 @@ msgstr ""
msgid "License ID:" msgid "License ID:"
msgstr "" msgstr ""
msgid "License file"
msgstr ""
msgid "License overview" msgid "License overview"
msgstr "" msgstr ""
...@@ -31671,6 +31671,9 @@ msgstr "" ...@@ -31671,6 +31671,9 @@ msgstr ""
msgid "SuperSonics|Buy subscription" msgid "SuperSonics|Buy subscription"
msgstr "" msgstr ""
msgid "SuperSonics|Cloud license"
msgstr ""
msgid "SuperSonics|Enter activation code" msgid "SuperSonics|Enter activation code"
msgstr "" msgstr ""
...@@ -31758,7 +31761,7 @@ msgstr "" ...@@ -31758,7 +31761,7 @@ msgstr ""
msgid "SuperSonics|Type" msgid "SuperSonics|Type"
msgstr "" msgstr ""
msgid "SuperSonics|Upload a legacy license" msgid "SuperSonics|Upload a license file"
msgstr "" msgstr ""
msgid "SuperSonics|Users in subscription" msgid "SuperSonics|Users in subscription"
......
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