-
Notifications
You must be signed in to change notification settings - Fork 13
Project Import: Use allowed namespaces when importing #7
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -260,6 +260,14 @@ export default function ImportAKSProjects() { | |||||||||||||||||||||
| continue; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // add allowed namespaces | ||||||||||||||||||||||
| const settings = JSON.parse( | ||||||||||||||||||||||
| localStorage.getItem(`cluster_settings.${clusterName}`) || '{}' | ||||||||||||||||||||||
| ); | ||||||||||||||||||||||
|
Comment on lines
+264
to
+266
|
||||||||||||||||||||||
| const settings = JSON.parse( | |
| localStorage.getItem(`cluster_settings.${clusterName}`) || '{}' | |
| ); | |
| const rawSettings = localStorage.getItem(`cluster_settings.${clusterName}`); | |
| let settings: any; | |
| try { | |
| settings = rawSettings ? JSON.parse(rawSettings) : {}; | |
| } catch { | |
| settings = {}; | |
| } |
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.
Same here. It's a valid point IMHO.
Copilot
AI
Jan 12, 2026
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.
The allowedNamespaces array can contain duplicates if the import function is called multiple times for the same cluster. Consider checking if a namespace already exists in the array before adding it, or use a Set to ensure uniqueness. This could happen if a user imports the same namespaces again.
| settings.allowedNamespaces.push(...namespacesInCluster.map(it => it.namespace.name)); | |
| const allowedNamespacesSet = new Set<string>(settings.allowedNamespaces); | |
| for (const { namespace } of namespacesInCluster) { | |
| allowedNamespacesSet.add(namespace.name); | |
| } | |
| settings.allowedNamespaces = Array.from(allowedNamespacesSet); |
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 guess this can't hurt doing.
Uh oh!
There was an error while loading. Please reload this page.