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

fix: [M3-8563 & M3-8566] – Fix BSE capability for linodes & prevent unnecessary API request on Volume Create page #10920

Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-10920-added-1726070878408.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Added
---

LinodeCapabilities type used for `capabilities` property of Linode interface ([#10920](https://github.com/linode/manager/pull/10920))
4 changes: 3 additions & 1 deletion packages/api-v4/src/linodes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface Linode {
id: number;
alerts: LinodeAlerts;
backups: LinodeBackups;
capabilities?: string[]; // @TODO BSE: Remove optionality once BSE is fully rolled out
capabilities?: LinodeCapabilities[]; // @TODO BSE: Remove optionality once BSE is fully rolled out
created: string;
disk_encryption?: EncryptionStatus; // @TODO LDE: Remove optionality once LDE is fully rolled out
region: string;
Expand Down Expand Up @@ -54,6 +54,8 @@ export interface LinodeBackups {
last_successful: string | null;
}

export type LinodeCapabilities = 'Block Storage Encryption';

export type Window =
| 'Scheduling'
| 'W0'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Update BSE capability for Linodes to be `Block Storage Encryption` instead of `blockstorage_encryption` ([#10920](https://github.com/linode/manager/pull/10920))
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('volume create flow', () => {
.click();

// @TODO BSE: once BSE is fully rolled out, check for the notice (selected linode doesn't have
// blockstorage_encryption capability + user checked "Encrypt Volume" checkbox) instead of the absence of it
// "Block Storage Encryption" capability + user checked "Encrypt Volume" checkbox) instead of the absence of it
cy.findByText(CLIENT_LIBRARY_UPDATE_COPY).should('not.exist');

cy.findByText('Create Volume').click();
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('volume create flow', () => {
const mockLinode = linodeFactory.build({
region: mockRegions[0].id,
id: 123456,
capabilities: ['blockstorage_encryption'],
capabilities: ['Block Storage Encryption'],
});

mockGetAccount(mockAccount).as('getAccount');
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/features/Volumes/VolumeCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ export const VolumeCreate = () => {

const { data: linode } = useLinodeQuery(
linode_id ?? -1,
isBlockStorageEncryptionFeatureEnabled
isBlockStorageEncryptionFeatureEnabled && linode_id !== null
);

const linodeSupportsBlockStorageEncryption = Boolean(
linode?.capabilities?.includes('blockstorage_encryption')
linode?.capabilities?.includes('Block Storage Encryption')
);

const linodeError = touched.linode_id ? errors.linode_id : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const LinodeVolumeAddDrawer = (props: Props) => {
} = useIsBlockStorageEncryptionFeatureEnabled();

const linodeSupportsBlockStorageEncryption = Boolean(
linode.capabilities?.includes('blockstorage_encryption')
linode.capabilities?.includes('Block Storage Encryption')
);

const toggleMode = (mode: 'attach' | 'create') => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const LinodeVolumeAttachForm = (props: Props) => {

const linodeRequiresClientLibraryUpdate =
volume?.encryption === 'enabled' &&
Boolean(!linode.capabilities?.includes('blockstorage_encryption'));
Boolean(!linode.capabilities?.includes('Block Storage Encryption'));

React.useEffect(() => {
// When the volume is encrypted but the linode requires a client library update, we want to show the client library copy
Expand Down
Loading