Skip to content

Commit

Permalink
ui: remove xcore location as the destination of the transition workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYanJin committed Sep 18, 2023
1 parent 680dd7b commit ada0238
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/react/workflow/TransitionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
19 changes: 19 additions & 0 deletions src/react/workflow/__tests__/TransitionForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const locationName = 'chapter-ux';
const locationType = 'ARTESCA';
const triggerDelayDays = '2';

const hyperdriveLocationName = 'hd-location';
const locations: Locations = {
[locationName]: {
details: {
Expand All @@ -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 }) => {
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit ada0238

Please sign in to comment.