-
Notifications
You must be signed in to change notification settings - Fork 615
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-4405 expose useCreateNamespaceOrProjectModal #14623
base: master
Are you sure you want to change the base?
CONSOLE-4405 expose useCreateNamespaceOrProjectModal #14623
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: upalatucci The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Thanks, it makes sense to be to expose a modal for creating projects.
@@ -883,6 +884,26 @@ export const useLabelsModal: UseLabelsModal = require('@console/shared/src/hooks | |||
export const useActiveNamespace: UseActiveNamespace = require('@console/shared/src/hooks/useActiveNamespace') | |||
.useActiveNamespace; | |||
|
|||
/** | |||
* A hook that provides a callback to launch a modal for open the CreateProjectModal or CreateNamespaceModal. |
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.
I haven't dug into the code, but it's a little odd that it will launch one or the other. Do we know when one or the other is chosen? Is it based on RBAC or something else? We should add that to the description.
Is there any reason we can't expose a hook that only launches the create project modal instead, or does your plugin really need the namespace modal in some cases?
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.
Yes it's based on the flag const isOpenShift = useFlag(FLAGS.OPENSHIFT);
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 also have useCreateProjectModal
and useCreateNamespaceModal
but I'm not sure what we want to expose
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.
OK, we should explain that in the description.
* A hook that provides a callback to launch a modal for open the CreateProjectModal or CreateNamespaceModal. | ||
* | ||
* @returns A function which will launch a modal for creating a project. | ||
* @example |
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.
Thank you for the code example 👍 Not enough of our SDK docs have this.
8675b2f
to
554d93c
Compare
@upalatucci Does this honor the extension point that overrides the create project modal? We also need to figure out how this interacts with the fix #14585 for when there are multiple create project extensions. We've started rendering it as a dropdown in that case. /cc @TheRealJon |
554d93c
to
d1007a0
Compare
@spadgett yes. It's the same hook used through the whole console repo. |
@upalatucci When there are multiple extension points, we've switched to a dropdown. I'm not sure how that will interact with this hook that returns a single action. We might have to expose a component that prompts the user first when there are multiple plugins with project creation extensions. |
@upalatucci: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/hold There are concerns about how this interacts with #14585 |
The
useCreateNamespaceOrProjectModal
is useful for those plugins that want to launch the project modal.