mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
refactor(webui): extract repeated dashboard elements into shared components
Markup and helpers that were copied between pages now live in one place: - ChartCard, StatDisabledAlert, StatItem, DetailField, BudgetRatioBars, LabeledSelect, TargetPicker and LoadStateView components - lib/scope.ts, lib/columns.ts and lib/chart-palette.ts - messageOf, isAuthRejection, and the USD to micro-USD conversion helpers - one monthly cost projection, one date formatter, and the useCopyFeedback composable Behaviour is unchanged. Before and after screenshots of every page match at 390 and 1440 px. Empty-state text now comes from the shared EmptyState component, and the user run-out date uses the short date format. admin_assets_gen.go is regenerated. Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
isValidNonNegativeInt,
|
||||
isValidUserName,
|
||||
modelMetaSnippet,
|
||||
parseList,
|
||||
pricingSnippet,
|
||||
userGrantJsonFragment,
|
||||
userJsonLine,
|
||||
@@ -17,6 +18,23 @@ import {
|
||||
validatePersonalGrant,
|
||||
} from './snippets'
|
||||
|
||||
describe('parseList', () => {
|
||||
it('splits on commas and trims whitespace', () => {
|
||||
expect(parseList('anthropic, openai , gx10')).toEqual(['anthropic', 'openai', 'gx10'])
|
||||
})
|
||||
|
||||
it('drops empty entries (blank field, trailing comma, doubled comma)', () => {
|
||||
expect(parseList('')).toEqual([])
|
||||
expect(parseList('anthropic,')).toEqual(['anthropic'])
|
||||
expect(parseList('anthropic,,openai')).toEqual(['anthropic', 'openai'])
|
||||
expect(parseList(' ')).toEqual([])
|
||||
})
|
||||
|
||||
it('de-duplicates, keeping first-seen order', () => {
|
||||
expect(parseList('anthropic, openai, anthropic')).toEqual(['anthropic', 'openai'])
|
||||
})
|
||||
})
|
||||
|
||||
// Golden strings below are checked against the REAL production shapes in
|
||||
// home-cluster/kubernetes/namespaces/traefik/base/llmgateway/middleware.yaml
|
||||
// and users-configmap.yaml (read this session) — structure and field order
|
||||
|
||||
Reference in New Issue
Block a user