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
Add explicit scope to the new repo form #5240
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -543,12 +579,15 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { | |||
const userManagedSecretText = "Use an existing secret"; | |||
const kubeappsManagedSecretText = "Provide the secret values"; | |||
|
|||
const isUserManagedSecretToggle = ( | |||
const isUserManagedSecretToggle = (section: string) => ( |
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.
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.
@@ -637,6 +676,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { | |||
placeholder="Description of the repository" | |||
value={description || ""} | |||
onChange={handleDescriptionChange} | |||
disabled={plugin?.name === (PluginNames.PACKAGES_KAPP as string)} |
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.
Disabling description if the plugin is kapp
{repo.namespaceScoped || | ||
(isGlobalNamespace(namespace, plugin?.name, currentNsConfig) && ( |
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.
Using either the field from the repo object (editing the existing repo) or calculating if the ns is global or not.
@@ -235,3 +235,21 @@ export function isGlobalNamespace(namespace: string, pluginName: string, kubeapp | |||
return false; | |||
} | |||
} | |||
|
|||
export function getGlobalNamespaceOrNamespace( |
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 should belong to each plugin's config
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
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: