diff --git a/packages/api-v4/.changeset/pr-11256-added-1731689702399.md b/packages/api-v4/.changeset/pr-11256-added-1731689702399.md new file mode 100644 index 00000000000..0b994e5ae22 --- /dev/null +++ b/packages/api-v4/.changeset/pr-11256-added-1731689702399.md @@ -0,0 +1,5 @@ +--- +"@linode/api-v4": Added +--- + +New VPU related fields and capabilities to API types ([#11256](https://github.com/linode/manager/pull/11256)) diff --git a/packages/api-v4/src/account/types.ts b/packages/api-v4/src/account/types.ts index 8a0af4e587c..865a9956dbc 100644 --- a/packages/api-v4/src/account/types.ts +++ b/packages/api-v4/src/account/types.ts @@ -74,6 +74,7 @@ export type AccountCapability = | 'Machine Images' | 'Managed Databases' | 'Managed Databases Beta' + | 'NETINT Quadra T1U' | 'NodeBalancers' | 'Object Storage Access Key Regions' | 'Object Storage Endpoint Types' diff --git a/packages/api-v4/src/linodes/actions.ts b/packages/api-v4/src/linodes/actions.ts index 71c52de4722..dc814e2079d 100644 --- a/packages/api-v4/src/linodes/actions.ts +++ b/packages/api-v4/src/linodes/actions.ts @@ -110,7 +110,7 @@ export const resizeLinode = (linodeId: number, data: ResizeLinodePayload) => * automatically appended to the root user's authorized keys file. */ export const rebuildLinode = (linodeId: number, data: RebuildRequest) => - Request<{}>( + Request( setURL( `${API_ROOT}/linode/instances/${encodeURIComponent(linodeId)}/rebuild` ), diff --git a/packages/api-v4/src/linodes/types.ts b/packages/api-v4/src/linodes/types.ts index 34316f11adf..7c70fcb4d07 100644 --- a/packages/api-v4/src/linodes/types.ts +++ b/packages/api-v4/src/linodes/types.ts @@ -13,6 +13,7 @@ export interface LinodeSpecs { vcpus: number; transfer: number; gpus: number; + accelerated_devices: number; } export interface Linode { @@ -322,6 +323,7 @@ export interface LinodeType extends BaseType { successor: string | null; network_out: number; gpus: number; + accelerated_devices: number; price: PriceObject; region_prices: RegionPriceObject[]; addons: { @@ -330,6 +332,7 @@ export interface LinodeType extends BaseType { } export type LinodeTypeClass = + | 'accelerated' | 'nanode' | 'standard' | 'dedicated' diff --git a/packages/api-v4/src/regions/types.ts b/packages/api-v4/src/regions/types.ts index e756cc38dca..0fb7421e875 100644 --- a/packages/api-v4/src/regions/types.ts +++ b/packages/api-v4/src/regions/types.ts @@ -15,6 +15,7 @@ export type Capabilities = | 'Managed Databases' | 'Metadata' | 'NodeBalancers' + | 'NETINT Quadra T1U' | 'Object Storage' | 'Placement Group' | 'Premium Plans' diff --git a/packages/manager/.changeset/pr-11256-changed-1731689770913.md b/packages/manager/.changeset/pr-11256-changed-1731689770913.md new file mode 100644 index 00000000000..9d72b1d0ce9 --- /dev/null +++ b/packages/manager/.changeset/pr-11256-changed-1731689770913.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Changed +--- + +Updated types based on new VPU fields and added mock data ([#11256](https://github.com/linode/manager/pull/11256)) diff --git a/packages/manager/src/__data__/linodes.ts b/packages/manager/src/__data__/linodes.ts index f944613c588..b3fa200b66a 100644 --- a/packages/manager/src/__data__/linodes.ts +++ b/packages/manager/src/__data__/linodes.ts @@ -34,6 +34,7 @@ export const linode1: Linode = { region: 'us-east', site_type: 'core', specs: { + accelerated_devices: 0, disk: 20480, gpus: 0, memory: 1024, @@ -81,6 +82,7 @@ export const linode2: Linode = { region: 'us-east', site_type: 'core', specs: { + accelerated_devices: 0, disk: 30720, gpus: 0, memory: 2048, @@ -128,6 +130,7 @@ export const linode3: Linode = { region: 'us-east', site_type: 'core', specs: { + accelerated_devices: 0, disk: 30720, gpus: 0, memory: 2048, @@ -175,6 +178,7 @@ export const linode4: Linode = { region: 'eu-west', site_type: 'core', specs: { + accelerated_devices: 0, disk: 30720, gpus: 0, memory: 2048, diff --git a/packages/manager/src/components/EntityHeader/EntityHeader.stories.tsx b/packages/manager/src/components/EntityHeader/EntityHeader.stories.tsx index ba812126498..4e64482c745 100644 --- a/packages/manager/src/components/EntityHeader/EntityHeader.stories.tsx +++ b/packages/manager/src/components/EntityHeader/EntityHeader.stories.tsx @@ -59,6 +59,7 @@ export const Default: Story = { }, }} linodeType={{ + accelerated_devices: 0, addons: { backups: { price: { diff --git a/packages/manager/src/factories/account.ts b/packages/manager/src/factories/account.ts index c056cf9ac56..3ddacc0a30b 100644 --- a/packages/manager/src/factories/account.ts +++ b/packages/manager/src/factories/account.ts @@ -47,6 +47,7 @@ export const accountFactory = Factory.Sync.makeFactory({ 'Machine Images', 'Managed Databases', 'Managed Databases Beta', + 'NETINT Quadra T1U', 'NodeBalancers', 'Object Storage Access Key Regions', 'Object Storage Endpoint Types', diff --git a/packages/manager/src/factories/linodes.ts b/packages/manager/src/factories/linodes.ts index 2295f39bf0f..b5063025665 100644 --- a/packages/manager/src/factories/linodes.ts +++ b/packages/manager/src/factories/linodes.ts @@ -26,6 +26,7 @@ export const linodeAlertsFactory = Factory.Sync.makeFactory({ }); export const linodeSpecsFactory = Factory.Sync.makeFactory({ + accelerated_devices: 1, disk: 51200, gpus: 0, memory: 2048, @@ -163,6 +164,7 @@ export const linodeTransferFactory = Factory.Sync.makeFactory({ + accelerated_devices: 0, addons: { backups: { price: { @@ -218,6 +220,7 @@ export const dedicatedTypeFactory = linodeTypeFactory.extend({ }); export const proDedicatedTypeFactory = Factory.Sync.makeFactory({ + accelerated_devices: 0, addons: { backups: { price: { diff --git a/packages/manager/src/factories/types.ts b/packages/manager/src/factories/types.ts index 4b7cb8f755e..5dffdfaa3be 100644 --- a/packages/manager/src/factories/types.ts +++ b/packages/manager/src/factories/types.ts @@ -9,6 +9,7 @@ import type { import type { ExtendedType } from 'src/utilities/extendType'; export const typeFactory = Factory.Sync.makeFactory({ + accelerated_devices: 0, addons: { backups: { price: { @@ -87,6 +88,7 @@ export const planSelectionTypeFactory = Factory.Sync.makeFactory({ + accelerated_devices: 0, addons: { backups: { price: { diff --git a/packages/manager/src/features/components/PlansPanel/PlansPanel.tsx b/packages/manager/src/features/components/PlansPanel/PlansPanel.tsx index 3cf6cc8a6bf..ea873a5ac5d 100644 --- a/packages/manager/src/features/components/PlansPanel/PlansPanel.tsx +++ b/packages/manager/src/features/components/PlansPanel/PlansPanel.tsx @@ -2,11 +2,12 @@ import { Notice } from '@linode/ui'; import * as React from 'react'; import { useLocation } from 'react-router-dom'; +import { isDistributedRegionSupported } from 'src/components/RegionSelect/RegionSelect.utils'; import { getIsDistributedRegion } from 'src/components/RegionSelect/RegionSelect.utils'; import { useIsGeckoEnabled } from 'src/components/RegionSelect/RegionSelect.utils'; -import { isDistributedRegionSupported } from 'src/components/RegionSelect/RegionSelect.utils'; import { TabbedPanel } from 'src/components/TabbedPanel/TabbedPanel'; import { useFlags } from 'src/hooks/useFlags'; +import { useAccount } from 'src/queries/account/account'; import { useRegionAvailabilityQuery } from 'src/queries/regions/regions'; import { plansNoticesUtils } from 'src/utilities/planNotices'; import { getQueryParamsFromQueryString } from 'src/utilities/queryParams'; @@ -87,6 +88,9 @@ export const PlansPanel = (props: PlansPanelProps) => { location.search ); + const { data: account } = useAccount(); + const hasVPUCapability = account?.capabilities?.includes('NETINT Quadra T1U'); + const { data: regionAvailabilities } = useRegionAvailabilityQuery( selectedRegionID || '', Boolean(flags.soldOutChips) && selectedRegionID !== undefined @@ -94,7 +98,9 @@ export const PlansPanel = (props: PlansPanelProps) => { const _types = types.filter( (type) => - !type.id.includes('dedicated-edge') && !type.id.includes('nanode-edge') + !type.id.includes('dedicated-edge') && + !type.id.includes('nanode-edge') && + (!hasVPUCapability ? type.class !== 'accelerated' : true) ); const _plans = getPlanSelectionsByPlanType( flags.disableLargestGbPlans diff --git a/packages/manager/src/features/components/PlansPanel/constants.ts b/packages/manager/src/features/components/PlansPanel/constants.ts index 3992caece9e..dc8e8ae9cc4 100644 --- a/packages/manager/src/features/components/PlansPanel/constants.ts +++ b/packages/manager/src/features/components/PlansPanel/constants.ts @@ -25,6 +25,7 @@ export const GPU_COMPUTE_INSTANCES_LINK = 'https://techdocs.akamai.com/cloud-computing/docs/gpu-compute-instances'; export const DEDICATED_512_GB_PLAN: ExtendedType = { + accelerated_devices: 0, addons: { backups: { price: { @@ -83,6 +84,7 @@ export const DEDICATED_512_GB_PLAN: ExtendedType = { }; export const PREMIUM_512_GB_PLAN: ExtendedType = { + accelerated_devices: 0, addons: { backups: { price: { diff --git a/packages/manager/src/features/components/PlansPanel/utils.test.ts b/packages/manager/src/features/components/PlansPanel/utils.test.ts index 97d282236bf..06641821206 100644 --- a/packages/manager/src/features/components/PlansPanel/utils.test.ts +++ b/packages/manager/src/features/components/PlansPanel/utils.test.ts @@ -29,6 +29,10 @@ const nanode = typeFactory.build({ class: 'nanode', id: 'g6-nanode-1' }); const premium = typeFactory.build({ class: 'premium', id: 'g6-premium-2' }); const highmem = typeFactory.build({ class: 'highmem', id: 'g6-highmem-1' }); const gpu = typeFactory.build({ class: 'gpu', id: 'g6-gpu-1' }); +const accelerated = typeFactory.build({ + class: 'accelerated', + id: 'accelerated-1', +}); describe('getPlanSelectionsByPlanType', () => { it('should return an object with plans grouped by type', () => { @@ -60,6 +64,7 @@ describe('getPlanSelectionsByPlanType', () => { nanode, dedicated, prodedicated, + accelerated, ]); const expectedOrder = planTypeOrder; diff --git a/packages/manager/src/features/components/PlansPanel/utils.ts b/packages/manager/src/features/components/PlansPanel/utils.ts index 74ce9fb2b40..df77dbba0f1 100644 --- a/packages/manager/src/features/components/PlansPanel/utils.ts +++ b/packages/manager/src/features/components/PlansPanel/utils.ts @@ -1,5 +1,4 @@ import { arrayToList } from 'src/utilities/arrayToList'; -import { ExtendedType } from 'src/utilities/extendType'; import { DEDICATED_512_GB_PLAN, @@ -10,12 +9,12 @@ import { PREMIUM_512_GB_PLAN, SMALLER_PLAN_DISABLED_COPY, } from './constants'; -import { + +import type { DisabledTooltipReasons, PlanSelectionType, PlanWithAvailability, } from './types'; - import type { Capabilities, LinodeTypeClass, @@ -23,6 +22,7 @@ import type { RegionAvailability, } from '@linode/api-v4'; import type { Flags } from 'src/featureFlags'; +import type { ExtendedType } from 'src/utilities/extendType'; export type PlansTypes = Record; @@ -42,6 +42,7 @@ export const planTypeOrder: ( 'gpu', 'metal', 'premium', + 'accelerated', ]; /** @@ -165,6 +166,14 @@ export const getIsLimitedAvailability = ({ }; export const planTabInfoContent = { + // TODO: to be further handled in M3-8834 + accelerated: { + dataId: 'data-qa-accelerated', + key: 'accelerated', + title: 'Accelerated', + typography: + 'Accelerated instances leverage ASICs to accelerate specialized tasks such as video transcoding, media processing, and other compute heavy workloads.', + }, dedicated: { dataId: 'data-qa-dedicated', key: 'dedicated', diff --git a/packages/manager/src/mocks/serverHandlers.ts b/packages/manager/src/mocks/serverHandlers.ts index c55a67586e4..3863cae6ed6 100644 --- a/packages/manager/src/mocks/serverHandlers.ts +++ b/packages/manager/src/mocks/serverHandlers.ts @@ -400,6 +400,12 @@ const gpuTypesRX = linodeTypeFactory.buildList(7, { gpus: 1, transfer: 5000, }); +const acceleratedType = linodeTypeFactory.buildList(7, { + accelerated_devices: 1, + class: 'accelerated', + label: 'Netint Quadra T1U X', + transfer: 0, +}); const proxyAccountUser = accountUserFactory.build({ email: 'partner@proxy.com', last_login: null, @@ -595,6 +601,7 @@ export const handlers = [ ...dedicatedTypes, ...gpuTypesAda, ...gpuTypesRX, + ...acceleratedType, proDedicatedType, ]) );