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

Refactors Modal usage #971

Merged
merged 2 commits into from
Aug 23, 2023

Conversation

bipuladh
Copy link
Contributor

@bipuladh bipuladh commented Aug 16, 2023

Notable changes:
Uses useModal hook exposed as part of SDK in favour of temporary workaround
Kebab Menu internally handles launching modal and figuring out the correct modal.
Components will handle the translation of kebab menu items externally instead of passing a function that takes t as an argument.

@bipuladh bipuladh requested review from SanjalKatiyar, GowthamShanmugam and vbnrh and removed request for GowthamShanmugam August 16, 2023 09:15
Comment on lines +87 to +89
return !loaded ? (
<LoadingBox />
) : (
Copy link
Collaborator

Choose a reason for hiding this comment

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

DetailsPage takes loaded and loadError props to internally display the LoadingBox...

Suggested change
return !loaded ? (
<LoadingBox />
) : (
return

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is from before. Let's refactor this in a different PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

okay...

const launchModal = React.useCallback(
() => launcher(STATUS_MODAL, dataPoliciesStatus),
() => launcher(DataPoliciesStatusModal, dataPoliciesStatus),
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't we need to pass isOpen = true here as well ?? I don't think dataPoliciesStatus has that key...


const history = useHistory();

const launchModal = React.useCallback(
() => launcher(NS_STORE_MODAL_KEY, null),
() => launcher(NamespaceStoreCreateModal, null),
Copy link
Collaborator

Choose a reason for hiding this comment

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

same doubt here... NamespaceStoreCreateModal is expecting isOpen prop, don't we need to pass it ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

earlier useModalLauncher was passing it... I think now we might have to do it explicitly...

},
]}
/>
);
}, [launchModal, resource, namespace]);
}, [resource, namespace]);
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
}, [resource, namespace]);
}, [t, resource, namespace]);

onEdit={() =>
launchModal(ModalKeys.EDIT_LABELS, { resource, resourceModel })
}
onEdit={() => launchModal(EditLabelModal, { resource, resourceModel })}
Copy link
Collaborator

Choose a reason for hiding this comment

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

isOpen = true ??

@@ -358,7 +358,7 @@ export const ResourceSummary: React.FC<ResourceSummaryProps> = ({
type="button"
isInline
onClick={() =>
launchModal(ModalKeys.EDIT_ANN, {
launchModal(AnnotationsModal, {
Copy link
Collaborator

@SanjalKatiyar SanjalKatiyar Aug 21, 2023

Choose a reason for hiding this comment

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

isOpen = true ??
Ideally Modal itself should use isOpen as true by default, but okay if we don't want to make changes to modal in this PR... but we might need to pass the prop explicitly if that's the case ??

@alfonsomthd
Copy link
Collaborator

/lgtm

@alfonsomthd
Copy link
Collaborator

/retest

@SanjalKatiyar
Copy link
Collaborator

/lgtm

@bipuladh
Copy link
Contributor Author

/test odf-console-e2e-aws

Uses useModal hook exposed as part of SDK in favour of temporary workaround

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 23, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 23, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alfonsomthd, bipuladh, 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:
  • OWNERS [SanjalKatiyar,bipuladh]

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

@openshift-merge-robot openshift-merge-robot merged commit 979dcae into red-hat-storage:master Aug 23, 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.

4 participants