From f80e9e96f2b56b41695b1a5687ed68c798faf155 Mon Sep 17 00:00:00 2001 From: Banks Nussman Date: Fri, 13 Dec 2024 10:21:45 -0500 Subject: [PATCH] improve prop optionality --- packages/api-v4/src/linodes/types.ts | 2 +- packages/manager/src/__data__/linodes.ts | 4 ++++ .../src/features/Linodes/HighPerformanceVolumeIcon.tsx | 2 +- .../manager/src/features/Linodes/LinodeEntityDetail.tsx | 2 +- .../src/features/Linodes/LinodeEntityDetailBody.tsx | 2 +- .../Linodes/LinodesLanding/LinodeRow/LinodeRow.test.tsx | 1 + .../src/features/Linodes/LinodesLanding/ListView.tsx | 1 + packages/manager/src/features/Volumes/VolumeTableRow.tsx | 8 +++++--- 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/api-v4/src/linodes/types.ts b/packages/api-v4/src/linodes/types.ts index 18f322b8b8a..5689c24ba34 100644 --- a/packages/api-v4/src/linodes/types.ts +++ b/packages/api-v4/src/linodes/types.ts @@ -20,7 +20,7 @@ export interface Linode { id: number; alerts: LinodeAlerts; backups: LinodeBackups; - capabilities?: LinodeCapabilities[]; // @TODO BSE: Remove optionality once BSE is fully rolled out + capabilities: LinodeCapabilities[]; created: string; disk_encryption?: EncryptionStatus; // @TODO LDE: Remove optionality once LDE is fully rolled out region: string; diff --git a/packages/manager/src/__data__/linodes.ts b/packages/manager/src/__data__/linodes.ts index cf156461fa9..8cf0cac9de2 100644 --- a/packages/manager/src/__data__/linodes.ts +++ b/packages/manager/src/__data__/linodes.ts @@ -16,6 +16,7 @@ export const linode1: Linode = { window: 'W2', }, }, + capabilities: [], created: '2017-12-07T19:12:58', group: 'active', hypervisor: 'kvm', @@ -65,6 +66,7 @@ export const linode2: Linode = { window: 'Scheduling', }, }, + capabilities: [], created: '2018-02-22T16:11:07', group: 'inactive', hypervisor: 'kvm', @@ -114,6 +116,7 @@ export const linode3: Linode = { window: 'Scheduling', }, }, + capabilities: [], created: '2018-02-22T16:11:07', group: 'inactive', hypervisor: 'kvm', @@ -163,6 +166,7 @@ export const linode4: Linode = { window: 'Scheduling', }, }, + capabilities: [], created: '2018-02-22T16:11:07', group: 'inactive', hypervisor: 'kvm', diff --git a/packages/manager/src/features/Linodes/HighPerformanceVolumeIcon.tsx b/packages/manager/src/features/Linodes/HighPerformanceVolumeIcon.tsx index 42b0f497c06..c69d1a6b38a 100644 --- a/packages/manager/src/features/Linodes/HighPerformanceVolumeIcon.tsx +++ b/packages/manager/src/features/Linodes/HighPerformanceVolumeIcon.tsx @@ -5,7 +5,7 @@ import React from 'react'; import type { LinodeCapabilities } from '@linode/api-v4'; interface Props { - linodeCapabilities?: LinodeCapabilities[]; + linodeCapabilities: LinodeCapabilities[]; } export function HighPerformanceVolumeIcon({ linodeCapabilities }: Props) { diff --git a/packages/manager/src/features/Linodes/LinodeEntityDetail.tsx b/packages/manager/src/features/Linodes/LinodeEntityDetail.tsx index 44685efb11d..4a9a9d19f65 100644 --- a/packages/manager/src/features/Linodes/LinodeEntityDetail.tsx +++ b/packages/manager/src/features/Linodes/LinodeEntityDetail.tsx @@ -117,7 +117,7 @@ export const LinodeEntityDetail = (props: Props) => { ipv6={trimmedIPv6} isLKELinode={Boolean(linode.lke_cluster_id)} isVPCOnlyLinode={isVPCOnlyLinode} - linodeCapabilities={linode?.capabilities} + linodeCapabilities={linode.capabilities} linodeId={linode.id} linodeIsInDistributedRegion={linodeIsInDistributedRegion} linodeLabel={linode.label} diff --git a/packages/manager/src/features/Linodes/LinodeEntityDetailBody.tsx b/packages/manager/src/features/Linodes/LinodeEntityDetailBody.tsx index d0303faa3ff..a5df271d844 100644 --- a/packages/manager/src/features/Linodes/LinodeEntityDetailBody.tsx +++ b/packages/manager/src/features/Linodes/LinodeEntityDetailBody.tsx @@ -68,7 +68,7 @@ export interface BodyProps { ipv6: Linode['ipv6']; isLKELinode: boolean; // indicates whether linode belongs to an LKE cluster isVPCOnlyLinode: boolean; - linodeCapabilities?: LinodeCapabilities[]; + linodeCapabilities: LinodeCapabilities[]; linodeId: number; linodeIsInDistributedRegion: boolean; linodeLabel: string; diff --git a/packages/manager/src/features/Linodes/LinodesLanding/LinodeRow/LinodeRow.test.tsx b/packages/manager/src/features/Linodes/LinodesLanding/LinodeRow/LinodeRow.test.tsx index 8d2a11edd56..d25057816fc 100644 --- a/packages/manager/src/features/Linodes/LinodesLanding/LinodeRow/LinodeRow.test.tsx +++ b/packages/manager/src/features/Linodes/LinodesLanding/LinodeRow/LinodeRow.test.tsx @@ -33,6 +33,7 @@ describe('LinodeRow', () => { }} alerts={linode.alerts} backups={linode.backups} + capabilities={linode.capabilities} created={linode.created} group={linode.group} hypervisor={linode.hypervisor} diff --git a/packages/manager/src/features/Linodes/LinodesLanding/ListView.tsx b/packages/manager/src/features/Linodes/LinodesLanding/ListView.tsx index e09cc3a0326..2ea351f5d50 100644 --- a/packages/manager/src/features/Linodes/LinodesLanding/ListView.tsx +++ b/packages/manager/src/features/Linodes/LinodesLanding/ListView.tsx @@ -38,6 +38,7 @@ export const ListView = (props: RenderLinodesProps) => { }} alerts={linode.alerts} backups={linode.backups} + capabilities={linode.capabilities} created={linode.created} group={linode.group} hypervisor={linode.hypervisor} diff --git a/packages/manager/src/features/Volumes/VolumeTableRow.tsx b/packages/manager/src/features/Volumes/VolumeTableRow.tsx index 8310da890dc..c6609a6b34f 100644 --- a/packages/manager/src/features/Volumes/VolumeTableRow.tsx +++ b/packages/manager/src/features/Volumes/VolumeTableRow.tsx @@ -126,9 +126,11 @@ export const VolumeTableRow = React.memo((props: Props) => { })} > {volume.label} - + {linodeCapabilities && ( + + )} {isEligibleForUpgradeToNVMe && (