From a19e7402891a05e9e076efee74e5fd1507928415 Mon Sep 17 00:00:00 2001 From: Lukas Wanko <lwanko@gitlab.com> Date: Fri, 28 Feb 2025 18:55:05 +0100 Subject: [PATCH] Refactoring of Duo UI components before adding Duo with Amazon Q EE: True --- .../duo_seat_utilization_info_card.vue | 13 +++----- .../components/add_on_eligible_user_list.vue | 16 ++++----- .../code_suggestions_addon_assignment.vue | 20 +++-------- .../components/code_suggestions_info_card.vue | 23 ++++++++----- .../components/code_suggestions_usage.vue | 23 ++++++------- ...code_suggestions_usage_statistics_card.vue | 12 +++---- .../saas_add_on_eligible_user_list.vue | 12 +++---- ...self_managed_add_on_eligible_user_list.vue | 12 +++---- .../code_suggestions/constants.js | 33 ++++++++++++++----- .../duo_seat_utilization_info_card_spec.js | 11 ++----- .../ai/settings/pages/gitlab_duo_home_spec.js | 3 +- .../add_on_eligible_user_list_spec.js | 21 +++++------- .../code_suggestions_addon_assignment_spec.js | 24 +++++--------- .../code_suggestions_info_card_spec.js | 29 ++++++++-------- .../components/code_suggestions_usage_spec.js | 33 +++++++++---------- ..._suggestions_usage_statistics_card_spec.js | 5 +-- .../saas_add_on_eligible_user_list_spec.js | 6 ++-- ...mananged_add_on_eligible_user_list_spec.js | 6 ++-- .../code_suggestions/mock_data.js | 17 ++++------ locale/gitlab.pot | 6 ++++ 20 files changed, 153 insertions(+), 172 deletions(-) diff --git a/ee/app/assets/javascripts/ai/settings/components/duo_seat_utilization_info_card.vue b/ee/app/assets/javascripts/ai/settings/components/duo_seat_utilization_info_card.vue index a71e6dac2466e..eb4e3a7325c90 100644 --- a/ee/app/assets/javascripts/ai/settings/components/duo_seat_utilization_info_card.vue +++ b/ee/app/assets/javascripts/ai/settings/components/duo_seat_utilization_info_card.vue @@ -2,12 +2,7 @@ import { GlCard, GlButton, GlIcon } from '@gitlab/ui'; import { s__, __ } from '~/locale'; import UsageStatistics from 'ee/usage_quotas/components/usage_statistics.vue'; -import { - DUO_PRO, - DUO_ENTERPRISE, - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE_TITLE, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_PRO, DUO_IDENTIFIERS, DUO_TITLES } from 'ee/usage_quotas/code_suggestions/constants'; import { InternalEvents } from '~/tracking'; import { formatDate } from '~/lib/utils/datetime_utility'; @@ -43,8 +38,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (val) => [DUO_PRO, DUO_ENTERPRISE].includes(val), + default: DUO_IDENTIFIERS[0], + validator: (val) => DUO_IDENTIFIERS.includes(val), }, }, computed: { @@ -52,7 +47,7 @@ export default { return Math.floor((this.usageValue / this.totalValue) * 100); }, duoTitle() { - return this.duoTier === DUO_ENTERPRISE ? DUO_ENTERPRISE_TITLE : CODE_SUGGESTIONS_TITLE; + return DUO_TITLES[this.duoTier]; }, isDuoPro() { return this.duoTier === DUO_PRO; diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/add_on_eligible_user_list.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/add_on_eligible_user_list.vue index b6e2381058a4f..7e855d402c7f7 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/add_on_eligible_user_list.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/add_on_eligible_user_list.vue @@ -28,8 +28,8 @@ import PageSizeSelector from '~/vue_shared/components/page_size_selector.vue'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import * as Sentry from '~/sentry/sentry_browser_wrapper'; import { - DUO_PRO, - DUO_ENTERPRISE, + DUO_ADD_ONS, + DUO_IDENTIFIERS, addOnEligibleUserListTableFields, ASSIGN_SEATS_BULK_ACTION, UNASSIGN_SEATS_BULK_ACTION, @@ -113,8 +113,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (val) => [DUO_PRO, DUO_ENTERPRISE].includes(val), + default: DUO_IDENTIFIERS[0], + validator: (val) => DUO_IDENTIFIERS.includes(val), }, }, i18n: { @@ -178,14 +178,14 @@ export default { } return s__('Billing|No users to display.'); }, - duoPlan() { - return this.duoTier === DUO_ENTERPRISE ? 'duoEnterpriseAddon' : 'codeSuggestionsAddon'; + duoAddOn() { + return DUO_ADD_ONS[this.duoTier]; }, tableFieldsConfiguration() { - let fieldConfig = ['user', this.duoPlan, 'emailWide', 'lastActivityTimeWide']; + let fieldConfig = ['user', this.duoAddOn, 'emailWide', 'lastActivityTimeWide']; if (this.isFilteringEnabled && this.hasMaxRoleField) { - fieldConfig = ['user', this.duoPlan, 'email', 'maxRole', 'lastActivityTime']; + fieldConfig = ['user', this.duoAddOn, 'email', 'maxRole', 'lastActivityTime']; } if (this.isBulkAddOnAssignmentEnabled) { diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment.vue index 7256a117d7959..862d6b02edcd5 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment.vue @@ -2,14 +2,7 @@ import { GlToggle } from '@gitlab/ui'; import * as Sentry from '~/sentry/sentry_browser_wrapper'; import { s__, sprintf } from '~/locale'; -import { - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE, - DUO_ENTERPRISE_TITLE, - DUO_PRO, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_TITLES, DUO_IDENTIFIERS } from 'ee/usage_quotas/code_suggestions/constants'; import { CANNOT_ASSIGN_ADDON_ERROR_CODE, CANNOT_UNASSIGN_ADDON_ERROR_CODE, @@ -45,8 +38,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (value) => [DUO_PRO, DUO_ENTERPRISE].includes(value), + default: DUO_IDENTIFIERS[0], + validator: (value) => DUO_IDENTIFIERS.includes(value), }, }, data() { @@ -59,13 +52,10 @@ export default { isAssigned() { return Boolean( this.addOnAssignments?.find( - (assignment) => assignment.addOnPurchase?.name === this.duoPlan, + (assignment) => assignment.addOnPurchase?.name === this.duoTier, ), ); }, - duoPlan() { - return this.duoTier === DUO_ENTERPRISE ? ADD_ON_DUO_ENTERPRISE : ADD_ON_CODE_SUGGESTIONS; - }, addOnAssignmentQueryVariables() { return { userId: this.userId, @@ -74,7 +64,7 @@ export default { }, toggleLabel() { return sprintf(s__('CodeSuggestions|%{addOnName} status'), { - addOnName: this.duoTier === DUO_ENTERPRISE ? DUO_ENTERPRISE_TITLE : CODE_SUGGESTIONS_TITLE, + addOnName: DUO_TITLES[this.duoTier], }); }, }, diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue index 9093324921dee..a2b342430a4de 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue @@ -12,8 +12,10 @@ import * as Sentry from '~/sentry/sentry_browser_wrapper'; import { s__, __ } from '~/locale'; import UsageStatistics from 'ee/usage_quotas/components/usage_statistics.vue'; import { - DUO_PRO, + DUO_CSS_IDENTIFIERS, + DUO_IDENTIFIERS, DUO_ENTERPRISE, + DUO_PRO, codeSuggestionsLearnMoreLink, } from 'ee/usage_quotas/code_suggestions/constants'; import HandRaiseLeadButton from 'ee/hand_raise_leads/hand_raise_lead/components/hand_raise_lead_button.vue'; @@ -78,8 +80,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (val) => [DUO_PRO, DUO_ENTERPRISE].includes(val), + default: DUO_IDENTIFIERS[0], + validator: (val) => DUO_IDENTIFIERS.includes(val), }, }, data() { @@ -141,16 +143,19 @@ export default { isDuoPro() { return this.duoTier === DUO_PRO; }, + duoIdentifier() { + return DUO_CSS_IDENTIFIERS[this.duoTier]; + }, pageViewLabel() { return this.duoAddOnIsTrial - ? `duo_${this.duoTier}_add_on_tab_active_trial` - : `duo_${this.duoTier}_add_on_tab`; + ? `${this.duoIdentifier}_add_on_tab_active_trial` + : `${this.duoIdentifier}_add_on_tab`; }, handRaiseLeadBtnTracking() { return { category: 'groups:usage_quotas:index', action: 'click_button', - label: `duo_${this.duoTier}_contact_sales`, + label: `${this.duoIdentifier}_contact_sales`, }; }, trialHandRaiseLeadAttributes() { @@ -221,7 +226,7 @@ export default { methods: { handleAddDuoProClick() { this.trackEvent('click_add_seats_button_group_duo_usage_page', { - label: `add_duo_${this.duoTier}_${this.trackingPreffix}`, + label: `add_${this.duoIdentifier}_${this.trackingPreffix}`, property: 'usage_quotas_page', }); }, @@ -238,7 +243,7 @@ export default { this.trackEvent( 'click_purchase_seats_button_group_duo_usage_page', { - label: `duo_${this.duoTier}_purchase_seats`, + label: `${this.duoIdentifier}_purchase_seats`, }, 'groups:usage_quotas:index', ); @@ -249,7 +254,7 @@ export default { this.trackEvent( 'click_marketing_link_group_duo_usage_page', { - label: `duo_${this.duoTier}_marketing_page`, + label: `${this.duoIdentifier}_marketing_page`, }, 'groups:usage_quotas:index', ); diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue index c84999292f024..0e9e0c98e40fb 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue @@ -9,12 +9,10 @@ import getAddOnPurchasesQuery from 'ee/usage_quotas/add_on/graphql/get_add_on_pu import getCurrentLicense from 'ee/admin/subscriptions/show/graphql/queries/get_current_license.query.graphql'; import { - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, DUO_ENTERPRISE, DUO_PRO, - DUO_ENTERPRISE_TITLE, - CODE_SUGGESTIONS_TITLE, + DUO_TITLES, + DUO_BADGE_TITLES, } from 'ee/usage_quotas/code_suggestions/constants'; import { @@ -130,7 +128,7 @@ export default { ); }, duoTier() { - return this.addOnPurchase?.name === ADD_ON_DUO_ENTERPRISE ? DUO_ENTERPRISE : DUO_PRO; + return this.addOnPurchase?.name || DUO_PRO; }, shouldForceHideTitle() { if (isBoolean(this.forceHideTitle)) { @@ -153,10 +151,13 @@ export default { const message = this.isSaaS ? s__('CodeSuggestions|Manage seat assignments for %{addOnName} within your group.') : s__('CodeSuggestions|Manage seat assignments for %{addOnName}.'); - return sprintf(message, { addOnName: this.codeSuggestionsFriendlyName }); + return sprintf(message, { addOnName: this.duoTitle }); }, - codeSuggestionsFriendlyName() { - return this.duoTier === DUO_ENTERPRISE ? DUO_ENTERPRISE_TITLE : CODE_SUGGESTIONS_TITLE; + duoTitle() { + return DUO_TITLES[this.duoTier]; + }, + duoBadgeTitle() { + return DUO_BADGE_TITLES[this.duoTier]; }, activationListeners() { return { @@ -174,8 +175,8 @@ export default { return ( // Prioritize Duo Enterprise add-on over Duo Pro if both are available to the namespace. // For example, a namespace can have a Duo Pro add-on but also a Duo Enterprise trial add-on. - addOnPurchases?.find((addOnPurchase) => addOnPurchase.name === ADD_ON_DUO_ENTERPRISE) || - addOnPurchases?.find((addOnPurchase) => addOnPurchase.name === ADD_ON_CODE_SUGGESTIONS) + addOnPurchases?.find((addOnPurchase) => addOnPurchase.name === DUO_ENTERPRISE) || + addOnPurchases?.find((addOnPurchase) => addOnPurchase.name === DUO_PRO) ); }, error(error) { @@ -273,7 +274,7 @@ export default { <template #heading> <span class="gl-flex gl-items-center gl-gap-3"> <span data-testid="code-suggestions-title">{{ title }}</span> - <gl-badge variant="tier" icon="license" class="gl-capitalize">{{ duoTier }}</gl-badge> + <gl-badge variant="tier" icon="license">{{ duoBadgeTitle }}</gl-badge> </span> </template> diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card.vue index bc848146e41c1..6ffe909546316 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card.vue @@ -3,11 +3,9 @@ import { GlCard } from '@gitlab/ui'; import { s__ } from '~/locale'; import UsageStatistics from 'ee/usage_quotas/components/usage_statistics.vue'; import { - DUO_PRO, - DUO_ENTERPRISE, codeSuggestionsLearnMoreLink, - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE_TITLE, + DUO_IDENTIFIERS, + DUO_TITLES, } from 'ee/usage_quotas/code_suggestions/constants'; export default { @@ -37,8 +35,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (val) => [DUO_PRO, DUO_ENTERPRISE].includes(val), + default: DUO_IDENTIFIERS[0], + validator: (val) => DUO_IDENTIFIERS.includes(val), }, }, computed: { @@ -49,7 +47,7 @@ export default { return Boolean(this.totalValue) && this.percentage >= 0; }, duoTitle() { - return this.duoTier === DUO_ENTERPRISE ? DUO_ENTERPRISE_TITLE : CODE_SUGGESTIONS_TITLE; + return DUO_TITLES[this.duoTier]; }, }, }; diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue index 9af22bb9538a7..f09948c764a2d 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue @@ -18,10 +18,7 @@ import { import ErrorAlert from 'ee/vue_shared/components/error_alert/error_alert.vue'; import AddOnEligibleUserList from 'ee/usage_quotas/code_suggestions/components/add_on_eligible_user_list.vue'; import { - DUO_PRO, - DUO_ENTERPRISE, - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, + DUO_IDENTIFIERS, SORT_OPTIONS, DEFAULT_SORT_OPTION, } from 'ee/usage_quotas/code_suggestions/constants'; @@ -49,8 +46,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (val) => [DUO_PRO, DUO_ENTERPRISE].includes(val), + default: DUO_IDENTIFIERS[0], + validator: (val) => DUO_IDENTIFIERS.includes(val), }, }, addOnErrorDictionary: ADD_ON_ERROR_DICTIONARY, @@ -115,8 +112,7 @@ export default { queryVariables() { return { fullPath: this.fullPath, - addOnType: - this.duoTier === DUO_ENTERPRISE ? ADD_ON_DUO_ENTERPRISE : ADD_ON_CODE_SUGGESTIONS, + addOnType: this.duoTier, addOnPurchaseIds: [this.addOnPurchaseId], sort: this.sort, ...this.filterOptions, diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/self_managed_add_on_eligible_user_list.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/self_managed_add_on_eligible_user_list.vue index 51dff0c8493cd..1dd8d02665508 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/self_managed_add_on_eligible_user_list.vue +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/self_managed_add_on_eligible_user_list.vue @@ -12,10 +12,7 @@ import { import ErrorAlert from 'ee/vue_shared/components/error_alert/error_alert.vue'; import AddOnEligibleUserList from 'ee/usage_quotas/code_suggestions/components/add_on_eligible_user_list.vue'; import { - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, - DUO_PRO, - DUO_ENTERPRISE, + DUO_IDENTIFIERS, SORT_OPTIONS, DEFAULT_SORT_OPTION, } from 'ee/usage_quotas/code_suggestions/constants'; @@ -43,8 +40,8 @@ export default { duoTier: { type: String, required: false, - default: DUO_PRO, - validator: (value) => [DUO_PRO, DUO_ENTERPRISE].includes(value), + default: DUO_IDENTIFIERS[0], + validator: (value) => DUO_IDENTIFIERS.includes(value), }, }, addOnErrorDictionary: ADD_ON_ERROR_DICTIONARY, @@ -90,8 +87,7 @@ export default { }, queryVariables() { return { - addOnType: - this.duoTier === DUO_ENTERPRISE ? ADD_ON_DUO_ENTERPRISE : ADD_ON_CODE_SUGGESTIONS, + addOnType: this.duoTier, addOnPurchaseIds: [this.addOnPurchaseId], sort: this.sort, ...this.filterOptions, diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/constants.js b/ee/app/assets/javascripts/usage_quotas/code_suggestions/constants.js index 87867bfbca125..fefd38e8646fe 100644 --- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/constants.js +++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/constants.js @@ -1,14 +1,31 @@ import { PROMO_URL } from '~/constants'; import { __, s__ } from '~/locale'; -export const DUO_PRO = 'pro'; -export const DUO_ENTERPRISE = 'enterprise'; -export const ADD_ON_CODE_SUGGESTIONS = 'CODE_SUGGESTIONS'; -export const ADD_ON_DUO_ENTERPRISE = 'DUO_ENTERPRISE'; +export const DUO_PRO = 'CODE_SUGGESTIONS'; +export const DUO_ENTERPRISE = 'DUO_ENTERPRISE'; +export const DUO_IDENTIFIERS = [DUO_PRO, DUO_ENTERPRISE]; + export const codeSuggestionsLearnMoreLink = `${PROMO_URL}/gitlab-duo/`; -export const CODE_SUGGESTIONS_TITLE = s__('CodeSuggestions|GitLab Duo Pro'); -export const DUO_ENTERPRISE_TITLE = s__('CodeSuggestions|GitLab Duo Enterprise'); +export const DUO_TITLES = { + [DUO_PRO]: s__('CodeSuggestions|GitLab Duo Pro'), + [DUO_ENTERPRISE]: s__('CodeSuggestions|GitLab Duo Enterprise'), +}; + +export const DUO_BADGE_TITLES = { + [DUO_PRO]: s__('CodeSuggestions|Pro'), + [DUO_ENTERPRISE]: s__('CodeSuggestions|Enterprise'), +}; + +export const DUO_ADD_ONS = { + [DUO_PRO]: 'codeSuggestionsAddon', + [DUO_ENTERPRISE]: 'duoEnterpriseAddon', +}; + +export const DUO_CSS_IDENTIFIERS = { + [DUO_PRO]: 'duo_pro', + [DUO_ENTERPRISE]: 'duo_enterprise', +}; export const DUO_HEALTH_CHECK_CATEGORIES = [ { @@ -49,13 +66,13 @@ export const DUO_HEALTH_CHECK_CATEGORIES = [ export const addOnEligibleUserListTableFields = { codeSuggestionsAddon: { key: 'codeSuggestionsAddon', - label: CODE_SUGGESTIONS_TITLE, + label: DUO_TITLES[DUO_PRO], thClass: 'gl-w-5/20', tdClass: '!gl-align-middle', }, duoEnterpriseAddon: { key: 'codeSuggestionsAddon', - label: DUO_ENTERPRISE_TITLE, + label: DUO_TITLES[DUO_ENTERPRISE], thClass: 'gl-w-5/20', tdClass: '!gl-align-middle', }, diff --git a/ee/spec/frontend/ai/settings/components/duo_seat_utilization_info_card_spec.js b/ee/spec/frontend/ai/settings/components/duo_seat_utilization_info_card_spec.js index afcac5e257eac..63282f2a7b983 100644 --- a/ee/spec/frontend/ai/settings/components/duo_seat_utilization_info_card_spec.js +++ b/ee/spec/frontend/ai/settings/components/duo_seat_utilization_info_card_spec.js @@ -2,12 +2,7 @@ import { shallowMount } from '@vue/test-utils'; import { GlCard, GlIcon, GlButton } from '@gitlab/ui'; import UsageStatistics from 'ee/usage_quotas/components/usage_statistics.vue'; import DuoSeatUtilizationInfoCard from 'ee/ai/settings/components/duo_seat_utilization_info_card.vue'; -import { - DUO_PRO, - DUO_ENTERPRISE, - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE_TITLE, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_PRO, DUO_ENTERPRISE, DUO_TITLES } from 'ee/usage_quotas/code_suggestions/constants'; import { useMockInternalEventsTracking } from 'helpers/tracking_internal_events_helper'; jest.mock('~/lib/utils/url_utility'); @@ -95,10 +90,10 @@ describe('DuoSeatUtilizationInfoCard', () => { it('sets duoTitle correctly based on duoTier', () => { wrapper = createComponent({ duoTier: DUO_PRO }); - expect(findSeatUtilizationDescription().text()).toContain(CODE_SUGGESTIONS_TITLE); + expect(findSeatUtilizationDescription().text()).toContain(DUO_TITLES[DUO_PRO]); wrapper = createComponent({ duoTier: DUO_ENTERPRISE }); - expect(findSeatUtilizationDescription().text()).toContain(DUO_ENTERPRISE_TITLE); + expect(findSeatUtilizationDescription().text()).toContain(DUO_TITLES[DUO_ENTERPRISE]); }); it('renders subscription dates correctly', () => { diff --git a/ee/spec/frontend/ai/settings/pages/gitlab_duo_home_spec.js b/ee/spec/frontend/ai/settings/pages/gitlab_duo_home_spec.js index 39b1941ece605..336c264ae29e5 100644 --- a/ee/spec/frontend/ai/settings/pages/gitlab_duo_home_spec.js +++ b/ee/spec/frontend/ai/settings/pages/gitlab_duo_home_spec.js @@ -4,12 +4,13 @@ import CodeSuggestionsUsage from 'ee/usage_quotas/code_suggestions/components/co import HealthCheckList from 'ee/usage_quotas/code_suggestions/components/health_check_list.vue'; import DuoSeatUtilizationInfoCard from 'ee/ai/settings/components/duo_seat_utilization_info_card.vue'; import GitlabDuoHome from 'ee/ai/settings/pages/gitlab_duo_home.vue'; +import { DUO_PRO } from 'ee/usage_quotas/code_suggestions/constants'; describe('GitLab Duo Home', () => { const mockSlotProps = { totalValue: 100, usageValue: 50, - duoTier: 'pro', + duoTier: DUO_PRO, }; let wrapper; diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/add_on_eligible_user_list_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/add_on_eligible_user_list_spec.js index 93ba73ade64d7..fc83e4a6babb5 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/add_on_eligible_user_list_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/add_on_eligible_user_list_spec.js @@ -29,12 +29,7 @@ import { import { scrollToElement } from '~/lib/utils/common_utils'; import Tracking from '~/tracking'; import AddOnBulkActionConfirmationModal from 'ee/usage_quotas/code_suggestions/components/add_on_bulk_action_confirmation_modal.vue'; -import { - ADD_ON_CODE_SUGGESTIONS, - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE, - DUO_ENTERPRISE_TITLE, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_PRO, DUO_ENTERPRISE, DUO_TITLES } from 'ee/usage_quotas/code_suggestions/constants'; import PageSizeSelector from '~/vue_shared/components/page_size_selector.vue'; import { createMockClient } from 'helpers/mock_apollo_helper'; import getAddOnEligibleUsers from 'ee/usage_quotas/add_on/graphql/saas_add_on_eligible_users.query.graphql'; @@ -59,11 +54,11 @@ describe('Add On Eligible User List', () => { const addOnPurchaseId = 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/1'; const addDuoProHref = 'http://customers.gitlab.com/namespaces/0/duo_pro_seats'; - const codeSuggestionsAddOn = { addOnPurchase: { name: ADD_ON_CODE_SUGGESTIONS } }; + const codeSuggestionsAddOn = { addOnPurchase: { name: DUO_PRO } }; const addOnPurchase = { id: addOnPurchaseId, - name: ADD_ON_CODE_SUGGESTIONS, + name: DUO_PRO, purchasedQuantity: 3, assignedQuantity: 2, __typename: 'AddOnPurchase', @@ -71,7 +66,7 @@ describe('Add On Eligible User List', () => { const addOnEligibleUsersQueryVariables = { fullPath: 'namespace/full-path', - addOnType: 'CODE_SUGGESTIONS', + addOnType: DUO_PRO, addOnPurchaseIds: [addOnPurchaseId], }; @@ -220,7 +215,7 @@ describe('Add On Eligible User List', () => { pageInfo: pageInfoWithNoPages, pageSize: DEFAULT_PER_PAGE, isLoading: false, - duoTier: 'pro', + duoTier: DUO_PRO, ...props, }, provide: { @@ -402,7 +397,7 @@ describe('Add On Eligible User List', () => { }); it('labels add-on column as Duo Pro', () => { - expect(findTableLabels()).toContain(CODE_SUGGESTIONS_TITLE); + expect(findTableLabels()).toContain(DUO_TITLES[DUO_PRO]); }); describe('with Duo Enterprise add-on enabled', () => { @@ -414,7 +409,7 @@ describe('Add On Eligible User List', () => { }); it('labels add-on column as Duo Enterprise', () => { - expect(findTableLabels()).toContain(DUO_ENTERPRISE_TITLE); + expect(findTableLabels()).toContain(DUO_TITLES[DUO_ENTERPRISE]); }); }); @@ -566,7 +561,7 @@ describe('Add On Eligible User List', () => { const expectedProps = [ { userId: 'gid://gitlab/User/1', - addOnAssignments: [{ addOnPurchase: { name: 'CODE_SUGGESTIONS' } }], + addOnAssignments: [{ addOnPurchase: { name: DUO_PRO } }], addOnPurchaseId, }, { diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment_spec.js index d97a2cc4ec73c..e0b3c623cd86f 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment_spec.js @@ -8,13 +8,7 @@ import Tracking from '~/tracking'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import CodeSuggestionsAddonAssignment from 'ee/usage_quotas/code_suggestions/components/code_suggestions_addon_assignment.vue'; -import { - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE, - DUO_ENTERPRISE_TITLE, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_PRO, DUO_ENTERPRISE, DUO_TITLES } from 'ee/usage_quotas/code_suggestions/constants'; import getAddOnEligibleUsers from 'ee/usage_quotas/add_on/graphql/saas_add_on_eligible_users.query.graphql'; import userAddOnAssignmentCreateMutation from 'ee/usage_quotas/add_on/graphql/user_add_on_assignment_create.mutation.graphql'; import userAddOnAssignmentRemoveMutation from 'ee/usage_quotas/add_on/graphql/user_add_on_assignment_remove.mutation.graphql'; @@ -37,19 +31,19 @@ describe('CodeSuggestionsAddonAssignment', () => { const addOnPurchaseId = 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/2'; const duoEnterpriseAddOnPurchaseId = 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3'; - const codeSuggestionsAddOn = { addOnPurchase: { name: ADD_ON_CODE_SUGGESTIONS } }; - const duoEnterpriseAddOn = { addOnPurchase: { name: ADD_ON_DUO_ENTERPRISE } }; + const codeSuggestionsAddOn = { addOnPurchase: { name: DUO_PRO } }; + const duoEnterpriseAddOn = { addOnPurchase: { name: DUO_ENTERPRISE } }; const addOnPurchase = { id: addOnPurchaseId, - name: ADD_ON_CODE_SUGGESTIONS, + name: DUO_PRO, purchasedQuantity: 3, assignedQuantity: 2, __typename: 'AddOnPurchase', }; const duoEnterpriseAddOnPurchase = { id: duoEnterpriseAddOnPurchaseId, - name: ADD_ON_DUO_ENTERPRISE, + name: DUO_ENTERPRISE, purchasedQuantity: 3, assignedQuantity: 2, __typename: 'AddOnPurchase', @@ -57,12 +51,12 @@ describe('CodeSuggestionsAddonAssignment', () => { const addOnEligibleUsersQueryVariables = { fullPath: 'namespace/full-path', - addOnType: ADD_ON_CODE_SUGGESTIONS, + addOnType: DUO_PRO, addOnPurchaseIds: [addOnPurchaseId], }; const duoEnterpriseAddOnEligibleUsersQueryVariables = { fullPath: 'namespace/full-path', - addOnType: ADD_ON_DUO_ENTERPRISE, + addOnType: DUO_ENTERPRISE, addOnPurchaseIds: [duoEnterpriseAddOnPurchaseId], }; @@ -195,7 +189,7 @@ describe('CodeSuggestionsAddonAssignment', () => { it('shows correct label on the toggle', () => { createComponent(); expect(findToggle().props('label')).toBe( - sprintf('%{addOnName} status', { addOnName: CODE_SUGGESTIONS_TITLE }), + sprintf('%{addOnName} status', { addOnName: DUO_TITLES[DUO_PRO] }), ); }); @@ -206,7 +200,7 @@ describe('CodeSuggestionsAddonAssignment', () => { it('shows correct label on the toggle', () => { expect(findToggle().props('label')).toBe( - sprintf('%{addOnName} status', { addOnName: DUO_ENTERPRISE_TITLE }), + sprintf('%{addOnName} status', { addOnName: DUO_TITLES[DUO_ENTERPRISE] }), ); }); }); diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_info_card_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_info_card_spec.js index 568a2c9da4082..deceea636c9de 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_info_card_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_info_card_spec.js @@ -15,6 +15,7 @@ import getGitlabSubscriptionQuery from 'ee/fulfillment/shared_queries/gitlab_sub import { getMockSubscriptionData } from 'ee_jest/usage_quotas/seats/mock_data'; import HandRaiseLeadButton from 'ee/hand_raise_leads/hand_raise_lead/components/hand_raise_lead_button.vue'; import { useMockInternalEventsTracking } from 'helpers/tracking_internal_events_helper'; +import { DUO_PRO, DUO_ENTERPRISE } from 'ee/usage_quotas/code_suggestions/constants'; Vue.use(VueApollo); @@ -137,7 +138,7 @@ describe('CodeSuggestionsInfoCard', () => { describe('with Duo Pro add-on enabled', () => { beforeEach(async () => { - createComponent({ props: { duoTier: 'pro' } }); + createComponent({ props: { duoTier: DUO_PRO } }); // wait for apollo to load await waitForPromises(); @@ -161,7 +162,7 @@ describe('CodeSuggestionsInfoCard', () => { describe('with Duo Enterprise add-on enabled', () => { beforeEach(async () => { - createComponent({ props: { duoTier: 'enterprise' } }); + createComponent({ props: { duoTier: DUO_ENTERPRISE } }); // wait for apollo to load await waitForPromises(); @@ -253,7 +254,7 @@ describe('CodeSuggestionsInfoCard', () => { beforeEach(async () => { createComponent({ props: { - duoTier: 'pro', + duoTier: DUO_PRO, }, provide: { duoAddOnIsTrial: true, @@ -293,7 +294,7 @@ describe('CodeSuggestionsInfoCard', () => { beforeEach(async () => { createComponent({ props: { - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }, provide: { duoAddOnIsTrial: true, @@ -325,7 +326,7 @@ describe('CodeSuggestionsInfoCard', () => { beforeEach(async () => { createComponent({ props: { - duoTier: 'pro', + duoTier: DUO_PRO, }, provide: { duoAddOnIsTrial: true, @@ -385,7 +386,7 @@ describe('CodeSuggestionsInfoCard', () => { beforeEach(async () => { createComponent({ props: { - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }, provide: { duoAddOnIsTrial: true, @@ -440,7 +441,7 @@ describe('CodeSuggestionsInfoCard', () => { describe('contact sales button', () => { it('is rendered after apollo is loaded with the correct props', async () => { createComponent({ - props: { duoTier: 'enterprise' }, + props: { duoTier: DUO_ENTERPRISE }, provide: { duoAddOnIsTrial: false }, }); @@ -461,7 +462,7 @@ describe('CodeSuggestionsInfoCard', () => { const mockError = new Error('Woops, error in permissions call'); beforeEach(async () => { queryHandlerMock = jest.fn().mockRejectedValueOnce(mockError); - createComponent({ props: { duoTier: 'enterprise' } }); + createComponent({ props: { duoTier: DUO_ENTERPRISE } }); await waitForPromises(); }); @@ -504,7 +505,7 @@ describe('CodeSuggestionsInfoCard', () => { userActionAccess: { limitedAccessReason }, }, }); - createComponent({ props: { duoTier: 'enterprise' } }); + createComponent({ props: { duoTier: DUO_ENTERPRISE } }); await waitForPromises(); findContactSalesButton().vm.$emit('click'); @@ -543,7 +544,7 @@ describe('CodeSuggestionsInfoCard', () => { userActionAccess: { limitedAccessReason }, }, }); - createComponent({ props: { duoTier: 'enterprise' } }); + createComponent({ props: { duoTier: DUO_ENTERPRISE } }); await waitForPromises(); findContactSalesButton().vm.$emit('click'); @@ -577,7 +578,7 @@ describe('CodeSuggestionsInfoCard', () => { const mockError = new Error('Woops, error in permissions call'); beforeEach(async () => { queryHandlerMock = jest.fn().mockRejectedValueOnce(mockError); - createComponent({ props: { duoTier: 'pro' } }); + createComponent({ props: { duoTier: DUO_PRO } }); await waitForPromises(); }); @@ -610,7 +611,7 @@ describe('CodeSuggestionsInfoCard', () => { ${true} | ${'add_duo_pro_saas'} ${false} | ${'add_duo_pro_sm'} `('tracks the click with correct labels', async ({ isSaaS, label }) => { - createComponent({ props: { duoTier: 'pro' }, provide: { isSaaS } }); + createComponent({ props: { duoTier: DUO_PRO }, provide: { isSaaS } }); await waitForPromises(); const { trackEventSpy } = bindInternalEventDocument(wrapper.element); @@ -647,7 +648,7 @@ describe('CodeSuggestionsInfoCard', () => { userActionAccess: { limitedAccessReason }, }, }); - createComponent({ props: { duoTier: 'pro' } }); + createComponent({ props: { duoTier: DUO_PRO } }); await waitForPromises(); findAddSeatsButton().vm.$emit('click'); @@ -690,7 +691,7 @@ describe('CodeSuggestionsInfoCard', () => { userActionAccess: { limitedAccessReason }, }, }); - createComponent({ props: { duoTier: 'pro' } }); + createComponent({ props: { duoTier: DUO_PRO } }); await waitForPromises(); findAddSeatsButton().vm.$emit('click'); diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_spec.js index f0aa422abd6ce..2f508d2c8b244 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_spec.js @@ -15,10 +15,7 @@ import { useFakeDate } from 'helpers/fake_date'; import CodeSuggestionsUsageLoader from 'ee/usage_quotas/code_suggestions/components/code_suggestions_usage_loader.vue'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { - CODE_SUGGESTIONS_TITLE, - DUO_ENTERPRISE_TITLE, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_TITLES, DUO_PRO, DUO_ENTERPRISE } from 'ee/usage_quotas/code_suggestions/constants'; import { ADD_ON_ERROR_DICTIONARY, ADD_ON_PURCHASE_FETCH_ERROR_CODE, @@ -239,7 +236,7 @@ describe('GitLab Duo Usage', () => { it('renders code suggestions subtitle', () => { expect(findCodeSuggestionsSubtitle().text()).toBe( sprintf('Manage seat assignments for %{addOnName} within your group.', { - addOnName: CODE_SUGGESTIONS_TITLE, + addOnName: DUO_TITLES[DUO_PRO], }), ); }); @@ -261,7 +258,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsStatistics().props()).toEqual({ usageValue: 0, totalValue: 20, - duoTier: 'pro', + duoTier: DUO_PRO, }); }); @@ -269,7 +266,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsInfo().exists()).toBe(true); expect(findCodeSuggestionsInfo().props()).toEqual({ groupId: 289561, - duoTier: 'pro', + duoTier: DUO_PRO, }); }); }); @@ -286,7 +283,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsStatistics().props()).toEqual({ usageValue: 0, totalValue: 20, - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }); }); @@ -294,7 +291,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsInfo().exists()).toBe(true); expect(findCodeSuggestionsInfo().props()).toEqual({ groupId: 289561, - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }); }); }); @@ -310,7 +307,7 @@ describe('GitLab Duo Usage', () => { it('renders addon user list for duo enterprise', () => { expect(findSaasAddOnEligibleUserList().props()).toEqual({ addOnPurchaseId: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/4', - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }); }); @@ -318,7 +315,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsStatistics().props()).toEqual({ usageValue: 0, totalValue: 20, - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }); }); @@ -326,7 +323,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsInfo().exists()).toBe(true); expect(findCodeSuggestionsInfo().props()).toEqual({ groupId: 289561, - duoTier: 'enterprise', + duoTier: DUO_ENTERPRISE, }); }); }); @@ -347,7 +344,7 @@ describe('GitLab Duo Usage', () => { it('renders code suggestions subtitle', () => { expect(findCodeSuggestionsSubtitle().text()).toBe( sprintf('Manage seat assignments for %{addOnName}.', { - addOnName: CODE_SUGGESTIONS_TITLE, + addOnName: DUO_TITLES[DUO_PRO], }), ); }); @@ -367,7 +364,7 @@ describe('GitLab Duo Usage', () => { it('renders code suggestions subtitle', () => { expect(findCodeSuggestionsSubtitle().text()).toBe( sprintf('Manage seat assignments for %{addOnName}.', { - addOnName: DUO_ENTERPRISE_TITLE, + addOnName: DUO_TITLES[DUO_ENTERPRISE], }), ); }); @@ -381,7 +378,7 @@ describe('GitLab Duo Usage', () => { expect(findCodeSuggestionsStatistics().props()).toEqual({ usageValue: 0, totalValue: 20, - duoTier: 'pro', + duoTier: DUO_PRO, }); }); @@ -401,7 +398,7 @@ describe('GitLab Duo Usage', () => { expect(findSaasAddOnEligibleUserList().props()).toEqual({ addOnPurchaseId: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3', - duoTier: 'pro', + duoTier: DUO_PRO, }); }); @@ -414,7 +411,7 @@ describe('GitLab Duo Usage', () => { expect(findSelfManagedAddOnEligibleUserList().props()).toEqual({ addOnPurchaseId: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3', - duoTier: 'pro', + duoTier: DUO_PRO, }); }); }); @@ -476,7 +473,7 @@ describe('GitLab Duo Usage', () => { it('renders code suggestions subtitle', () => { expect(findCodeSuggestionsSubtitle().text()).toBe( sprintf('Manage seat assignments for %{addOnName}.', { - addOnName: CODE_SUGGESTIONS_TITLE, + addOnName: DUO_TITLES[DUO_PRO], }), ); }); diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card_spec.js index 919e50ac47f65..557ea733d2c23 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card_spec.js @@ -3,6 +3,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import CodeSuggestionsUsageStatisticsCard from 'ee/usage_quotas/code_suggestions/components/code_suggestions_usage_statistics_card.vue'; import UsageStatistics from 'ee/usage_quotas/components/usage_statistics.vue'; +import { DUO_PRO } from 'ee/usage_quotas/code_suggestions/constants'; describe('CodeSuggestionsUsageStatisticsCard', () => { let wrapper; @@ -32,7 +33,7 @@ describe('CodeSuggestionsUsageStatisticsCard', () => { describe('with purchased Duo Pro Add-ons', () => { beforeEach(() => { - return createComponent({ usageValue: 0, totalValue: 20, duoTier: 'pro' }); + return createComponent({ usageValue: 0, totalValue: 20, duoTier: DUO_PRO }); }); it('renders the description text', () => { @@ -56,7 +57,7 @@ describe('CodeSuggestionsUsageStatisticsCard', () => { describe('with purchased Duo Enterprise Add-ons', () => { beforeEach(() => { - return createComponent({ usageValue: 0, totalValue: 20, duoTier: 'enterprise' }); + return createComponent({ usageValue: 0, totalValue: 20, duoTier: 'DUO_ENTERPRISE' }); }); it('renders the description text', () => { diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list_spec.js index 47e2a12f1f6c0..bab9427a1b29e 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list_spec.js @@ -22,8 +22,6 @@ import SearchAndSortBar from 'ee/usage_quotas/code_suggestions/components/search import { DUO_PRO, DUO_ENTERPRISE, - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, SORT_OPTIONS, DEFAULT_SORT_OPTION, } from 'ee/usage_quotas/code_suggestions/constants'; @@ -59,13 +57,13 @@ describe('Add On Eligible User List', () => { const defaultQueryVariables = { fullPath, - addOnType: ADD_ON_CODE_SUGGESTIONS, + addOnType: DUO_PRO, addOnPurchaseIds: [addOnPurchaseId], ...defaultPaginationParams, }; const defaultDuoEnterpriseQueryVariables = { fullPath, - addOnType: ADD_ON_DUO_ENTERPRISE, + addOnType: DUO_ENTERPRISE, addOnPurchaseIds: [duoEnterpriseAddOnPurchaseId], ...defaultPaginationParams, }; diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/components/self_mananged_add_on_eligible_user_list_spec.js b/ee/spec/frontend/usage_quotas/code_suggestions/components/self_mananged_add_on_eligible_user_list_spec.js index b4922de7d9a01..b506586d51c2e 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/components/self_mananged_add_on_eligible_user_list_spec.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/components/self_mananged_add_on_eligible_user_list_spec.js @@ -14,8 +14,6 @@ import { import { DUO_PRO, DUO_ENTERPRISE, - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, SORT_OPTIONS, DEFAULT_SORT_OPTION, } from 'ee/usage_quotas/code_suggestions/constants'; @@ -65,12 +63,12 @@ describe('Add On Eligible User List', () => { const duoTier = DUO_PRO; const defaultQueryVariables = { - addOnType: ADD_ON_CODE_SUGGESTIONS, + addOnType: DUO_PRO, addOnPurchaseIds: [addOnPurchaseId], ...defaultPaginationParams, }; const defaultDuoEnterpriseQueryVariables = { - addOnType: ADD_ON_DUO_ENTERPRISE, + addOnType: DUO_ENTERPRISE, addOnPurchaseIds: [duoEnterpriseAddOnPurchaseId], ...defaultPaginationParams, }; diff --git a/ee/spec/frontend/usage_quotas/code_suggestions/mock_data.js b/ee/spec/frontend/usage_quotas/code_suggestions/mock_data.js index a2e0bfd0c05f1..b19c5132e9244 100644 --- a/ee/spec/frontend/usage_quotas/code_suggestions/mock_data.js +++ b/ee/spec/frontend/usage_quotas/code_suggestions/mock_data.js @@ -1,16 +1,13 @@ import { subscriptionTypes } from 'ee/admin/subscriptions/show/constants'; -import { - ADD_ON_CODE_SUGGESTIONS, - ADD_ON_DUO_ENTERPRISE, -} from 'ee/usage_quotas/code_suggestions/constants'; +import { DUO_PRO, DUO_ENTERPRISE } from 'ee/usage_quotas/code_suggestions/constants'; export const noAssignedDuoProAddonData = { data: { addOnPurchases: [ { id: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3', - name: ADD_ON_CODE_SUGGESTIONS, + name: DUO_PRO, assignedQuantity: 0, purchasedQuantity: 20, __typename: 'AddOnPurchase', @@ -24,7 +21,7 @@ export const noAssignedDuoEnterpriseAddonData = { addOnPurchases: [ { id: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3', - name: ADD_ON_DUO_ENTERPRISE, + name: DUO_ENTERPRISE, assignedQuantity: 0, purchasedQuantity: 20, __typename: 'AddOnPurchase', @@ -38,14 +35,14 @@ export const noAssignedDuoAddonsData = { addOnPurchases: [ { id: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3', - name: ADD_ON_CODE_SUGGESTIONS, + name: DUO_PRO, assignedQuantity: 0, purchasedQuantity: 15, __typename: 'AddOnPurchase', }, { id: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/4', - name: ADD_ON_DUO_ENTERPRISE, + name: DUO_ENTERPRISE, assignedQuantity: 0, purchasedQuantity: 20, __typename: 'AddOnPurchase', @@ -65,7 +62,7 @@ export const purchasedAddonFuzzyData = { addOnPurchases: [ { id: 'gid://gitlab/GitlabSubscriptions::AddOnPurchase/3', - name: ADD_ON_CODE_SUGGESTIONS, + name: DUO_PRO, assignedQuantity: 0, purchasedQuantity: null, __typename: 'AddOnPurchase', @@ -107,7 +104,7 @@ export const mockSMUserWithAddOnAssignment = { lastActivityOn: '2023-08-25', maxRole: null, addOnAssignments: { - nodes: [{ addOnPurchase: { name: ADD_ON_CODE_SUGGESTIONS } }], + nodes: [{ addOnPurchase: { name: DUO_PRO } }], __typename: 'UserAddOnAssignmentConnection', }, __typename: 'AddOnUser', diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 39fc9314f3b8b..f264c228f1161 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -14141,6 +14141,9 @@ msgstr "" msgid "CodeSuggestions|Enhance your coding experience with intelligent recommendations. %{linkStart}GitLab Duo%{linkEnd} offers features that use generative AI to suggest code." msgstr "" +msgid "CodeSuggestions|Enterprise" +msgstr "" + msgid "CodeSuggestions|Get started with GitLab Duo Pro today to boost your efficiency and effectiveness by reducing the time required to write and understand code." msgstr "" @@ -14177,6 +14180,9 @@ msgstr "" msgid "CodeSuggestions|Outbound and inbound connections from clients to the GitLab instance must be allowed." msgstr "" +msgid "CodeSuggestions|Pro" +msgstr "" + msgid "CodeSuggestions|Problems detected with setup" msgstr "" -- GitLab