diff --git a/webui/e2e/visual.spec.ts b/webui/e2e/visual.spec.ts index f5fb87f..e47708b 100644 --- a/webui/e2e/visual.spec.ts +++ b/webui/e2e/visual.spec.ts @@ -89,3 +89,12 @@ for (const { page: pageId, kind } of PANEL_PAGES) { } } } + +// Compare mode: tiles show a delta and the chart adds a dashed previous-period series. +for (const theme of THEMES) { + test(`overview-cmp live desktop ${theme}`, async ({ page }) => { + await page.setViewportSize(VIEWPORTS.desktop) + await exercise(page, 'overview-cmp', '#overview?cmp=prev', 'live', 'desktop', theme) + await expect(page.locator('text=Previous period >> visible=true').first()).toBeVisible() + }) +} diff --git a/webui/mock/match.ts b/webui/mock/match.ts index 7ff7f70..d1c8a07 100644 --- a/webui/mock/match.ts +++ b/webui/mock/match.ts @@ -155,7 +155,11 @@ export function nearestFixture(manifest: Fixture[], path: string, query: URLSear for (const k of ID_PARAMS[path]!) if (want[k]?.join() === have[k]?.join()) score += 30 score += need.length === got.length ? 10 : 0 } else if (path === '/admin/api/usage/models') { - if (!want.detail !== !have.detail) continue + // A detail fixture holds the full ranking, so it can answer a plain request for any metric; a + // plain fixture is a top-N cut of one metric and only answers that metric. + if (want.detail && !have.detail) continue + if (!have.detail && have.metric?.[0] !== want.metric?.[0]) continue + score += have.metric?.[0] === want.metric?.[0] ? 100 : 0 } else if (path === '/admin/api/performance') { if (want.kind?.[0] !== have.kind?.[0] || !want.series !== !have.series) continue if (!want.id !== !have.id) continue diff --git a/webui/src/assets/main.css b/webui/src/assets/main.css index 140ff9c..76c13b1 100644 --- a/webui/src/assets/main.css +++ b/webui/src/assets/main.css @@ -207,3 +207,7 @@ .wb-table :is(th, td).wb-num { text-align: right; } .wb-table th.wb-num > * { justify-content: flex-end; } .wb-table .wb-share-bar { min-width: 96px; } + +/* Phone cards layout: drop the share bar from compact top lists. */ +@media (max-width: 639px) { .wb-hide-share-sm .wb-share { display: none; } } +@media (min-width: 640px) { .wb-clip td.wb-text { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } } diff --git a/webui/src/lib/mock-server.spec.ts b/webui/src/lib/mock-server.spec.ts index a9cbe2f..9489e11 100644 --- a/webui/src/lib/mock-server.spec.ts +++ b/webui/src/lib/mock-server.spec.ts @@ -89,6 +89,14 @@ describe('respond', () => { expect(r.body).toEqual({ error: { message: expect.any(String), type: 'invalid_request_error', code: '404' } }) }) + it('ranks usage/models by the requested metric, not by a top-N cut of another one', () => { + const r = get('/admin/api/usage/models', 'metric=req&window=day&span=7&limit=5') + const ids = ((r.body as Any).models as Any[]).map((m) => m.id) + expect(ids[0]).toBe('uni/text-embedding-multilingual-e5-base') + expect(ids).toHaveLength(5) + expect(ids).toContain('uni/deepseek-v4-flash-0731') + }) + it('404s an unknown path', () => { expect(get('/admin/api/nope').status).toBe(404) }) diff --git a/webui/src/pages/OverviewPage.vue b/webui/src/pages/OverviewPage.vue index fc597dd..6cb5c5d 100644 --- a/webui/src/pages/OverviewPage.vue +++ b/webui/src/pages/OverviewPage.vue @@ -1,11 +1,9 @@ + +