-
Notifications
You must be signed in to change notification settings - Fork 613
[BUG]: Admin UI "Showing X - Y of Z" count incorrect when DB-to-Pydantic conversion fails #2851
Description
Problem
When DB rows fail Pydantic conversion in admin partial endpoints, the pagination controls display an incorrect "Showing X - Y of Z" range.
_adjust_pagination_for_conversion_failures (mcpgateway/admin.py:533) correctly adjusts total_items (the Z value), but the X-Y range is computed client-side in pagination_controls.html:171 using currentPage and perPage — not the actual number of rendered rows.
Example: If 2 of 20 rows on a page fail conversion, the UI says "Showing 1 - 20 of 98 items" while only 18 rows are displayed.
Affected Component
-
mcpgateway- UI (admin panel)
Steps to Reproduce
- Have a database with items where at least one fails Pydantic validation (e.g., corrupt/malformed data)
- Navigate to an admin list view (servers, tools, prompts, gateways, resources, a2a agents)
- Observe "Showing X - Y of Z items" text
Expected Behavior
The range should reflect actual displayed rows, e.g., "Showing 1 - 18 of 98 items" when 2 of 20 rows fail.
Suggested Fix
Pass the actual rendered item count from the server to the template (e.g., via a rendered_count or page_items variable) and use it for the Y value in the display text instead of Math.min(currentPage * perPage, totalItems).
Related
- PR fix: Admin UI pagination proxy compatibility and fix for count accuracy #2846 — introduced
_adjust_pagination_for_conversion_failuresand fixedtotal_items(Z), but the X-Y range remains stale