Files
traefik-llmgateway/webui/src/components/CompactNumber.vue
lukaszraczylo ee49467e64 feat(webui): redesign the admin dashboard around admin tasks
A sidebar replaces the flat tabs with seven pages, and one filter bar
sets the time range, comparison period and scope for all of them.

- Home: spend against budget, forecast, request rate, error rate,
  open breakers, top users and models, recent events and warnings.
- Spend: spend over time with comparison, budget burn-down, an
  attribution drill-down from group to user to model, pricing health
  and cost avoided by free models.
- Consumers: a directory with last seen and limit bars, an access
  matrix, and a detail page per user.
- Models: the catalog with billing prices, fleet latency and error
  rates, and provider health.
- Reliability: error, timeout, failover, 429 and 402 trends, events,
  and latency per provider.
- Config: the redacted config and a change helper that emits YAML or
  users.json snippets to paste into git.
- MCP & Agents: callers per target.

Page state lives in the URL hash, and old tab links map to the new
pages. The replaced views are removed. admin_assets_gen.go is
regenerated.

Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
2026-09-23 16:41:01 +01:00

41 lines
1.8 KiB
Vue

<script setup lang="ts">
import { computed } from 'vue'
import { formatCompactCount, formatExactInt } from '@/lib/format'
/**
* CompactNumber renders a large raw token/request count in its compact
* SI-style form ("1.23M") while carrying the exact value via `title`
* (mouse hover) and a visually-hidden sibling span (keyboard/screen-
* reader parity). Used anywhere a usage count renders: DataTable numeric
* columns (usage-columns.ts, target-columns.ts, via
* `h(CompactNumber, { value })`), the Consumers page's Total row, and a
* group accordion's trigger/detail stat grid (ConsumerDirectory.vue).
*
* Review fix (folded minor, ARIA): `aria-label` on a plain `<span>` is
* an axe `aria-prohibited-attr` violation — a `<span>`'s implicit ARIA
* role ("generic") does not support name computation at all, so
* `aria-label`/`aria-labelledby` there is simply invalid, not merely
* discouraged. The visible, compact text is marked `aria-hidden="true"`
* so assistive tech skips the abbreviated form, and a `sr-only` sibling
* span (visually hidden, still in the accessibility tree) carries the
* exact value instead — the same visible-abbreviation-plus-hidden-full-
* text pattern ProviderRateBadge.vue now applies too.
*
* Cost figures are NOT this component's concern — formatCost already
* shows full 4-decimal precision, so there is nothing to compact or
* disambiguate with a title there; only token/request COUNTS use this.
*/
const props = defineProps<{ value: number }>()
const compact = computed(() => formatCompactCount(props.value))
const exact = computed(() => formatExactInt(props.value))
</script>
<template>
<span :title="exact">
<span aria-hidden="true">{{ compact }}</span>
<span class="sr-only">{{ exact }}</span>
</span>
</template>