mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(webui): keep charts consistent with the current selection
Chart and ranking fetches carry a request id, and a superseded response is dropped. Changing a selection clears the old data at once, so old numbers never show under new labels or units. The auto-refresh tick skips while a fetch is still in flight. "Loading..." shows only until the first result for a selection arrives. Dashboard polls do not overlap. Users in several groups are counted and searched in every group. The Models tab labels its windows as the current UTC bucket. Hour labels are marked UTC. The Members column sorts numerically. Target access shows "All groups" for null and "No groups" for []. The UI shows the server's own error message. Cost axis ticks use the currency formatter. npm run dev proxies /admin/api. Nine unused shadcn components are removed. admin_assets_gen.go is regenerated from the new build. Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { formatCompactCount, formatContextWindow, formatElapsedAgo, formatLatencyMs, formatModelCostHover, formatUntil, refreshDetailLabel, refreshLabel, ZERO_TIME } from './format'
|
||||
import { formatBucketLabel, formatCompactCount, formatContextWindow, formatElapsedAgo, formatLatencyMs, formatModelCostHover, formatUntil, refreshDetailLabel, refreshLabel, ZERO_TIME } from './format'
|
||||
|
||||
describe('refreshLabel', () => {
|
||||
it('reads "discovery off" when discovery is disabled, regardless of lastRefresh', () => {
|
||||
@@ -182,6 +182,32 @@ describe('formatLatencyMs', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// History chart bucket labels (limits.go's windowKey: hour/day/month
|
||||
// fixed-width digit strings, bucketFor always formats in UTC). Review
|
||||
// finding: the hour case previously rendered its bucket's bare hour digits
|
||||
// with no timezone indicator, reading as local time to a reader outside
|
||||
// UTC even though bucketFor never buckets in local time.
|
||||
describe('formatBucketLabel', () => {
|
||||
it('labels an hour bucket with an explicit "UTC" suffix, not a bare local-looking hour', () => {
|
||||
expect(formatBucketLabel('2026082114', 'hour')).toBe('14:00 UTC')
|
||||
})
|
||||
|
||||
it('labels a day bucket as a calendar date, no timezone suffix needed', () => {
|
||||
// toLocaleDateString(undefined, ...) follows the RUNNER's own default
|
||||
// locale (e.g. "Aug 21" under en-US, "21 Aug" under en-GB) — the
|
||||
// expectation is computed the identical way, not hardcoded, so this
|
||||
// stays locale-independent rather than pinning one CI environment's
|
||||
// ordering.
|
||||
const want = new Date(2026, 7, 21).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })
|
||||
expect(formatBucketLabel('20260821', 'day')).toBe(want)
|
||||
})
|
||||
|
||||
it('labels a month bucket as a calendar month/year, no timezone suffix needed', () => {
|
||||
const want = new Date(2026, 7, 1).toLocaleDateString(undefined, { month: 'short', year: 'numeric' })
|
||||
expect(formatBucketLabel('202608', 'month')).toBe(want)
|
||||
})
|
||||
})
|
||||
|
||||
// Target health (feat/target-health): formatElapsedAgo is formatAgo's bare
|
||||
// "Ns ago" counterpart — no parentheses — so a caller can compose it into
|
||||
// either "unhealthy (Ns ago)" or "Ns ago via probe" without stripping
|
||||
|
||||
Reference in New Issue
Block a user