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

frontend: global searchbar: Fix multiple clusterSettings items #2907

Merged

Conversation

Faakhir30
Copy link
Contributor

Fixes #2902

Fixed by only displaying the cluster settings page once.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 15, 2025
@joaquimrocha joaquimrocha requested a review from sniok February 17, 2025 10:28
Copy link
Contributor

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

Pretty sure the cluster settings items are ordered alphabetically by context name, maybe keep the option related to the open context rather than just the first in the list? That probably makes the most sense here

Copy link
Contributor

@sniok sniok left a comment

Choose a reason for hiding this comment

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

I think there's a little confusion about why this is happening.
The duplicated items are not duplicated per cluster.
The reason there are two search items called "Cluster Settings" is because we have two routes with the label "Cluster Settings". Check out router.tsx:781

There's one "Cluster Settings" with path /settings
And there's another "Cluster Settings" with path /settings/cluster

The first one is an old one and just redirects to the second one.
We should only show the second "Cluster Settings" (settingsClusterHomeContext ) route in the search results.

I'd suggest filtering it out by the key settingsCluster, the same way it's done in router.tsx:977

@Faakhir30 Faakhir30 force-pushed the duplicate_settings_in_search branch from 2ad3b93 to 2e1cd19 Compare February 19, 2025 14:05
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 19, 2025
@Faakhir30 Faakhir30 force-pushed the duplicate_settings_in_search branch from 2e1cd19 to 865e320 Compare February 19, 2025 14:05
@Faakhir30
Copy link
Contributor Author

Thanks for the reviews,

I think there's a little confusion about why this is happening.
The duplicated items are not duplicated per cluster.

Yup verified by creating 3 clusters, it was only showing 2 cluster settings items, cluster names are being passed as params, so not considered different routes in defaultRoutes.

There's one "Cluster Settings" with path /settings
And there's another "Cluster Settings" with path /settings/cluster
The first one is an old one and just redirects to the second one.

Regarding the old path, yes I've filtered that as suggested, and now it is showing only 1 cluster setting item referencing key settingsClusterHomeContext.

@Faakhir30 Faakhir30 requested review from sniok and skoeva February 19, 2025 14:07
Copy link
Contributor

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

My apologies for the confusion, LGTM

@Faakhir30 Faakhir30 force-pushed the duplicate_settings_in_search branch from 865e320 to 0099b31 Compare February 19, 2025 16:11
@Faakhir30 Faakhir30 force-pushed the duplicate_settings_in_search branch from 0099b31 to 426801a Compare February 19, 2025 16:13
Copy link
Contributor

@sniok sniok left a comment

Choose a reason for hiding this comment

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

looks good, thanks!

@joaquimrocha joaquimrocha merged commit 15e6b2f into headlamp-k8s:main Feb 21, 2025
15 checks passed
@joaquimrocha
Copy link
Collaborator

Thanks @Faakhir30 !

@Faakhir30 Faakhir30 deleted the duplicate_settings_in_search branch February 21, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple 'cluster settings' in search bar
4 participants