-
Notifications
You must be signed in to change notification settings - Fork 593
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
The +Add extension url can be parametrized for namespace #4940
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mareklibra 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 |
@@ -31,12 +31,15 @@ const Item: React.FC<ItemProps> = ({ | |||
// eslint-disable-next-line react-hooks/rules-of-hooks | |||
.map((descriptor) => useAccessReview({ namespace, ...descriptor })) | |||
.every((x) => x); | |||
|
|||
const resolvedUrl = url ? url.replace(':namespace', namespace) : undefined; |
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.
Good idea.
URL by definition of the type is always defined.
What about using a stricter regex replacement such as this:
const resolvedUrl = url ? url.replace(':namespace', namespace) : undefined; | |
const resolvedUrl = url.replace(/:namespace\b/g, namespace); |
Currently we do not show this page within the all namespaces
selection. So we are ok to ensure that there is always a valid namespace option for replacement.
This change has been incorporated into #4933, so closing here. |
With this patch, the
AddAction
extension ofdev-console
can be parametrized for namespace by using:namespace
placeholder within the URL.Example:
Depends on:
+Add
extensionFirst commit will be removed once #4933 lands.