From ada02384b050a856e475959d883ea274373734d5 Mon Sep 17 00:00:00 2001 From: YanJin Date: Fri, 15 Sep 2023 15:32:27 +0200 Subject: [PATCH] ui: remove xcore location as the destination of the transition workflow --- src/react/workflow/TransitionForm.tsx | 7 ++++++- .../__tests__/TransitionForm.test.tsx | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/react/workflow/TransitionForm.tsx b/src/react/workflow/TransitionForm.tsx index c0d3ca203..e69a5d39d 100644 --- a/src/react/workflow/TransitionForm.tsx +++ b/src/react/workflow/TransitionForm.tsx @@ -91,7 +91,12 @@ export function GeneralTransitionGroup({ } const locationsToOptions = (locations: Locations) => { - return Object.keys(locations).map((value) => ({ value, label: value })); + return Object.entries(locations) + .filter( + ([name, location]) => + location.locationType !== 'location-scality-hdclient-v2', + ) + .map(([name]) => ({ value: name, label: name })); }; export const TransitionForm = ({ locations, prefix = '' }: Props) => { diff --git a/src/react/workflow/__tests__/TransitionForm.test.tsx b/src/react/workflow/__tests__/TransitionForm.test.tsx index 914a6b747..df3912ba3 100644 --- a/src/react/workflow/__tests__/TransitionForm.test.tsx +++ b/src/react/workflow/__tests__/TransitionForm.test.tsx @@ -43,6 +43,7 @@ const locationName = 'chapter-ux'; const locationType = 'ARTESCA'; const triggerDelayDays = '2'; +const hyperdriveLocationName = 'hd-location'; const locations: Locations = { [locationName]: { details: { @@ -58,6 +59,17 @@ const locations: Locations = { name: locationName, objectId: '4ab68d3f-9eec-11ec-ae58-6e38b828d159', }, + [hyperdriveLocationName]: { + details: { + bootstrapList: [ + 'artesca-storage-service-hdservice-proxy.xcore.svc:18888', + ], + repoId: null, + }, + locationType: 'location-scality-hdclient-v2', + name: hyperdriveLocationName, + objectId: '22f31240-4bd3-11ee-98b3-1e5b6f897bc7', + }, }; const WithFormProvider = ({ children }: { children: ReactNode }) => { @@ -385,6 +397,13 @@ describe('TransitionForm', () => { userEvent.click( notFalsyTypeGuard(getByText(storageLocationContainer, /select/i)), ); + // expect the hyperdrive location is not in the list + expect( + screen.queryByRole('option', { + name: new RegExp(`${hyperdriveLocationName}`, 'i'), + }), + ).not.toBeInTheDocument(); + userEvent.click( screen.getByRole('option', { name: new RegExp(`${locationName} \\(${locationType}\\)`, 'i'),