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
+54
View File
@@ -0,0 +1,54 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import ChangeHelper from '@/components/ChangeHelper.vue'
import ConfigTree from '@/components/ConfigTree.vue'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { useConfigStore } from '@/stores/config'
import { useConsumersStore } from '@/stores/consumers'
import { useDashboardStore } from '@/stores/dashboard'
/**
* ConfigPage (redesign-plan.md section 3.4) composes the redacted config
* tree (ConfigTree.vue, GET /admin/api/config, fetched on demand) above
* the change helper (ChangeHelper.vue's five snippet-building forms) —
* group/user names for those forms' target pickers come from the already-
* polled dashboard store (overview.groups) and the on-demand consumers
* store (users), so this page fetches config once and reuses whatever the
* other two stores already have rather than a third redundant call.
*/
const config = useConfigStore()
const dashboard = useDashboardStore()
const consumers = useConsumersStore()
onMounted(() => {
void config.ensureConfig()
void consumers.ensureConsumers()
})
const groupNames = computed(() => (dashboard.overview?.groups ?? []).map((g) => g.name))
const userNames = computed(() => (consumers.data?.users ?? []).map((u) => u.name))
</script>
<template>
<div class="flex flex-col gap-6">
<Card v-if="config.error">
<CardHeader>
<CardTitle>Config</CardTitle>
<CardDescription class="text-destructive">{{ config.error }}</CardDescription>
</CardHeader>
</Card>
<p v-else-if="config.loading && !config.data" class="text-sm text-muted-foreground">loading…</p>
<ConfigTree v-else-if="config.data" :config="config.data.config" :warnings="config.data.warnings" />
<Card>
<CardHeader>
<CardTitle>Change helper</CardTitle>
<CardDescription>Build a paste-ready snippet for middleware.yaml or users.json — nothing here writes to the running config.</CardDescription>
</CardHeader>
<CardContent>
<ChangeHelper :group-names="groupNames" :user-names="userNames" />
</CardContent>
</Card>
</div>
</template>