Add explicit scope to the new repo form#5240
Conversation
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
✅ Deploy Preview for kubeapps-dev canceled.Built without sensitive environment variables
|
|
Nice to see this UX improvement when configuring repositories. Thanks @antgamdia! |
| namespace: isNamespaceScoped | ||
| ? namespace | ||
| : getGlobalNamespaceOrNamespace(namespace, plugin?.name, currentNsConfig), | ||
| isNamespaceScoped, |
There was a problem hiding this comment.
Passing either the current namespace or the corresponding global one if "global" is selected.
| setIsNamespaceScoped( | ||
| !isGlobalNamespace(namespace, PluginNames.PACKAGES_FLUX, currentNsConfig), |
There was a problem hiding this comment.
I'm wondering if we should change the setIsNamespaceScoped with setIsGlobalScoped to match the isGlobal function. However, the parameter used in the API is namespaceScoped, so I've tried to stick to this API field name.
Happy to change if you think otherwise
| const kubeappsManagedSecretText = "Provide the secret values"; | ||
|
|
||
| const isUserManagedSecretToggle = ( | ||
| const isUserManagedSecretToggle = (section: string) => ( |
There was a problem hiding this comment.
Just adding the proper id and for tags to the labels to comply with the a11y requirements. The linter missed it bc it is being dynamically generated.
| placeholder="Description of the repository" | ||
| value={description || ""} | ||
| onChange={handleDescriptionChange} | ||
| disabled={plugin?.name === (PluginNames.PACKAGES_KAPP as string)} |
There was a problem hiding this comment.
Disabling description if the plugin is kapp
| {repo.namespaceScoped || | ||
| (isGlobalNamespace(namespace, plugin?.name, currentNsConfig) && ( |
There was a problem hiding this comment.
Using either the field from the repo object (editing the existing repo) or calculating if the ns is global or not.
| } | ||
| } | ||
|
|
||
| export function getGlobalNamespaceOrNamespace( |
There was a problem hiding this comment.
This should belong to each plugin's config
Description of the change
Adding an explicit scope for selecting whether the repo should be namespace or global + some info messages to the user.
Benefits
Adding a global repo will no longer require switching the context, which wasn't something trivial to figure out as a user.
Possible drawbacks
N/A
Applicable issues
Additional information
Squeezing two changes: