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 { other, ratioSeries, stackTopN, sumByProvider } from './series'
|
||||
import { activeScopes, activeSeries, other, ratioSeries, stackTopN, sumByProvider } from './series'
|
||||
|
||||
describe('stackTopN', () => {
|
||||
it('returns the n series with the largest total, descending', () => {
|
||||
@@ -129,3 +129,29 @@ describe('ratioSeries', () => {
|
||||
expect(ratioSeries([], [])).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('activeSeries / activeScopes', () => {
|
||||
const series = [
|
||||
{ scope: 'provider:a', points: [0, 3, 0] },
|
||||
{ scope: 'provider:idle', points: [0, 0, 0] },
|
||||
{ scope: 'provider:empty', points: [] },
|
||||
{ scope: 'provider:b', points: [1, 0, 0] },
|
||||
]
|
||||
|
||||
it('drops series with no traffic and keeps order', () => {
|
||||
expect(activeSeries(series).map((s) => s.scope)).toEqual(['provider:a', 'provider:b'])
|
||||
})
|
||||
|
||||
it('keeps the chart-wide total unchanged (Lean Gateway.Ui.Active.total_preserved)', () => {
|
||||
const total = (ss: { points: number[] }[]) => ss.reduce((acc, s) => acc + s.points.reduce((x, y) => x + y, 0), 0)
|
||||
expect(total(activeSeries(series))).toBe(total(series))
|
||||
})
|
||||
|
||||
it('returns an empty list for no input', () => {
|
||||
expect(activeSeries([])).toEqual([])
|
||||
})
|
||||
|
||||
it('activeScopes names only providers with traffic', () => {
|
||||
expect([...activeScopes(series)].sort()).toEqual(['provider:a', 'provider:b'])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user