mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 06:02:14 +03:00
Co-authored-by: Markus Hartung <mail@hartmark.se>
This commit is contained in:
committed by
GitHub
parent
12eef018cb
commit
6e809982e8
@@ -0,0 +1 @@
|
||||
- fix(dashboard): show the real model count on the "List Models" endpoint card instead of a permanent "—" (#10553)
|
||||
@@ -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}
|
||||
|
||||
31
tests/unit/dashboard/endpoint-list-models-card-10553.test.ts
Normal file
31
tests/unit/dashboard/endpoint-list-models-card-10553.test.ts
Normal 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");
|
||||
});
|
||||
Reference in New Issue
Block a user