-
Notifications
You must be signed in to change notification settings - Fork 667
CONSOLE-4711: Replace confirmModal for useWarningModal #15448
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
CONSOLE-4711: Replace confirmModal for useWarningModal #15448
Conversation
|
@Mylanos: This pull request references CONSOLE-4711 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/label tide-merge-method-squash |
|
@Mylanos: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/label tide/merge-method-squash |
|
/retest |
1 similar comment
|
/retest |
|
/cc |
| /** | ||
| * useWarningModalWithProps returns a WarningModal launcher that accepts override props | ||
| */ | ||
| export type WarningModalCallbackWithProps = (overrides: Omit<WarningModalProps, 'isOpen'>) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably dry up Omit<WarningModalProps, 'isOpen'> as ControlledWarningModalProps
| export const useWarningModalWithProps = ( | ||
| props?: Partial<Omit<WarningModalProps, 'isOpen'>>, | ||
| ): WarningModalCallbackWithProps => { | ||
| const launcher = useOverlay(); | ||
| return (overrides) => { | ||
| launcher<WarningModalProps>(ControlledWarningModal, { ...(props || {}), ...overrides }); | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might look cleaner
| export const useWarningModalWithProps = ( | |
| props?: Partial<Omit<WarningModalProps, 'isOpen'>>, | |
| ): WarningModalCallbackWithProps => { | |
| const launcher = useOverlay(); | |
| return (overrides) => { | |
| launcher<WarningModalProps>(ControlledWarningModal, { ...(props || {}), ...overrides }); | |
| }; | |
| }; | |
| export const useWarningModalWithProps = ( | |
| props: Partial<Omit<WarningModalProps, 'isOpen'>> = {}, | |
| ): WarningModalCallbackWithProps => { | |
| const launcher = useOverlay(); | |
| return (overrides) => { | |
| launcher<WarningModalProps>(ControlledWarningModal, { ...props, ...overrides }); | |
| }; | |
| }; |
i'm also wondering if we should just include overrides in the callback of useWarningModal, so we don't need to have two hooks here, or if we should be doing further refactors to make this hook not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the first note, we would have to change the prop to props: Partial<Omit<WarningModalProps, 'isOpen'>> = { children: <></>} since Partial<Omit<WarningModalProps, 'isOpen'>> require children and we are assigning to this type, which doesn't seem to be as clean as the fallback {}.
For the second note I was thinking about that as well, but there is a problem that the ControlledWarningModal props provided to the launcher would have to define a default children prop since its a required WarningModalProps PF prop.
Something like this:
| export const useWarningModalWithProps = ( | |
| props?: Partial<Omit<WarningModalProps, 'isOpen'>>, | |
| ): WarningModalCallbackWithProps => { | |
| const launcher = useOverlay(); | |
| return (overrides) => { | |
| launcher<WarningModalProps>(ControlledWarningModal, { ...(props || {}), ...overrides }); | |
| }; | |
| }; | |
| export const useWarningModal = ( | |
| props: Partial<ControlledWarningModalProps>, | |
| ): WarningModalCallbackWithProps => { | |
| const launcher = useOverlay(); | |
| return useCallback((overrides) => { | |
| const mergedProps: WarningModalProps = { | |
| children: <></>, // Default children | |
| ...(props || {}), | |
| ...(overrides || {}) | |
| }; | |
| launcher<WarningModalProps>(ControlledWarningModal, mergedProps); | |
| }, [launcher, props]); | |
| }; | |
| export type WarningModalCallbackWithProps = (overrides?: ControlledWarningModalProps) => void; |
Seems like cleaner solution to me WDYT? @logonoff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. maybe children can be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works as well.
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| [kindObj, resource, t], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we need openConfirm in the deps array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because adding it to the dependency list causes max depth exceeded errors when opening the actions list - similarly as in https://github.com/openshift/console/pull/15448/files#diff-e977f2b41b8b2fed19e80f900dec493780f87d0476f70280768f6b6957c56ba0R96
will add a comment.
24bbcd9 to
5b4fffb
Compare
5b4fffb to
138de44
Compare
|
/label px-approved |
138de44 to
0858c30
Compare
|
/uncc |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/assign yapei |
|
Regression test on cluster launched against the pr passed. |
|
@yanpzhan: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
logonoff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/label qe-approved
|
@Mylanos: This pull request references CONSOLE-4711 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, Mylanos The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@Mylanos: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
still missing instances in metal plugin, some references in knative integration tests
console/frontend/packages/knative-plugin/integration-tests/support/step-definitions/eventing/eventing-broker-trigger.ts
Line 106 in 477e212
moveNodeToGroupaction within topology.