Skip to content

Commit

Permalink
fix: [M3-8563 & M3-8566] – Fix BSE capability for linodes & prevent u…
Browse files Browse the repository at this point in the history
…nnecessary API request on Volume Create page (linode#10920)
  • Loading branch information
dwiley-akamai authored Sep 11, 2024
1 parent 5163579 commit adacc82
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
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

0 comments on commit adacc82

Please sign in to comment.