Skip to content

Commit

Permalink
upcoming: [M3-8245] – Update "Add Node Pools" description in LKE Crea…
Browse files Browse the repository at this point in the history
…te flow (linode#10578)
  • Loading branch information
dwiley-akamai authored and nikhagra-akamai committed Jun 19, 2024
1 parent 2c6618c commit 72f619e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Update description for Add Node Pools section in LKE Create flow ([#10578](https://github.com/linode/manager/pull/10578))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const ADD_NODE_POOLS_DESCRIPTION =
'Add groups of Linodes to your cluster. You can have a maximum of 250 Linodes per node pool. Node Pool data is encrypted at rest.';
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { KubeNodePoolResponse, LinodeTypeClass, Region } from '@linode/api-v4';
import Grid from '@mui/material/Unstable_Grid2';
import * as React from 'react';

import { CircleProgress } from 'src/components/CircleProgress';
import { useIsDiskEncryptionFeatureEnabled } from 'src/components/DiskEncryption/utils';
import { ErrorState } from 'src/components/ErrorState/ErrorState';
import { ExtendedType, extendType } from 'src/utilities/extendType';
import { useRegionsQuery } from 'src/queries/regions/regions';
import { doesRegionSupportFeature } from 'src/utilities/doesRegionSupportFeature';
import { extendType } from 'src/utilities/extendType';

import { ADD_NODE_POOLS_DESCRIPTION } from '../ClusterList/constants';
import { KubernetesPlansPanel } from '../KubernetesPlansPanel/KubernetesPlansPanel';

import type {
KubeNodePoolResponse,
LinodeTypeClass,
Region,
} from '@linode/api-v4';
import type { ExtendedType } from 'src/utilities/extendType';

const DEFAULT_PLAN_COUNT = 3;

export interface NodePoolPanelProps {
Expand All @@ -23,15 +33,11 @@ export interface NodePoolPanelProps {
typesLoading: boolean;
}

export const NodePoolPanel: React.FunctionComponent<NodePoolPanelProps> = (
props
) => {
export const NodePoolPanel = (props: NodePoolPanelProps) => {
return <RenderLoadingOrContent {...props} />;
};

const RenderLoadingOrContent: React.FunctionComponent<NodePoolPanelProps> = (
props
) => {
const RenderLoadingOrContent = (props: NodePoolPanelProps) => {
const { typesError, typesLoading } = props;

if (typesError) {
Expand All @@ -45,7 +51,7 @@ const RenderLoadingOrContent: React.FunctionComponent<NodePoolPanelProps> = (
return <Panel {...props} />;
};

const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
const Panel = (props: NodePoolPanelProps) => {
const {
addNodePool,
apiError,
Expand All @@ -57,6 +63,12 @@ const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
types,
} = props;

const {
isDiskEncryptionFeatureEnabled,
} = useIsDiskEncryptionFeatureEnabled();

const regions = useRegionsQuery().data ?? [];

const [typeCountMap, setTypeCountMap] = React.useState<Map<string, number>>(
new Map()
);
Expand All @@ -81,17 +93,27 @@ const Panel: React.FunctionComponent<NodePoolPanelProps> = (props) => {
setSelectedType(planId);
};

const regionSupportsDiskEncryption = doesRegionSupportFeature(
selectedRegionId ?? '',
regions,
'Disk Encryption'
);

return (
<Grid container direction="column">
<Grid>
<KubernetesPlansPanel
copy={
isDiskEncryptionFeatureEnabled && regionSupportsDiskEncryption
? ADD_NODE_POOLS_DESCRIPTION
: 'Add groups of Linodes to your cluster. You can have a maximum of 100 Linodes per node pool.'
}
getTypeCount={(planId) =>
typeCountMap.get(planId) ?? DEFAULT_PLAN_COUNT
}
types={extendedTypes.filter(
(t) => t.class !== 'nanode' && t.class !== 'gpu'
)} // No Nanodes or GPUs in clusters
copy="Add groups of Linodes to your cluster. You can have a maximum of 100 Linodes per node pool."
error={apiError}
hasSelectedRegion={hasSelectedRegion}
header="Add Node Pools"
Expand Down

0 comments on commit 72f619e

Please sign in to comment.