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
+44
View File
@@ -0,0 +1,44 @@
import { defineStore } from 'pinia'
import { AdminApiError, adminFetch } from '@/lib/api'
import { useAuthStore } from '@/stores/auth'
import type { AdminConfigResponse } from '@/types/api'
/**
* useConfigStore backs the Config page (redesign-plan.md section 3.4): the
* redacted config tree plus config warnings, from GET /admin/api/config —
* fetched on demand (ConfigPage.vue's own onMounted), not polled: the
* plugin's own config is immutable for a running replica's lifetime (a
* config edit needs a reload/restart), so there is nothing to poll for.
* ConfigPage.vue still exposes a manual refresh (in case the operator just
* redeployed and wants the freshly-loaded config without a full page
* reload).
*/
export const useConfigStore = defineStore('config', {
state: () => ({
data: null as AdminConfigResponse | null,
loading: false,
error: '',
}),
actions: {
async fetchConfig(): Promise<void> {
const auth = useAuthStore()
if (!auth.isAuthenticated) return
this.loading = true
try {
this.data = await adminFetch<AdminConfigResponse>('/admin/api/config')
this.error = ''
} catch (err) {
if (err instanceof AdminApiError && (err.status === 401 || err.status === 403)) return
this.error = err instanceof Error ? err.message : String(err)
} finally {
this.loading = false
}
},
/** ensureConfig fetches only when there is no data yet — ConfigPage.vue's own onMounted call. */
async ensureConfig(): Promise<void> {
if (this.loading || this.data) return
await this.fetchConfig()
},
},
})