mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
feat(admin-ui): alias labels, active-provider legends, denser tables and readable money
Label configured model aliases with an alias badge wherever a model id shows. List only providers with traffic in the window in provider chart legends. Page long tables, show a scroll shadow on wide ones and drop the duplicate model link. Show costs with thousands separators and magnitude-scaled decimals on cards and chart axes. Use whole-number ticks for count charts and replace all-zero charts with a message. Back off polling after failures. Keep the CSV status region from widening the page on phones. Regenerate admin_assets_gen.go.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { formatBucketLabel, formatCompactCount, formatContextWindow, formatElapsedAgo, formatLatencyMs, formatModelCostHover, formatUntil, refreshDetailLabel, refreshLabel, ZERO_TIME } from './format'
|
||||
import { formatBucketLabel, formatCompactCount, formatContextWindow, formatCostAxis, formatCostDisplay, formatElapsedAgo, formatLatencyMs, formatModelCostHover, formatUntil, refreshDetailLabel, refreshLabel, ZERO_TIME } from './format'
|
||||
|
||||
describe('refreshLabel', () => {
|
||||
it('reads "discovery off" when discovery is disabled, regardless of lastRefresh', () => {
|
||||
@@ -269,3 +269,19 @@ describe('rounding boundaries', () => {
|
||||
expect(formatLatencyMs(ms)).toBe(want)
|
||||
})
|
||||
})
|
||||
|
||||
describe('cost display formatters', () => {
|
||||
it.each([
|
||||
{ name: 'zero', micros: 0, display: '$0.0000', axis: '$0' },
|
||||
{ name: 'sub-cent keeps precision', micros: 1_234, display: '$0.0012', axis: '$0.0012' },
|
||||
{ name: 'under a dollar', micros: 500_000, display: '$0.5000', axis: '$0.5' },
|
||||
{ name: 'a few dollars', micros: 2_688_800, display: '$2.69', axis: '$2.69' },
|
||||
{ name: 'hundreds', micros: 999_000_000, display: '$999.00', axis: '$999' },
|
||||
{ name: 'thousands', micros: 1_500_000_000, display: '$1,500', axis: '$1,500' },
|
||||
{ name: 'negative', micros: -2_000_000, display: '-$2.00', axis: '-$2' },
|
||||
{ name: 'NaN', micros: NaN, display: '—', axis: '—' },
|
||||
])('$name', ({ micros, display, axis }) => {
|
||||
expect(formatCostDisplay(micros)).toBe(display)
|
||||
expect(formatCostAxis(micros)).toBe(axis)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user