Repository navigation
Remember filters across kind and section switches - #2022
Conversation
PR Summary by QodoRemember filters across resource kinds and section switches
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
1. Shared links can claim filters were restored
|
Switching resource kinds cleared the column and problem filters, and leaving Resources from the nav rail dropped back to a bare Pods list. Keep a per-session memory of each kind's filters and each section's last list URL, recorded from the router location so the URL stays the source of truth. A user kind switch restores that kind's filters; the rail and other section shortcuts return to the remembered list. Links that navigate with their own params, Back/Forward and URL-driven kind changes are unchanged. The namespace pick, investigation focus and drawer/detail params are never remembered. Memory lives in the app mount, so a reload or context switch forgets it and Radar Hub keeps clusters apart. The Namespace column filter gets "Apply to all sections": it sets the header namespace picker to the included values, clears the column filter once that lands, and flashes the picker. Not offered when embedded or under cache-scoped namespaces.
Session memory lost a kind's filters on reload, in a new tab, after a desktop restart and whenever Radar Hub remounted the cluster view. Keep each kind's column and problem filters in localStorage, per cluster. The URL stays the source of truth: a URL with its own list state is shown as is, and only a bare /resources/<kind> restores the saved filters, rewriting the URL with replace. The saved filters are the last ones chosen, by the user or by a link that carries filters; a restore never saves again, and a link without filters (one resource, an owner's pods, a search) leaves them alone. Clear filters removes them. Each tab keeps what it has shown, so filters chosen in another tab don't change it; localStorage only seeds a kind the first time a tab reads it. Bare /resources, which Radar Hub's rail links to, and the Resources rail item go to the last kind. Make active filters visible: Clear filters shows an accent and a count, a line says when filters were restored from the last visit, and the active filters show as removable chips above the table as well as in the empty state. A kind switch that restores filters now adds one history entry instead of two, and the URL sync also reads problem filters, so Back keeps them.
âĶst params "Apply to all sections" hands the namespace scope to the header picker. A Namespace column filter saved on another kind then narrowed or emptied that kind's list with nothing but a chip to explain it, so applying now clears the Namespace column on every kind of the cluster. Other column and problem filters stay. Section memory kept every param except a blocklist, so a param a view added later was replayed as list state: an open Application reopened when returning from the rail. Each section now keeps only the params that shape its list; anything else is dropped. Timeline keeps `time`, which the Home warnings link sets. A fresh load of bare /resources mounted the list before the last kind was known, so it landed on Pods and saved Pods as the last kind. The list now waits for the redirect. Apply to all sections is offered once the per-cluster store exists. The Resources filter params, the filters query helpers and the list route pattern each have one definition now.
74315b8 to
393c289
Compare
|
Code review by qodo was updated up to the latest commit 393c289 |
The host's namespace picker follows ?namespaces=, which the app mirrors from the server pick, so applying the namespaces reaches it as well.
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
On a kind switch the URL write ran once with the previous kind's filters before the new kind's were restored, pushing a URL with the wrong filters.
âĶ and duplicate A reload or a duplicated tab keeps the tab's own Resources filters and section memory (sessionStorage); a new tab starts from the last saved filters. Section memory is now kept per cluster instead of being cleared on context switch.
The Clear link next to "Filters restored" now resets only the kind's column and problem filters. Search, labels and the namespace pick stay. The link is always underlined so it reads as an action.
âĶstate-across-kind-and-section-switches # Conflicts: # web/src/App.tsx
Description
Refs #1864.
Filters were lost when you moved around. Switching resource kinds cleared the column and problem filters. Leaving Resources and coming back through the nav rail opened a bare Pods list. A reload lost everything.
Each kind keeps its filters, per cluster
filters,problems,search,labels, owner,resource, âĶ) is shown as is. Only a bare/resources/<kind>restores the saved filters, and it writes them into the URL with replace./resourcesand the Resources rail item go to the last kind. This also covers Radar Hub's rail, which links to bare/resources.Each section returns to its last list (per tab)
viewMemory.ts). Everything else is dropped: the namespace pick, the investigation focus, drawers and details opened on top of the list (e.g. an open Application). A param a view adds later is forgotten until it is listed, never replayed by mistake.Active filters are visible
"Apply to all sections" in the Namespace column filter
?namespaces=. It is not offered with cache-scoped namespaces, where the scope is locked.Other changes
Notes
filter-statecontract used by Applications, GitOps and Checks. The per-cluster key, the URL-wins rule and the "restored" line are there so saved filters never show up unexplained.ResourcesView:rememberedKindSearch,onKindFiltersChange,onApplyNamespacesToAllSections. Hosts that don't pass them keep today's behavior. Radar Hub gets them through@skyhook-io/radar-appwith no change on its side.Type of change
How has this been tested?
Unit tests:
kindFilterStore.test.ts: per-cluster and per-group keys, tab isolation, reload / duplicated tab / new tab, unavailable storage, clearing one column on every kind.viewMemory.test.ts: the per-section allowlist, list-only routes, reload per cluster, never shared with a new tab.ResourcesView.kind-filter-memory.test.ts: restore of filters, excludes and problems.ActiveFilterBar.test.tsx.make tsc, webnpm testand the k8s-ui suite pass.By hand on a remote EKS cluster:
/resources/podsrestores the filters.radar-applinked into radar-hub-web, kind cluster): Hub chip set, Namespace filter cleared on Pods and Deployments, kept after reload.Tested locally with minikube/kind
Tested against a remote cluster
Added/updated unit tests
Checklist