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
This commit is contained in:
2026-09-23 16:41:01 +01:00
parent e8abb91dc8
commit ee49467e64
127 changed files with 11226 additions and 3414 deletions
@@ -0,0 +1,69 @@
<script setup lang="ts">
import { computed } from 'vue'
import DataTable from '@/components/DataTable.vue'
import SearchInput from '@/components/SearchInput.vue'
import { Alert, AlertDescription } from '@/components/ui/alert'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { filterModelRows } from '@/lib/model-filter'
import { modelCatalogColumns } from '@/lib/model-table-columns'
import type { ModelCatalogRow } from '@/lib/model-table-columns'
/**
* ModelCatalogTable (redesign-plan.md section 3.4, Models & providers
* page) is the catalog-driven table: every configured model (not just
* ones with observed traffic), joined with the current range's ranking
* and fleet performance — ModelCatalogRow's own doc comment
* (lib/model-table-columns.ts) has the full join contract.
*
* `query` is a controlled v-model, not owned locally: ModelsPage.vue keeps
* it so the Models page's own `q` hash param (redesign-plan.md section
* 3.1) round-trips through the URL, the same controlled-component
* convention SearchInput.vue itself already documents.
*/
const props = defineProps<{
rows: ModelCatalogRow[]
query: string
/** GET /admin/api/performance's own latencyEnabled (AdminPerfResponse) — false means admin.stats.latency is off, so p50/p95 read "—" for every row, not "no traffic yet". */
latencyEnabled: boolean
loading: boolean
}>()
const emit = defineEmits<{ 'update:query': [value: string] }>()
const filtered = computed<ModelCatalogRow[]>(() => filterModelRows(props.rows, props.query))
const columns = modelCatalogColumns()
const emptyMessage = computed<string>(() => {
if (props.loading) return 'loading…'
if (props.rows.length === 0) return 'no models configured'
if (props.query.trim()) return `no models match "${props.query}"`
return 'none'
})
</script>
<template>
<Card>
<CardHeader>
<CardTitle>Model catalog</CardTitle>
<CardDescription>
Every configured model: price source, per-model usage for the current range, fleet p50/p95, and error rate.
</CardDescription>
<SearchInput
:model-value="query"
placeholder="Search models or aliases..."
class="mt-2 max-w-sm"
@update:model-value="emit('update:query', $event)"
/>
</CardHeader>
<CardContent class="flex flex-col gap-3">
<Alert v-if="!latencyEnabled" variant="warn">
<AlertDescription>
Latency percentiles (p50/p95) are off for this deployment. Enable <code>admin.stats.latency</code> to see them.
</AlertDescription>
</Alert>
<DataTable :columns="columns" :data="filtered" :empty-message="emptyMessage" />
</CardContent>
</Card>
</template>