Commit 9d232573 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '355732-mlunoe-update-license-type-names' into 'master'

Feat(License): update license type names

See merge request gitlab-org/gitlab!83611
parents 726ef151 f3dc3ec3
......@@ -108,7 +108,7 @@ export default {
return this.subscription.type === subscriptionTypes.ONLINE_CLOUD;
},
isLicenseFileType() {
return this.subscription.type === subscriptionTypes.LICENSE_FILE;
return this.subscription.type === subscriptionTypes.LEGACY_LICENSE;
},
shouldShowFooter() {
return (
......
......@@ -35,9 +35,9 @@ 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 licenseFileText = __('License file');
export const onlineCloudLicenseText = s__('SuperSonics|Cloud license');
export const offlineCloudLicenseText = s__('SuperSonics|Offline cloud');
export const licenseFileText = __('Legacy license');
export const onlineCloudLicenseText = s__('SuperSonics|Online license');
export const offlineCloudLicenseText = s__('SuperSonics|Offline license');
export const detailsLabels = {
address: __('Address'),
company: __('Company'),
......@@ -90,9 +90,9 @@ export const subscriptionSyncStatus = {
};
export const subscriptionTypes = {
ONLINE_CLOUD: 'cloud',
ONLINE_CLOUD: 'online_cloud',
OFFLINE_CLOUD: 'offline_cloud',
LICENSE_FILE: 'license_file',
LEGACY_LICENSE: 'legacy_license',
};
export const trialCard = {
......
......@@ -15,9 +15,9 @@ module Resolvers
subscription['type'] = if subscription['offline_cloud_licensing'] && subscription['cloud_license_enabled']
License::OFFLINE_CLOUD_TYPE
elsif subscription['cloud_license_enabled'] && !subscription['offline_cloud_licensing']
License::CLOUD_LICENSE_TYPE
License::ONLINE_CLOUD_TYPE
else
License::LICENSE_FILE_TYPE
License::LEGACY_LICENSE_TYPE
end
end
end
......
......@@ -11,9 +11,9 @@ class License < ApplicationRecord
STARTER_PLAN = 'starter'
PREMIUM_PLAN = 'premium'
ULTIMATE_PLAN = 'ultimate'
CLOUD_LICENSE_TYPE = 'cloud'
ONLINE_CLOUD_TYPE = 'online_cloud'
OFFLINE_CLOUD_TYPE = 'offline_cloud'
LICENSE_FILE_TYPE = 'license_file'
LEGACY_LICENSE_TYPE = 'legacy_license'
ALLOWED_PERCENTAGE_OF_USERS_OVERAGE = (10 / 100.0)
NOTIFICATION_DAYS_BEFORE_TRIAL_EXPIRY = 1.week
......@@ -339,9 +339,9 @@ class License < ApplicationRecord
def license_type
return OFFLINE_CLOUD_TYPE if offline_cloud_license?
return CLOUD_LICENSE_TYPE if online_cloud_license?
return ONLINE_CLOUD_TYPE if online_cloud_license?
LICENSE_FILE_TYPE
LEGACY_LICENSE_TYPE
end
def auto_renew
......
......@@ -217,7 +217,7 @@ RSpec.describe 'Admin views Subscription', :js do
it 'shows the appropriate license type' do
page.within(find('[data-testid="subscription-cell-type"]', match: :first)) do
expect(page).to have_content('Cloud license')
expect(page).to have_content('Online license')
end
end
end
......
......@@ -180,16 +180,16 @@ describe('Subscription Breakdown', () => {
describe('footer buttons', () => {
it.each`
url | type | shouldShow
${subscriptionSyncPath} | ${subscriptionTypes.ONLINE_CLOUD} | ${true}
${subscriptionSyncPath} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${subscriptionSyncPath} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${''} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${''} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${''} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${undefined} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.LICENSE_FILE} | ${false}
url | type | shouldShow
${subscriptionSyncPath} | ${subscriptionTypes.ONLINE_CLOUD} | ${true}
${subscriptionSyncPath} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${subscriptionSyncPath} | ${subscriptionTypes.LEGACY_LICENSE} | ${false}
${''} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${''} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${''} | ${subscriptionTypes.LEGACY_LICENSE} | ${false}
${undefined} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.LEGACY_LICENSE} | ${false}
`(
'with url is $url and type is $type the sync button is shown: $shouldShow',
({ url, type, shouldShow }) => {
......@@ -232,16 +232,16 @@ describe('Subscription Breakdown', () => {
});
it.each`
url | type | shouldShow
${licenseRemovePath} | ${subscriptionTypes.LICENSE_FILE} | ${true}
${licenseRemovePath} | ${subscriptionTypes.ONLINE_CLOUD} | ${true}
${licenseRemovePath} | ${subscriptionTypes.OFFLINE_CLOUD} | ${true}
${''} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${''} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${''} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.LICENSE_FILE} | ${false}
${undefined} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
url | type | shouldShow
${licenseRemovePath} | ${subscriptionTypes.LEGACY_LICENSE} | ${true}
${licenseRemovePath} | ${subscriptionTypes.ONLINE_CLOUD} | ${true}
${licenseRemovePath} | ${subscriptionTypes.OFFLINE_CLOUD} | ${true}
${''} | ${subscriptionTypes.LEGACY_LICENSE} | ${false}
${''} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${''} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.LEGACY_LICENSE} | ${false}
${undefined} | ${subscriptionTypes.ONLINE_CLOUD} | ${false}
${undefined} | ${subscriptionTypes.OFFLINE_CLOUD} | ${false}
`(
'with url is $url and type is $type the remove button is shown: $shouldShow',
({ url, type, shouldShow }) => {
......@@ -260,10 +260,10 @@ describe('Subscription Breakdown', () => {
);
it.each`
type | shouldShow
${subscriptionTypes.LICENSE_FILE} | ${true}
${subscriptionTypes.ONLINE_CLOUD} | ${false}
${subscriptionTypes.OFFLINE_CLOUD} | ${false}
type | shouldShow
${subscriptionTypes.LEGACY_LICENSE} | ${true}
${subscriptionTypes.ONLINE_CLOUD} | ${false}
${subscriptionTypes.OFFLINE_CLOUD} | ${false}
`(
'with url is $url and type is $type the activate cloud license button is shown: $shouldShow',
({ type, shouldShow }) => {
......
......@@ -65,7 +65,7 @@ describe('Subscription Details Card', () => {
},
{
detail: 'type',
value: 'Cloud license',
value: 'Online license',
},
{
detail: 'expiresAt',
......
......@@ -51,7 +51,7 @@ describe('Subscription Details History', () => {
it('has the correct license type', () => {
expect(findCurrentRow().text()).toContain(onlineCloudLicenseText);
expect(findTableRows().at(-1).text()).toContain('License file');
expect(findTableRows().at(-1).text()).toContain('Legacy license');
});
it('has a badge for the license type', () => {
......
......@@ -57,7 +57,7 @@ export const subscriptionPastHistory = [
name: 'Jane Doe',
plan: 'premium',
startsAt: '2020-03-16',
type: subscriptionTypes.LICENSE_FILE,
type: subscriptionTypes.LEGACY_LICENSE,
usersInLicenseCount: '5',
},
];
......@@ -144,9 +144,9 @@ export const activateLicenseMutationResponse = {
license: {
__typename: 'CurrentLicense',
id: 'gid://gitlab/License/3',
type: 'cloud',
type: 'online_cloud',
plan: 'ultimate',
name: 'Cloud License',
name: 'Online license',
email: 'user@example.com',
company: 'Example Inc',
startsAt: '2020-01-01',
......
......@@ -73,7 +73,7 @@ describe('utils', () => {
const typeLabels = {
OFFLINE_CLOUD: offlineCloudLicenseText,
ONLINE_CLOUD: onlineCloudLicenseText,
LICENSE_FILE: licenseFileText,
LEGACY_LICENSE: licenseFileText,
};
it.each(Object.keys(subscriptionTypes))('should return correct label for type', (key) => {
......
......@@ -57,7 +57,7 @@ RSpec.describe Resolvers::Admin::CloudLicenses::SubscriptionFutureEntriesResolve
expect(result).to match(
[
hash_including(
'type' => License::CLOUD_LICENSE_TYPE,
'type' => License::ONLINE_CLOUD_TYPE,
'plan' => 'ultimate',
'name' => 'User Example',
'email' => 'user@example.com',
......@@ -73,8 +73,8 @@ RSpec.describe Resolvers::Admin::CloudLicenses::SubscriptionFutureEntriesResolve
context 'cloud_license_enabled is false' do
let(:cloud_license_enabled) { false }
it 'returns type as license_file' do
expect(result.first).to include('type' => License::LICENSE_FILE_TYPE)
it 'returns type as legacy_license' do
expect(result.first).to include('type' => License::LEGACY_LICENSE_TYPE)
end
end
......
......@@ -38,7 +38,7 @@ RSpec.describe GitlabSchema.types['SubscriptionFutureEntry'], :enable_admin_mode
let_it_be(:subscription) do
{
'type' => License::CLOUD_LICENSE_TYPE,
'type' => License::ONLINE_CLOUD_TYPE,
'plan' => 'ultimate',
'name' => 'User Example',
'email' => 'user@example.com',
......@@ -54,7 +54,7 @@ RSpec.describe GitlabSchema.types['SubscriptionFutureEntry'], :enable_admin_mode
describe 'type' do
let(:field_name) { :type }
it { is_expected.to eq(License::CLOUD_LICENSE_TYPE) }
it { is_expected.to eq(License::ONLINE_CLOUD_TYPE) }
end
describe 'plan' do
......
......@@ -1548,13 +1548,13 @@ RSpec.describe License do
subject { license.license_type }
context 'when the license is not a cloud license' do
it { is_expected.to eq(described_class::LICENSE_FILE_TYPE) }
it { is_expected.to eq(described_class::LEGACY_LICENSE_TYPE) }
end
context 'when the license is an online cloud license' do
let(:gl_license) { build(:gitlab_license, cloud_licensing_enabled: true) }
it { is_expected.to eq(described_class::CLOUD_LICENSE_TYPE) }
it { is_expected.to eq(described_class::ONLINE_CLOUD_TYPE) }
end
context 'when the license is an offline cloud license' do
......
......@@ -54,7 +54,7 @@ RSpec.describe 'Activate a subscription' do
expect(mutation_response['license']).to eq(
{
'id' => "gid://gitlab/License/#{created_license.id}",
'type' => License::LICENSE_FILE_TYPE,
'type' => License::LEGACY_LICENSE_TYPE,
'plan' => created_license.plan,
'name' => created_license.licensee_name,
'email' => created_license.licensee_email,
......
......@@ -54,7 +54,7 @@ RSpec.shared_examples_for 'license type fields' do
describe 'type' do
let(:field_name) { :type }
it { is_expected.to eq(License::CLOUD_LICENSE_TYPE) }
it { is_expected.to eq(License::ONLINE_CLOUD_TYPE) }
end
describe 'plan' do
......
......@@ -22327,6 +22327,9 @@ msgstr ""
msgid "Legacy burndown chart"
msgstr ""
msgid "Legacy license"
msgstr ""
msgid "Less Details"
msgstr ""
......@@ -36499,9 +36502,6 @@ msgstr ""
msgid "SuperSonics|Buy subscription"
msgstr ""
msgid "SuperSonics|Cloud license"
msgstr ""
msgid "SuperSonics|Cloud licensing"
msgstr ""
......@@ -36535,7 +36535,10 @@ msgstr ""
msgid "SuperSonics|Maximum users"
msgstr ""
msgid "SuperSonics|Offline cloud"
msgid "SuperSonics|Offline license"
msgstr ""
msgid "SuperSonics|Online license"
msgstr ""
msgid "SuperSonics|Paste your activation code"
......
......@@ -27,7 +27,7 @@ module QA
expect(subscription.company).to include(company)
expect(subscription.plan).to eq(plan[:name].capitalize)
expect(subscription.users_in_subscription).to eq(user_count.to_s)
expect(subscription).to have_subscription_record(plan, user_count, LICENSE_TYPE[:cloud_license])
expect(subscription).to have_subscription_record(plan, user_count, LICENSE_TYPE[:online_cloud])
end
end
end
......
......@@ -23,7 +23,7 @@ module QA
expect(subscription.company).to include(company)
expect(subscription.plan).to eq(plan[:name].capitalize)
expect(subscription.users_in_subscription).to eq(user_count.to_s)
expect(subscription).to have_subscription_record(plan, user_count, LICENSE_TYPE[:license_file])
expect(subscription).to have_subscription_record(plan, user_count, LICENSE_TYPE[:legacy_license])
end
end
end
......
......@@ -57,8 +57,9 @@ module QA
}.freeze
LICENSE_TYPE = {
license_file: 'license file',
cloud_license: 'cloud license'
legacy_license: 'legacy license',
online_cloud: 'online license',
offline_cloud: 'offline license'
}.freeze
end
end
......
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