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

Modified wizard flow with 4.15 specific changes #1100

Conversation

GowthamShanmugam
Copy link
Contributor

@GowthamShanmugam GowthamShanmugam commented Nov 13, 2023

It has a few 4.15-related changes for already existing wizard steps.

@GowthamShanmugam
Copy link
Contributor Author

image

@GowthamShanmugam
Copy link
Contributor Author

image

@GowthamShanmugam
Copy link
Contributor Author

image

@GowthamShanmugam GowthamShanmugam changed the title [Part-2] Modified wizard flow to simplify imperative application implementation Modified wizard flow with 4.15 specific changes Nov 20, 2023
children?: React.ReactNode;
};

type ReviewAndCreationStepProps = ReviewAndCreateStep & {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type ReviewAndCreationStepProps = ReviewAndCreateStep & {
type ReviewAndCreationGroupProps = ReviewAndCreateStep & {

</DescriptionListGroup>
);

type ReviewAndCreateStep = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits:

Suggested change
type ReviewAndCreateStep = {
type ReviewAndCreateStepProps = {

Comment on lines 48 to 49
title?: React.ReactNode;
description?: React.ReactNode;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why all props are optional ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! title can't be optional

Comment on lines 43 to 44
className?: string;
children?: React.ReactNode;
Copy link
Collaborator

@SanjalKatiyar SanjalKatiyar Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if all props are optional, what would this FC do if we do not pass anything to it ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, children has to be mandatory

!!dataPolicy.placementControlInfo.every((drpc) => !!drpc.pvcSelector?.length);
const isPVCSelectorFound = (pvcSelectors: PVCSelectorType[]) =>
!!pvcSelectors.length &&
!!pvcSelectors.every((pvcSelector) => !!pvcSelector?.labels?.length);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!pvcSelectors.every((pvcSelector) => !!pvcSelector?.labels?.length);
!!pvcSelectors.every((pvcSelector) => !!pvcSelector.labels?.length);

Comment on lines 41 to 42
? pvcSelectors.map((pvcSelector) =>
!!pvcSelector ? [pvcSelector.placementName, pvcSelector.labels] : []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if u r doing a map over pvcSelectors, then pvcSelector should be there, why do we need ternary condition inside a callback ??

? t('{{count}} placements', { count: selectorCount })
: pvcSelectors[0].placementName;

const labels = React.useMemo(() => getLabels(pvcSelectors), [pvcSelectors]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need useMemo here ??

Copy link
Contributor Author

@GowthamShanmugam GowthamShanmugam Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const getLabels = (pvcSelectors: PVCSelectorType[]): string[] =>
pvcSelectors.reduce((acc, selectors) => [...acc, ...selectors.labels], []);

get label is creating an array, it may cause re-render

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but we do not want to keep reference of labels same right ? we r not passing it to any dependency list or anything...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless u r setting state in getLabels, it will not cause re-render...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok got it, i will keep this in mind.

Comment on lines 66 to 68
drPolicy.spec.schedulingInterval !== '0m'
? REPLICATION_TYPE.ASYNC
: REPLICATION_TYPE.SYNC,
Copy link
Collaborator

@SanjalKatiyar SanjalKatiyar Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we using this check somewhere else ?? If so, we can create a separate utility function for this... else it is okay...

@@ -636,3 +636,6 @@ export const findDeploymentClusters = (
return !!lastDeploymentClusterName ? [lastDeploymentClusterName] : [];
}
};

export const getDRPolicyStatus = (isValidated, t) =>
isValidated ? t('Validated') : t('Not Validated');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits: should we ??

Suggested change
isValidated ? t('Validated') : t('Not Validated');
isValidated ? t('Validated') : t('Not validated');

Signed-off-by: Gowtham Shanmugasundaram <[email protected]>
@SanjalKatiyar
Copy link
Collaborator

/approve
/lgtm

Copy link
Contributor

openshift-ci bot commented Nov 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GowthamShanmugam, SanjalKatiyar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 5646fc8 into red-hat-storage:master Nov 27, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants