Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upcoming: [M3-8145] – Update LDE copy in Linode Create flow when Distributed region is selected #10576

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Revise LDE copy in Linode Create flow when Distributed region is selected ([#10576](https://github.com/linode/manager/pull/10576))
23 changes: 20 additions & 3 deletions packages/manager/src/components/AccessPanel/AccessPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Theme } from '@mui/material/styles';
import * as React from 'react';
import { makeStyles } from 'tss-react/mui';

import {
DISK_ENCRYPTION_DEFAULT_DISTRIBUTED_INSTANCES,
DISK_ENCRYPTION_DISTRIBUTED_DESCRIPTION,
DISK_ENCRYPTION_GENERAL_DESCRIPTION,
DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY,
} from 'src/components/DiskEncryption/constants';
import { DiskEncryption } from 'src/components/DiskEncryption/DiskEncryption';
import { useIsDiskEncryptionFeatureEnabled } from 'src/components/DiskEncryption/utils';
import { Paper } from 'src/components/Paper';
import { getIsDistributedRegion } from 'src/components/RegionSelect/RegionSelect.utils';
import { SuspenseLoader } from 'src/components/SuspenseLoader';
import { Typography } from 'src/components/Typography';
import { useRegionsQuery } from 'src/queries/regions/regions';
Expand All @@ -17,6 +19,8 @@ import { doesRegionSupportFeature } from 'src/utilities/doesRegionSupportFeature
import { Divider } from '../Divider';
import UserSSHKeyPanel from './UserSSHKeyPanel';

import type { Theme } from '@mui/material/styles';

const PasswordInput = React.lazy(
() => import('src/components/PasswordInput/PasswordInput')
);
Expand Down Expand Up @@ -94,6 +98,11 @@ export const AccessPanel = (props: Props) => {
'Disk Encryption'
);

const isDistributedRegion = getIsDistributedRegion(
regions ?? [],
selectedRegion ?? ''
);

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) =>
_handleChange(e.target.value);

Expand All @@ -111,9 +120,17 @@ export const AccessPanel = (props: Props) => {
<>
<Divider spacingBottom={20} spacingTop={24} />
<DiskEncryption
descriptionCopy={DISK_ENCRYPTION_GENERAL_DESCRIPTION}
descriptionCopy={
isDistributedRegion
? DISK_ENCRYPTION_DISTRIBUTED_DESCRIPTION
: DISK_ENCRYPTION_GENERAL_DESCRIPTION
}
disabledReason={
isDistributedRegion
? DISK_ENCRYPTION_DEFAULT_DISTRIBUTED_INSTANCES
: DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY
}
disabled={!regionSupportsDiskEncryption}
disabledReason={DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY}
isEncryptDiskChecked={diskEncryptionEnabled ?? false}
onChange={() => toggleDiskEncryptionEnabled()}
/>
Expand Down
13 changes: 11 additions & 2 deletions packages/manager/src/components/DiskEncryption/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ import React from 'react';

import { Link } from 'src/components/Link';

// @TODO LDE: Update "Learn more" link
const DISK_ENCRYPTION_GUIDE_LINK =
'https://www.linode.com/docs/products/compute/compute-instances/guides/local-disk-encryption';

export const DISK_ENCRYPTION_GENERAL_DESCRIPTION = (
<>
Secure this Linode using data at rest encryption. Data center systems take
care of encrypting and decrypting for you. After the Linode is created, use
Rebuild to enable or disable this feature. <Link to="">Learn more</Link>.
Rebuild to enable or disable this feature.{' '}
<Link to={DISK_ENCRYPTION_GUIDE_LINK}>Learn more</Link>.
</>
);

export const DISK_ENCRYPTION_DISTRIBUTED_DESCRIPTION =
'Distributed Compute Instances are secured using disk encryption. Encryption and decryption are automatically managed for you.';

const DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_DOCS_LINK =
'https://www.linode.com/docs/products/compute/compute-instances/guides/local-disk-encryption/';

Expand All @@ -30,6 +36,9 @@ export const DISK_ENCRYPTION_UPDATE_PROTECT_CLUSTERS_BANNER_KEY =
export const DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY =
'Disk encryption is not available in the selected region.';

export const DISK_ENCRYPTION_DEFAULT_DISTRIBUTED_INSTANCES =
'Distributed Compute Instances are encrypted. This setting can not be changed.';

// Guidance
export const DISK_ENCRYPTION_NODE_POOL_GUIDANCE_COPY =
'To enable disk encryption, delete the node pool and create a new node pool. New node pools are always encrypted.';
Expand Down
20 changes: 18 additions & 2 deletions packages/manager/src/features/Linodes/LinodeCreatev2/Access.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { Controller, useFormContext, useWatch } from 'react-hook-form';

import UserSSHKeyPanel from 'src/components/AccessPanel/UserSSHKeyPanel';
import {
DISK_ENCRYPTION_DEFAULT_DISTRIBUTED_INSTANCES,
DISK_ENCRYPTION_DISTRIBUTED_DESCRIPTION,
DISK_ENCRYPTION_GENERAL_DESCRIPTION,
DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY,
} from 'src/components/DiskEncryption/constants';
import { DiskEncryption } from 'src/components/DiskEncryption/DiskEncryption';
import { useIsDiskEncryptionFeatureEnabled } from 'src/components/DiskEncryption/utils';
import { Divider } from 'src/components/Divider';
import { Paper } from 'src/components/Paper';
import { getIsDistributedRegion } from 'src/components/RegionSelect/RegionSelect.utils';
import { Skeleton } from 'src/components/Skeleton';
import { inputMaxWidth } from 'src/foundations/themes/light';
import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck';
Expand Down Expand Up @@ -37,6 +40,11 @@ export const Access = () => {
'Disk Encryption'
);

const isDistributedRegion = getIsDistributedRegion(
regions ?? [],
selectedRegion?.id ?? ''
);

const isLinodeCreateRestricted = useRestrictedGlobalGrantCheck({
globalGrantType: 'add_linodes',
});
Expand Down Expand Up @@ -83,12 +91,20 @@ export const Access = () => {
<Controller
render={({ field, fieldState }) => (
<DiskEncryption
descriptionCopy={
isDistributedRegion
? DISK_ENCRYPTION_DISTRIBUTED_DESCRIPTION
: DISK_ENCRYPTION_GENERAL_DESCRIPTION
}
disabledReason={
isDistributedRegion
? DISK_ENCRYPTION_DEFAULT_DISTRIBUTED_INSTANCES
: DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY
}
onChange={(checked) =>
field.onChange(checked ? 'enabled' : 'disabled')
}
descriptionCopy={DISK_ENCRYPTION_GENERAL_DESCRIPTION}
disabled={!regionSupportsDiskEncryption}
disabledReason={DISK_ENCRYPTION_UNAVAILABLE_IN_REGION_COPY}
error={fieldState.error?.message}
isEncryptDiskChecked={field.value === 'enabled'}
/>
Expand Down
Loading