Skip to content

Commit

Permalink
Bug 2067708: Fix invalid-mapping check to allow mapping items by name…
Browse files Browse the repository at this point in the history
… or id (kubev2v#961)
  • Loading branch information
mturley committed Jun 17, 2022
1 parent 99612fa commit 1c3bf03
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/web/src/app/Mappings/components/helpers.ts
Expand Up @@ -124,6 +124,9 @@ export const useEditingMappingPrefillEffect = (
return { isDonePrefilling };
};

export const doesSourceExist = (availableSources: MappingSource[], mappingItem: MappingItem) =>
!!getMappingSourceByRef(availableSources, mappingItem.source);

export const doesTargetExist = (
mappingType: MappingType,
availableTargets: MappingTarget[],
Expand All @@ -148,6 +151,6 @@ export const isMappingValid = (
): boolean =>
(mapping.spec.map as MappingItem[]).every(
(mappingItem) =>
availableSources.some((source) => source.id === mappingItem.source.id) &&
doesSourceExist(availableSources, mappingItem) &&
doesTargetExist(mappingType, availableTargets, mappingItem)
);

0 comments on commit 1c3bf03

Please sign in to comment.