Skip to content

Commit

Permalink
Merge pull request #1753 from GowthamShanmugam/DFBUGS-970
Browse files Browse the repository at this point in the history
[DR] Fix assign policy wizard PVC selection step issue
  • Loading branch information
openshift-merge-bot[bot] authored Dec 5, 2024
2 parents 799dfa6 + 1230895 commit 9bd5776
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ import {
import '../../../../style.scss';
import '../style.scss';

const getPlacementTags = (pvcSelectors: PVCSelectorType[]) =>
const getPlacementTags = (pvcSelectors: PVCSelectorType[]): TagsType =>
!!pvcSelectors.length
? pvcSelectors.map((pvcSelector) => [
? pvcSelectors.map((pvcSelector, index) => [
pvcSelector.placementName,
pvcSelector.labels,
index,
])
: [[]];
: [['', [], 0]];

const getLabelsFromSearchResult = (searchResult: SearchResult): string[] => {
const pvcLabels =
Expand All @@ -73,13 +74,14 @@ const getLabelsFromSearchResult = (searchResult: SearchResult): string[] => {

const getLabelsFromTags = (tags: TagsType, currIndex: number): string[] =>
tags.reduce((acc, tag, index) => {
const labels: string[] = (tag?.[1] || []) as string[];
const labels: string[] =
(tag?.[NameValueEditorPair.Value] as string[]) || [];
return currIndex !== index ? [...acc, ...labels] : acc;
}, []) as string[];

const getPlacementsFromTags = (tags: TagsType, currIndex: number): string[] =>
tags.reduce((acc, tag, index) => {
const placement: string = tag?.[0] as string;
const placement: string = tag?.[NameValueEditorPair.Name] as string;
return currIndex !== index ? [...acc, placement] : acc;
}, []) as string[];

Expand Down Expand Up @@ -346,7 +348,7 @@ export const PVCDetailsWizardContent: React.FC<PVCDetailsWizardContentProps> =
);
};

type TagsType = (string | string[])[][];
type TagsType = (string | string[] | number)[][];

type ExtraProps = {
unProtectedPlacementNames: string[];
Expand Down

0 comments on commit 9bd5776

Please sign in to comment.