Skip to content

Add pagination controls to model health status - #26826

Merged
yuneng-berri merged 4 commits into
litellm_internal_stagingfrom
litellm_health_status_pagination
May 1, 2026
Merged

Add pagination controls to model health status#26826
yuneng-berri merged 4 commits into
litellm_internal_stagingfrom
litellm_health_status_pagination

Conversation

@shivamrawat1

@shivamrawat1 shivamrawat1 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Description:
Adds visible pagination to the Model Management Health Status tab and updates related e2e coverage so admins can navigate and check health status across all model pages.

Cause:
The Health Status tab was backed by paginated model data but did not expose page navigation, so users could only access the first page. Adding a second results counter also made an existing broad e2e locator ambiguous.

Fix:
Added Health Status-specific pagination state, result count, Previous/Next controls, stale health-status clearing on page changes, and stronger e2e assertions that target the All Models result counter directly.
Before:
Screenshot 2026-04-29 at 3 54 06 PM

After
Screenshot 2026-04-29 at 3 53 07 PM

@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@shivamrawat1

Copy link
Copy Markdown
Contributor Author

@greptileai review it

@greptile-apps

greptile-apps Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds server-side pagination controls to the Health Status tab by introducing a dedicated healthCurrentPage state and a separate useModelsInfo query in the parent, then threading paginationMeta, currentPage, and onPageChange into HealthCheckComponent. Page navigation clears in-component health state, refresh resets the health page to 1, and a new unit test covers the pagination controls end-to-end.

Confidence Score: 5/5

Safe to merge — changes are isolated to the Health Status tab UI and carry no backend or auth impact.

No P0/P1 findings. The pagination logic is correct: resultsStart/resultsEnd math matches the test assertions, buttons disable on boundaries, handleRefreshClick now resets the health page, and the act-wrapped unit test properly flushes async effects. E2e locator fix is strictly more precise.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/model_dashboard/HealthCheckComponent.tsx Adds pagination props, a health-specific table data memo, and Previous/Next controls with a results counter; page changes clear in-component health state correctly.
ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/ModelsAndEndpointsView.tsx Introduces a dedicated healthCurrentPage state and a second useModelsInfo call for the Health tab; handleRefreshClick now resets the health page to 1.
ui/litellm-dashboard/src/components/model_dashboard/HealthCheckComponent.test.tsx Adds a new test verifying pagination controls and onPageChange callback; existing tests receive only whitespace/formatting fixes that don't change assertions.
ui/litellm-dashboard/e2e_tests/tests/modelsPage/addModel.spec.ts Tightens two result-count assertions to use data-testid="models-results-count" instead of a broad text locator, preventing false ambiguity now that a second counter exists.

Reviews (2): Last reviewed commit: "Fix health pagination review issues" | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a dedicated pagination state and UI (Previous/Next buttons, result counter) to the Model Health Status tab, backed by a separate useModelsInfo query that fetches only the current health page. The e2e locator for the All Models result counter is narrowed to data-testid="models-results-count" to eliminate the ambiguity introduced by the new Health Status counter. Only P2 findings remain: the new pagination unit test is missing the act()/microtask-flush pattern used by every other test in the file, and the refresh handler does not reset the health page counter back to 1.

Confidence Score: 4/5

Safe to merge — no functional regressions found; only minor test-quality and UX polish issues.

All findings are P2 (style/best-practice): missing act() wrapper in one new test and a missing setHealthCurrentPage(1) on refresh. No logic errors, security concerns, or broken contracts were found.

HealthCheckComponent.test.tsx — new pagination test should follow the act() pattern used by other tests in the file.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/model_dashboard/HealthCheckComponent.tsx Adds pagination props and UI (Previous/Next buttons, result counter), clears health statuses on page change, and extracts table-data mapping to a separate variable — all changes are correct.
ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/ModelsAndEndpointsView.tsx Adds a separate useModelsInfo call for the Health tab with its own page state; initial queries share a React Query key (page 1, size 50) so no extra network call is made until the user navigates pages. Refresh does not reset the health page counter.
ui/litellm-dashboard/src/components/model_dashboard/HealthCheckComponent.test.tsx Adds a meaningful pagination test and cleans up trailing whitespace; the new test is missing the act() + microtask flush pattern used by all other tests, which may produce 'not wrapped in act' warnings.
ui/litellm-dashboard/e2e_tests/tests/modelsPage/addModel.spec.ts Narrows the broad text-based locator to data-testid="models-results-count", which correctly targets the All Models counter and avoids the ambiguity introduced by the new Health Status counter.

Reviews (1): Last reviewed commit: "Address health pagination review feedbac..." | Re-trigger Greptile

Comment thread ui/litellm-dashboard/src/components/model_dashboard/HealthCheckComponent.test.tsx Outdated
@shivamrawat1

Copy link
Copy Markdown
Contributor Author

@greptileai review again with the new commit that resolves the p2 issues

@yuneng-berri
yuneng-berri merged commit ebbe2f4 into litellm_internal_staging May 1, 2026
116 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_health_status_pagination branch May 1, 2026 01:45
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…agination

Add pagination controls to model health status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants