Skip to content

Commit

Permalink
improve prop optionality
Browse files Browse the repository at this point in the history
  • Loading branch information
bnussman committed Dec 13, 2024
1 parent 4f7c53c commit f80e9e9
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/api-v4/src/linodes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions packages/manager/src/__data__/linodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const linode1: Linode = {
window: 'W2',
},
},
capabilities: [],
created: '2017-12-07T19:12:58',
group: 'active',
hypervisor: 'kvm',
Expand Down Expand Up @@ -65,6 +66,7 @@ export const linode2: Linode = {
window: 'Scheduling',
},
},
capabilities: [],
created: '2018-02-22T16:11:07',
group: 'inactive',
hypervisor: 'kvm',
Expand Down Expand Up @@ -114,6 +116,7 @@ export const linode3: Linode = {
window: 'Scheduling',
},
},
capabilities: [],
created: '2018-02-22T16:11:07',
group: 'inactive',
hypervisor: 'kvm',
Expand Down Expand Up @@ -163,6 +166,7 @@ export const linode4: Linode = {
window: 'Scheduling',
},
},
capabilities: [],
created: '2018-02-22T16:11:07',
group: 'inactive',
hypervisor: 'kvm',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('LinodeRow', () => {
}}
alerts={linode.alerts}
backups={linode.backups}
capabilities={linode.capabilities}
created={linode.created}
group={linode.group}
hypervisor={linode.hypervisor}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 5 additions & 3 deletions packages/manager/src/features/Volumes/VolumeTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ export const VolumeTableRow = React.memo((props: Props) => {
})}
>
{volume.label}
<HighPerformanceVolumeIcon
linodeCapabilities={linodeCapabilities}
/>
{linodeCapabilities && (
<HighPerformanceVolumeIcon
linodeCapabilities={linodeCapabilities}
/>
)}
</Box>

{isEligibleForUpgradeToNVMe && (
Expand Down

0 comments on commit f80e9e9

Please sign in to comment.