fix(dashboard): List Models card must not hardcode models={null} (#10553) (#10753)

Co-authored-by: Markus Hartung <mail@hartmark.se>
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-08-19 11:52:23 -03:00
committed by GitHub
parent 12eef018cb
commit 6e809982e8
3 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1 @@
- fix(dashboard): show the real model count on the "List Models" endpoint card instead of a permanent "—" (#10553)

View File

@@ -2069,7 +2069,8 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientProps
iconBg="bg-teal-500/10"
title={t("listModels")}
path="/v1/models"
models={null}
models={allModels}
modelsLoading={modelsLoading}
copy={copy}
copied={copied}
baseUrl={currentEndpoint}

View File

@@ -0,0 +1,31 @@
import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve, join } from "node:path";
// Regression guard for #10553: the "List Models" EndpointCard on the
// Endpoints dashboard tab (path "/v1/models") was hardcoded with
// `models={null}`, so it could never show the total model count, unlike
// every other EndpointCard fed a real models array or the full `allModels`
// catalog state.
const cwd = process.cwd();
const filePath = resolve(
join(cwd, "src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx")
);
const source = readFileSync(filePath, "utf-8");
test("issue #10553: List Models card must not hardcode models={null}", () => {
const cardMatch = source.match(
/title=\{t\("listModels"\)\}[\s\S]{0,200}?models=\{([^}]*)\}/
);
assert.ok(cardMatch, "List Models EndpointCard not found");
assert.notStrictEqual(cardMatch[1].trim(), "null", "List Models card must not hardcode models={null}");
});
test("issue #10553: List Models card passes modelsLoading", () => {
const cardMatch = source.match(
/title=\{t\("listModels"\)\}[\s\S]{0,250}?(modelsLoading=\{[^}]*\})/
);
assert.ok(cardMatch, "List Models card missing modelsLoading prop");
});