CNS-120 In Console, cluster list now pulls data from SUBSCRIBE - #38014
CNS-120 In Console, cluster list now pulls data from SUBSCRIBE#38014jdonelson wants to merge 1 commit into
Conversation
…ow via Jotai store. This is a prerequisite for adding replica usage matrics to the list display.
leedqin
left a comment
There was a problem hiding this comment.
Thanks for the migration! looks pretty good to me; just had some suggestions. Would you mind updating the verification section in the PR description and also adding a Fixes- in the Motivation section in the PR description. This would directly sync this PR to the Linear issue
| ...c, | ||
| // Treat an in-flight owners query as non-owner so owner-only menu items | ||
| // stay hidden until ownership is known. | ||
| isOwner: !isOwnersPending && (ownersById?.get(c.ownerId) ?? false), |
There was a problem hiding this comment.
do you think we could move this check into useOwners hook and share this check across ClustersList.tsx, ClusterDetail and ClusterReplica?
| if (!clusters) return []; | ||
| const systemClusters = clusters.filter((c) => isSystemCluster(c.id)); | ||
| const nonSystemClusters = clusters | ||
| const visibleClusters = clusters |
There was a problem hiding this comment.
Same filter + sort already exists in ClusterDetailBreadcrumbs. Maybe pull it into a helper in store/allClusters.ts, e.g. visibleClusters(clusters, showSystemObjects)
export function visibleClusters(clusters: Cluster[], showSystemObjects: boolean) {
return clusters
.filter((c) => showSystemObjects || !isSystemCluster(c.id))
.sort((a, b) => a.name.localeCompare(b.name));
}
| expect(await screen.findByText(CLUSTERS_FETCH_ERROR_MESSAGE)).toBeVisible(); | ||
| }); | ||
|
|
||
| it("renders the cluster list", async () => { |
There was a problem hiding this comment.
The system-cluster filtering is client-side logic now, so it'd be good to cover it: seed the atom with an s-id cluster plus user clusters and assert it's hidden by default / shown with the toggle.
In Console, cluster list data is now sourced from SUBSCRIBE via Jotai store. This moves one more consumer away from the deprecated polling model and it's a prerequisite for adding replica usage metrics to the list display.
Motivation
Fixes CNS-120
Verification