fix: raise user list size limit to 500 and guard toLocaleString calls
- routes_admin.py: size query param max raised from 100 → 500 so ClientDetail.tsx (size=200) no longer returns 422 - GlossaryDetail.tsx: three .toLocaleString() calls guarded with ?? 0 to prevent TypeError when term_count is undefined on first render Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e48d63bdbd
commit
dee4d69b40
2 changed files with 4 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ router = APIRouter(prefix="/admin", tags=["admin"])
|
|||
@router.get("/users", response_model=UserListResponse)
|
||||
async def list_users(
|
||||
page: int = Query(1, ge=1),
|
||||
size: int = Query(20, ge=1, le=100),
|
||||
size: int = Query(20, ge=1, le=500),
|
||||
role: Optional[str] = Query(None),
|
||||
active_only: bool = Query(True),
|
||||
current_user: User = Depends(require_roles(UserRole.ADMIN)),
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ export function GlossaryDetail() {
|
|||
<p className="text-xs text-gray-400 mt-1">
|
||||
Source: <span className="font-mono">{glossary.source_locale}</span>
|
||||
{activeVersion && (
|
||||
<> · Active: v{activeVersion.version_number} · {activeVersion.term_count.toLocaleString()} terms</>
|
||||
<> · Active: v{activeVersion.version_number} · {(activeVersion.term_count ?? 0).toLocaleString()} terms</>
|
||||
)}
|
||||
</p>
|
||||
{activeVersion && (
|
||||
|
|
@ -231,7 +231,7 @@ export function GlossaryDetail() {
|
|||
</p>
|
||||
) : (
|
||||
<>
|
||||
<div className="text-xs text-gray-400">{termsData?.total.toLocaleString()} terms total</div>
|
||||
<div className="text-xs text-gray-400">{(termsData?.total ?? 0).toLocaleString()} terms total</div>
|
||||
<div className="border border-gray-200 rounded-xl overflow-hidden">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-gray-50 border-b border-gray-200">
|
||||
|
|
@ -307,7 +307,7 @@ export function GlossaryDetail() {
|
|||
)}
|
||||
</div>
|
||||
<p className="text-xs text-gray-500">
|
||||
{v.term_count.toLocaleString()} terms · uploaded {new Date(v.created_at).toLocaleDateString()}
|
||||
{(v.term_count ?? 0).toLocaleString()} terms · uploaded {new Date(v.created_at).toLocaleDateString()}
|
||||
</p>
|
||||
{v.change_note && <p className="text-xs text-gray-400 mt-0.5 italic">"{v.change_note}"</p>}
|
||||
<div className="mt-1"><EmbeddingPill v={v} /></div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue