Cluster Workloads Pods/Jobs — newest-first infinite scroll¶
Motivation¶
On a long-lived ElasticBLAST cluster the Workloads card's Pods and Jobs tabs rendered every row at once. A real cluster accumulated 500+ pods and 1000+ Jobs, so the tables painted hundreds of rows in creation order (oldest first), burying the rows an operator actually cares about — the most recent ones — at the bottom of a very long scroll.
User-facing change¶
- The Pods and Jobs tabs of the cluster Workloads card now:
- Sort newest-first by Kubernetes
age(creationTimestamp) — the most recently created pod/job is at the top. - Render 20 rows at a time inside a fixed-height (≈460px) scroll
viewport, growing the window by 20 as the operator scrolls (infinite
scroll via
IntersectionObserver). - Show a compact footer:
Showing 20 / 506 · scroll for more, or506 totalonce everything is rendered. - The window resets to the first 20 rows when the namespace filter changes or a refetch returns a different snapshot, so the operator is never parked deep in a stale tail.
- Deployments tab is unchanged (its roster is small).
- No backend, API, or payload change — this is purely client-side ordering and windowing. The namespace filter's "N shown" count is unchanged (it still reflects the total rows in the selected namespace).
Implementation summary¶
- New hook web/src/components/ClusterDiagnostics/useAgeSortedInfinite.ts
— sorts by
agedescending and exposes a growingvisibleprefix plus the scroll/sentinel refs. - New presentation wrapper web/src/components/ClusterDiagnostics/WorkloadScroll.tsx
— fixed-height scroll container, sentinel, and
N / totalfooter. - web/src/components/ClusterDiagnostics/K8sPodsPanel.tsx
and web/src/components/ClusterDiagnostics/K8sJobsPanel.tsx
now render
visibleinstead of the full filtered list.
Validation evidence¶
cd web && npm run build→tsc -b && vite build✓ built (no type errors).npx eslinton the four touched/added files → clean (exit 0).- No ClusterDiagnostics unit tests exist; the panels' only consumer
(
K8sWorkloadsSection) passes unchanged props.