From 2bfa84e81b54dd6a4a62d0102e3dd0b330e74580 Mon Sep 17 00:00:00 2001 From: Jean-Marc Millet Date: Mon, 9 Sep 2024 16:53:21 +0200 Subject: [PATCH 1/3] add Microsoft office V8 option for veeam configuration --- src/react/databrowser/buckets/details/Overview.tsx | 3 ++- src/react/ui-elements/Veeam/VeeamConfiguration.tsx | 13 +++++++++++-- src/react/ui-elements/Veeam/VeeamConstants.ts | 6 ++++-- src/react/ui-elements/Veeam/useMutationTableData.ts | 9 ++++++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/react/databrowser/buckets/details/Overview.tsx b/src/react/databrowser/buckets/details/Overview.tsx index b4d9686e7..9f6f0dbf0 100644 --- a/src/react/databrowser/buckets/details/Overview.tsx +++ b/src/react/databrowser/buckets/details/Overview.tsx @@ -239,7 +239,8 @@ function Overview({ bucket, ingestionStates }: Props) { tags.status === 'success' && tags.value?.[BUCKET_TAG_VEEAM_APPLICATION]; const isVeeamBucket = (veeamTagApplication === VeeamApplicationType.VEEAM_BACKUP_REPLICATION || - veeamTagApplication === VeeamApplicationType.VEEAM_OFFICE_365) && + veeamTagApplication === VeeamApplicationType.VEEAM_OFFICE_365 || + veeamTagApplication === VeeamApplicationType.VEEAM_OFFICE_365_V8) && VEEAM_FEATURE_FLAG_ENABLED; useEffect(() => { dispatch(getBucketInfo(bucket.name)); diff --git a/src/react/ui-elements/Veeam/VeeamConfiguration.tsx b/src/react/ui-elements/Veeam/VeeamConfiguration.tsx index e3ce86002..c0a71cbe5 100644 --- a/src/react/ui-elements/Veeam/VeeamConfiguration.tsx +++ b/src/react/ui-elements/Veeam/VeeamConfiguration.tsx @@ -27,6 +27,7 @@ import { VEEAM_BACKUP_REPLICATION_XML_VALUE, VEEAM_DEFAULT_ACCOUNT_NAME, VEEAM_OFFICE_365, + VEEAM_OFFICE_365_V8, unitChoices, } from './VeeamConstants'; import { VeeamSkipModal } from './VeeamSkipModal'; @@ -187,7 +188,8 @@ const Configuration = () => { application, capacityBytes: getCapacityBytes(capacity, capacityUnit), enableImmutableBackup: - application === VEEAM_BACKUP_REPLICATION_XML_VALUE + application === VEEAM_BACKUP_REPLICATION_XML_VALUE || + application === VEEAM_OFFICE_365_V8 ? enableImmutableBackup : false, accountName, @@ -298,6 +300,12 @@ const Configuration = () => { > {VEEAM_OFFICE_365} + + {VEEAM_OFFICE_365_V8} + ); }} @@ -321,7 +329,8 @@ const Configuration = () => { /> } /> - {application === VEEAM_BACKUP_REPLICATION_XML_VALUE ? ( + {application === VEEAM_BACKUP_REPLICATION_XML_VALUE || + application === VEEAM_OFFICE_365_V8 ? ( JSON.stringify({ @@ -46,7 +47,8 @@ export const GET_CAPACITY_XML_CONTENT = (capacity: string) => export const VEEAM_DEFAULT_ACCOUNT_NAME = 'Veeam'; export enum VeeamApplicationType { VEEAM_BACKUP_REPLICATION = 'Veeam Backup & Replication', - VEEAM_OFFICE_365 = 'Veeam Backup for Microsoft 365', + VEEAM_OFFICE_365 = 'Veeam Backup for Microsoft 365 (pre-v8)', + VEEAM_OFFICE_365_V8 = 'Veeam Backup for Microsoft 365 (v8)', } export const unitChoices = { GiB: 1024 ** 3, diff --git a/src/react/ui-elements/Veeam/useMutationTableData.ts b/src/react/ui-elements/Veeam/useMutationTableData.ts index 4276b1a4a..77666646a 100644 --- a/src/react/ui-elements/Veeam/useMutationTableData.ts +++ b/src/react/ui-elements/Veeam/useMutationTableData.ts @@ -25,6 +25,7 @@ import { GET_VEEAM_NON_IMMUTABLE_POLICY, SYSTEM_XML_CONTENT, VEEAM_BACKUP_REPLICATION_XML_VALUE, + VEEAM_OFFICE_365_V8, VEEAM_XML_PREFIX, } from './VeeamConstants'; import { useCreateBucket } from '../../next-architecture/domain/business/buckets'; @@ -109,6 +110,7 @@ export const useMutationTableData = ({ const isVeeamVBR = propsConfiguration.application === VEEAM_BACKUP_REPLICATION_XML_VALUE; + const isVeeamVBOV8 = propsConfiguration.application === VEEAM_OFFICE_365_V8; const mutations = isVeeamVBR ? mutationsVBR : mutationsVBO; const instanceId = useInstanceId(); @@ -140,9 +142,10 @@ export const useMutationTableData = ({ createBucketMutation: () => { return { Bucket: propsConfiguration.bucketName, - ObjectLockEnabledForBucket: isVeeamVBR - ? propsConfiguration.enableImmutableBackup - : false, + ObjectLockEnabledForBucket: + isVeeamVBR || isVeeamVBOV8 + ? propsConfiguration.enableImmutableBackup + : false, }; }, createIAMUserMutation: () => { From 7a0512bb62809013061f6f0255511a21ac0e9bf6 Mon Sep 17 00:00:00 2001 From: Jean-Marc Millet Date: Mon, 9 Sep 2024 16:54:10 +0200 Subject: [PATCH 2/3] add a test for MO 365 V8 configuration --- .../Veeam/VeeamConfiguration.test.tsx | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/react/ui-elements/Veeam/VeeamConfiguration.test.tsx b/src/react/ui-elements/Veeam/VeeamConfiguration.test.tsx index 42a418265..c30ff5182 100644 --- a/src/react/ui-elements/Veeam/VeeamConfiguration.test.tsx +++ b/src/react/ui-elements/Veeam/VeeamConfiguration.test.tsx @@ -35,7 +35,11 @@ describe('Veeam Configuration UI', () => { veeamApplicationSelect: () => screen.getByLabelText(/Veeam application/i), veeamVBO: () => screen.getByRole('option', { - name: /Veeam Backup for Microsoft 365/i, + name: /Veeam Backup for Microsoft 365 \(pre-v8\)/i, + }), + veeamVBOV8: () => + screen.getByRole('option', { + name: /Veeam Backup for Microsoft 365 \(v8\)/i, }), }; @@ -101,7 +105,7 @@ describe('Veeam Configuration UI', () => { }); }); - it('should hide immutable backup and Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 is selected', async () => { + it('should hide immutable backup and Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 pre-v8 is selected', async () => { //Setup mockUseAccountsImplementation(); renderVeeamConfigurationForm(); @@ -131,7 +135,7 @@ describe('Veeam Configuration UI', () => { expect(screen.getByText(/Cancel/i)).toBeInTheDocument(); }); - it('should disable immutable backup when Veeam Backup for Microsoft 365 is selected', async () => { + it('should disable immutable backup when Veeam Backup for Microsoft 365 pre-v8 is selected', async () => { const SUT = jest.fn(); mockUseStepper.mockReturnValue({ next: SUT }); mockUseAccountsImplementation(); @@ -145,13 +149,34 @@ describe('Veeam Configuration UI', () => { expect(SUT).toHaveBeenCalledWith({ accountName: 'Veeam', - application: 'Veeam Backup for Microsoft 365', + application: 'Veeam Backup for Microsoft 365 (pre-v8)', bucketName: 'veeam-bucket', capacityBytes: '4294967296', enableImmutableBackup: false, }); }); + it('should show immutable backup but hide Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 v8 is selected', async () => { + const SUT = jest.fn(); + mockUseStepper.mockReturnValue({ next: SUT }); + mockUseAccountsImplementation(); + renderVeeamConfigurationForm(); + + await selectClick(selectors.veeamApplicationSelect()); + await userEvent.click(selectors.veeamVBOV8()); + await userEvent.type(selectors.accountNameInput(), 'Veeam'); + await userEvent.type(selectors.repositoryInput(), 'veeam-bucket'); + await userEvent.click(selectors.continueButton()); + + expect(SUT).toHaveBeenCalledWith({ + accountName: 'Veeam', + application: 'Veeam Backup for Microsoft 365 (v8)', + bucketName: 'veeam-bucket', + capacityBytes: '4294967296', + enableImmutableBackup: true, + }); + }); + it('should display error in case of account name already exists', async () => { //S mockUseAccountsImplementation(); From 5f7ab4ab278b1b8cb40c165c6fd285c272a28b57 Mon Sep 17 00:00:00 2001 From: Jean-Marc Millet Date: Mon, 9 Sep 2024 17:34:31 +0200 Subject: [PATCH 3/3] update VeeamTable test, add test for V8 --- .../ui-elements/Veeam/VeeamTable.test.tsx | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/react/ui-elements/Veeam/VeeamTable.test.tsx b/src/react/ui-elements/Veeam/VeeamTable.test.tsx index a3a903e88..b95972566 100644 --- a/src/react/ui-elements/Veeam/VeeamTable.test.tsx +++ b/src/react/ui-elements/Veeam/VeeamTable.test.tsx @@ -78,7 +78,11 @@ describe('VeeamTable', () => { veeamApplicationSelect: () => screen.getByLabelText(/Veeam application/i), veeamVBO: () => screen.getByRole('option', { - name: /Veeam Backup for Microsoft 365/i, + name: /Veeam Backup for Microsoft 365 \(pre-v8\)/i, + }), + veeamVBOV8: () => + screen.getByRole('option', { + name: /Veeam Backup for Microsoft 365 \(v8\)/i, }), immutableBackupToggle: () => screen.getByLabelText('enableImmutableBackup'), }; @@ -206,7 +210,7 @@ describe('VeeamTable', () => { await verifySuccessActions(mutationActions); }); - it('should skip the SOSAPI setup step when choosing Veeam Backup for Microsoft 365', async () => { + it('should skip the SOSAPI setup step when choosing Veeam Backup for Microsoft 365 (pre-v8)', async () => { //Setup server.resetHandlers(...goodHandlers); setupTest(); @@ -225,6 +229,25 @@ describe('VeeamTable', () => { await verifySuccessActions(VeeamVBOActions); }); + it('should skip the SOSAPI setup when choosing VeeamBackup for Microsoft 365 (v8)', async () => { + //Setup + server.resetHandlers(...goodHandlers); + setupTest(); + //Exercise + //Select Veeam Backup for Microsoft 365 (v8) + await selectClick(selectors.veeamApplicationSelect()); + await userEvent.click(selectors.veeamVBOV8()); + await userEvent.type(selectors.accountName(), VEEAM_DEFAULT_ACCOUNT_NAME); + await userEvent.type(selectors.setBucketName(), bucketName); + + await waitFor(() => { + expect(selectors.continueButton()).toBeEnabled(); + }); + await userEvent.click(selectors.continueButton()); + //V + await verifySuccessActions(VeeamVBOActions); + }); + it('should get non immutable policy when immutable backup is not selected', async () => { //Setup server.resetHandlers(...goodHandlers);