Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug DFBUGS-970: [release-4.18-compatibility] [DR] Fix assign policy wizard PVC selection step issue #1757

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading