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

CONSOLE-4405 expose useCreateNamespaceOrProjectModal #14623

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

upalatucci
Copy link
Contributor

@upalatucci upalatucci commented Dec 13, 2024

The useCreateNamespaceOrProjectModal is useful for those plugins that want to launch the project modal.

Screenshot 2024-12-13 at 12 13 25

@openshift-ci openshift-ci bot added the component/sdk Related to console-plugin-sdk label Dec 13, 2024
Copy link
Contributor

openshift-ci bot commented Dec 13, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: upalatucci
Once this PR has been reviewed and has the lgtm label, please assign vojtechszocs for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@spadgett spadgett left a 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.
Copy link
Member

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?

Copy link
Contributor Author

@upalatucci upalatucci Dec 13, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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

Copy link
Member

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
Copy link
Member

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.

@upalatucci upalatucci force-pushed the expose-createnamespace-or-project-modal branch from 8675b2f to 554d93c Compare December 13, 2024 11:17
@spadgett
Copy link
Member

@upalatucci Does this honor the extension point that overrides the create project modal?

https://github.com/openshift/console/blob/master/frontend/packages/console-dynamic-plugin-sdk/docs/console-extensions.md#consolecreate-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

@openshift-ci openshift-ci bot requested a review from TheRealJon December 13, 2024 11:42
@upalatucci upalatucci force-pushed the expose-createnamespace-or-project-modal branch from 554d93c to d1007a0 Compare December 13, 2024 11:58
@upalatucci
Copy link
Contributor Author

@spadgett yes. It's the same hook used through the whole console repo.

@spadgett
Copy link
Member

@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.

Copy link
Contributor

openshift-ci bot commented Dec 13, 2024

@upalatucci: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-e2e-aws-ovn d1007a0 link false /test okd-scos-e2e-aws-ovn

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.

@TheRealJon
Copy link
Member

/hold

There are concerns about how this interacts with #14585

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/sdk Related to console-plugin-sdk do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants