From cf10a8d9e513655a291486c3c743ab583503d10a Mon Sep 17 00:00:00 2001 From: Dennis van Kekem <38350840+dennisvankekem@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:17:18 +0100 Subject: [PATCH] hotfix: APL-354 to staging (#11284) * hotfix: APL-354 to staging * package bump and changelog update --------- Co-authored-by: Alban Bailly --- packages/manager/CHANGELOG.md | 7 +++++++ packages/manager/package.json | 2 +- .../KubernetesPlansPanel.tsx | 8 +++++++- .../components/PlansPanel/APLNotice.tsx | 19 +++++++++++++++++++ .../PlansPanel/PlanInformation.test.tsx | 7 +++++++ .../components/PlansPanel/PlanInformation.tsx | 19 ++++++++++++------- .../components/PlansPanel/constants.ts | 2 ++ .../features/components/PlansPanel/utils.ts | 2 +- 8 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 packages/manager/src/features/components/PlansPanel/APLNotice.tsx diff --git a/packages/manager/CHANGELOG.md b/packages/manager/CHANGELOG.md index 90a1a2761a8..f29cc7c8234 100644 --- a/packages/manager/CHANGELOG.md +++ b/packages/manager/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2024-11-19] - v1.132.1 + + +### Fixed: + +- Disable shared CPU whenever APL is enabled ([#11284](https://github.com/linode/manager/pull/11284)) + ## [2024-11-12] - v1.132.0 diff --git a/packages/manager/package.json b/packages/manager/package.json index 6d199b422df..a97e04ef58b 100644 --- a/packages/manager/package.json +++ b/packages/manager/package.json @@ -2,7 +2,7 @@ "name": "linode-manager", "author": "Linode", "description": "The Linode Manager website", - "version": "1.132.0", + "version": "1.132.1", "private": true, "type": "module", "bugs": { diff --git a/packages/manager/src/features/Kubernetes/KubernetesPlansPanel/KubernetesPlansPanel.tsx b/packages/manager/src/features/Kubernetes/KubernetesPlansPanel/KubernetesPlansPanel.tsx index 13d58ecde27..7423c472b17 100644 --- a/packages/manager/src/features/Kubernetes/KubernetesPlansPanel/KubernetesPlansPanel.tsx +++ b/packages/manager/src/features/Kubernetes/KubernetesPlansPanel/KubernetesPlansPanel.tsx @@ -69,6 +69,9 @@ export const KubernetesPlansPanel = (props: Props) => { Boolean(flags.soldOutChips) && selectedRegionId !== undefined ); + const isPlanDisabledByAPL = (plan: 'shared' | LinodeTypeClass) => + plan === 'shared' && Boolean(isAPLEnabled); + const _types = types.filter( (type) => !type.id.includes('dedicated-edge') && !type.id.includes('nanode-edge') @@ -105,10 +108,14 @@ export const KubernetesPlansPanel = (props: Props) => { )} hasMajorityOfPlansDisabled={hasMajorityOfPlansDisabled} hasSelectedRegion={hasSelectedRegion} + isAPLEnabled={isAPLEnabled} planType={plan} regionsData={regionsData} /> { selectedId={selectedId} selectedRegionId={selectedRegionId} updatePlanCount={updatePlanCount} - wholePanelIsDisabled={isPlanPanelDisabled(plan)} /> ); diff --git a/packages/manager/src/features/components/PlansPanel/APLNotice.tsx b/packages/manager/src/features/components/PlansPanel/APLNotice.tsx new file mode 100644 index 00000000000..6f8375b403c --- /dev/null +++ b/packages/manager/src/features/components/PlansPanel/APLNotice.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; + +import { Notice } from 'src/components/Notice/Notice'; + +import { APL_NOTICE_COPY } from './constants'; + +interface Props { + dataTestId?: string; +} + +export const APLNotice = (props: Props) => { + const { dataTestId } = props; + + return ( + + {APL_NOTICE_COPY} + + ); +}; diff --git a/packages/manager/src/features/components/PlansPanel/PlanInformation.test.tsx b/packages/manager/src/features/components/PlansPanel/PlanInformation.test.tsx index 089a59d27ad..37be697e66b 100644 --- a/packages/manager/src/features/components/PlansPanel/PlanInformation.test.tsx +++ b/packages/manager/src/features/components/PlansPanel/PlanInformation.test.tsx @@ -13,6 +13,7 @@ import type { PlanInformationProps } from './PlanInformation'; const mockProps: PlanInformationProps = { hasMajorityOfPlansDisabled: false, hasSelectedRegion: true, + isAPLEnabled: true, isSelectedRegionEligibleForPlan: false, planType: 'standard', }; @@ -28,6 +29,12 @@ describe('PlanInformation', () => { expect(element).toBeInTheDocument(); }); + it('should render APLNotice when planType is "shared" and APL is enabled', () => { + renderWithTheme(); + const element = screen.getByTestId('apl-notice'); + expect(element).toBeInTheDocument(); + }); + it('should render MetalNotice when planType is "metal"', () => { renderWithTheme(); const element = screen.getByTestId('metal-notice'); diff --git a/packages/manager/src/features/components/PlansPanel/PlanInformation.tsx b/packages/manager/src/features/components/PlansPanel/PlanInformation.tsx index 84099c30d8c..e862e2dc488 100644 --- a/packages/manager/src/features/components/PlansPanel/PlanInformation.tsx +++ b/packages/manager/src/features/components/PlansPanel/PlanInformation.tsx @@ -6,6 +6,7 @@ import { Typography } from 'src/components/Typography'; import { StyledNoticeTypography } from 'src/features/components/PlansPanel/PlansAvailabilityNotice.styles'; import { useFlags } from 'src/hooks/useFlags'; +import { APLNotice } from './APLNotice'; import { DEDICATED_COMPUTE_INSTANCES_LINK, GPU_COMPUTE_INSTANCES_LINK, @@ -21,13 +22,17 @@ import type { Region } from '@linode/api-v4'; import type { LinodeTypeClass } from '@linode/api-v4/lib/linodes'; import type { Theme } from '@mui/material/styles'; -export interface PlanInformationProps { +interface ExtendedPlanType { + planType: 'shared' | LinodeTypeClass; +} + +export interface PlanInformationProps extends ExtendedPlanType { disabledClasses?: LinodeTypeClass[]; hasMajorityOfPlansDisabled: boolean; hasSelectedRegion: boolean; hideLimitedAvailabilityBanner?: boolean; + isAPLEnabled?: boolean; isSelectedRegionEligibleForPlan: boolean; - planType: LinodeTypeClass; regionsData?: Region[]; } @@ -37,6 +42,7 @@ export const PlanInformation = (props: PlanInformationProps) => { hasMajorityOfPlansDisabled, hasSelectedRegion, hideLimitedAvailabilityBanner, + isAPLEnabled, isSelectedRegionEligibleForPlan, planType, regionsData, @@ -100,6 +106,9 @@ export const PlanInformation = (props: PlanInformationProps) => { hasDisabledClass={getDisabledClass('metal')} /> ) : null} + {planType === 'shared' && isAPLEnabled ? ( + + ) : null} {planType === 'premium' ? ( { export const limitedAvailabilityBannerTestId = 'limited-availability-banner'; -interface ClassDescriptionCopyProps { - planType: 'shared' | LinodeTypeClass; -} - -export const ClassDescriptionCopy = (props: ClassDescriptionCopyProps) => { +export const ClassDescriptionCopy = (props: ExtendedPlanType) => { const { planType } = props; let planTypeLabel: null | string; let docLink: null | string; diff --git a/packages/manager/src/features/components/PlansPanel/constants.ts b/packages/manager/src/features/components/PlansPanel/constants.ts index 3992caece9e..3a77d43d25c 100644 --- a/packages/manager/src/features/components/PlansPanel/constants.ts +++ b/packages/manager/src/features/components/PlansPanel/constants.ts @@ -10,6 +10,8 @@ export const PLAN_IS_CURRENTLY_UNAVAILABLE_COPY = 'This plan is currently unavailable.'; export const PLAN_IS_TOO_SMALL_FOR_APL_COPY = 'This plan is too small for Application Platform for LKE.'; +export const APL_NOTICE_COPY = + 'Shared CPU instances are currently not available for Application Platform for LKE'; export const LIMITED_AVAILABILITY_LINK = 'https://www.linode.com/global-infrastructure/availability/'; diff --git a/packages/manager/src/features/components/PlansPanel/utils.ts b/packages/manager/src/features/components/PlansPanel/utils.ts index 74ce9fb2b40..fe1858b41e7 100644 --- a/packages/manager/src/features/components/PlansPanel/utils.ts +++ b/packages/manager/src/features/components/PlansPanel/utils.ts @@ -302,7 +302,7 @@ export const extractPlansInformation = ({ ) ); const planIsTooSmallForAPL = - isAPLEnabled && Boolean(plan.memory < 8000 || plan.vcpus < 4); + isAPLEnabled && Boolean(plan.memory < 16000 || plan.vcpus < 4); return { ...plan,