Commit 319af498 authored by Ammar Alakkad's avatar Ammar Alakkad Committed by Miguel Rincon

Replace legacy license with license file

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