1- import { KubeNodePoolResponse , LinodeTypeClass , Region } from '@linode/api-v4' ;
21import Grid from '@mui/material/Unstable_Grid2' ;
32import * as React from 'react' ;
43
54import { CircleProgress } from 'src/components/CircleProgress' ;
5+ import { useIsDiskEncryptionFeatureEnabled } from 'src/components/DiskEncryption/utils' ;
66import { ErrorState } from 'src/components/ErrorState/ErrorState' ;
7- import { ExtendedType , extendType } from 'src/utilities/extendType' ;
7+ import { useRegionsQuery } from 'src/queries/regions/regions' ;
8+ import { doesRegionSupportFeature } from 'src/utilities/doesRegionSupportFeature' ;
9+ import { extendType } from 'src/utilities/extendType' ;
810
11+ import { ADD_NODE_POOLS_DESCRIPTION } from '../ClusterList/constants' ;
912import { KubernetesPlansPanel } from '../KubernetesPlansPanel/KubernetesPlansPanel' ;
1013
14+ import type {
15+ KubeNodePoolResponse ,
16+ LinodeTypeClass ,
17+ Region ,
18+ } from '@linode/api-v4' ;
19+ import type { ExtendedType } from 'src/utilities/extendType' ;
20+
1121const DEFAULT_PLAN_COUNT = 3 ;
1222
1323export interface NodePoolPanelProps {
@@ -23,15 +33,11 @@ export interface NodePoolPanelProps {
2333 typesLoading : boolean ;
2434}
2535
26- export const NodePoolPanel : React . FunctionComponent < NodePoolPanelProps > = (
27- props
28- ) => {
36+ export const NodePoolPanel = ( props : NodePoolPanelProps ) => {
2937 return < RenderLoadingOrContent { ...props } /> ;
3038} ;
3139
32- const RenderLoadingOrContent : React . FunctionComponent < NodePoolPanelProps > = (
33- props
34- ) => {
40+ const RenderLoadingOrContent = ( props : NodePoolPanelProps ) => {
3541 const { typesError, typesLoading } = props ;
3642
3743 if ( typesError ) {
@@ -45,7 +51,7 @@ const RenderLoadingOrContent: React.FunctionComponent<NodePoolPanelProps> = (
4551 return < Panel { ...props } /> ;
4652} ;
4753
48- const Panel : React . FunctionComponent < NodePoolPanelProps > = ( props ) => {
54+ const Panel = ( props : NodePoolPanelProps ) => {
4955 const {
5056 addNodePool,
5157 apiError,
@@ -57,6 +63,12 @@ const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
5763 types,
5864 } = props ;
5965
66+ const {
67+ isDiskEncryptionFeatureEnabled,
68+ } = useIsDiskEncryptionFeatureEnabled ( ) ;
69+
70+ const regions = useRegionsQuery ( ) . data ?? [ ] ;
71+
6072 const [ typeCountMap , setTypeCountMap ] = React . useState < Map < string , number > > (
6173 new Map ( )
6274 ) ;
@@ -81,17 +93,27 @@ const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
8193 setSelectedType ( planId ) ;
8294 } ;
8395
96+ const regionSupportsDiskEncryption = doesRegionSupportFeature (
97+ selectedRegionId ?? '' ,
98+ regions ,
99+ 'Disk Encryption'
100+ ) ;
101+
84102 return (
85103 < Grid container direction = "column" >
86104 < Grid >
87105 < KubernetesPlansPanel
106+ copy = {
107+ isDiskEncryptionFeatureEnabled && regionSupportsDiskEncryption
108+ ? ADD_NODE_POOLS_DESCRIPTION
109+ : 'Add groups of Linodes to your cluster. You can have a maximum of 100 Linodes per node pool.'
110+ }
88111 getTypeCount = { ( planId ) =>
89112 typeCountMap . get ( planId ) ?? DEFAULT_PLAN_COUNT
90113 }
91114 types = { extendedTypes . filter (
92115 ( t ) => t . class !== 'nanode' && t . class !== 'gpu'
93116 ) } // No Nanodes or GPUs in clusters
94- copy = "Add groups of Linodes to your cluster. You can have a maximum of 100 Linodes per node pool."
95117 error = { apiError }
96118 hasSelectedRegion = { hasSelectedRegion }
97119 header = "Add Node Pools"
0 commit comments