Skip to content

[BUG]: Admin UI "Showing X - Y of Z" count incorrect when DB-to-Pydantic conversion fails #2851

@crivetimihai

Description

@crivetimihai

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

  1. Have a database with items where at least one fails Pydantic validation (e.g., corrupt/malformed data)
  2. Navigate to an admin list view (servers, tools, prompts, gateways, resources, a2a agents)
  3. 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

Metadata

Metadata

Assignees

Labels

COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsbugSomething isn't workingfrontendFrontend development (HTML, CSS, JavaScript)uiUser Interface

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions