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