Files
HealthLog/src/components/admin/section-slugs.ts
T
Marc-André BombeckandClaude Opus 4.7 887928211b feat(admin): AI quality preview showing per-(severity x provider) helpful-rate
v1.4.16 phase B5e: ship the `/admin/ai-quality` route that surfaces
the daily aggregator's helpful-rate per (severity x metricSourceType
x provider x prompt-version) bucket. Renders as a compact 7-column
table with severity tinted by clinical-importance colour and the
helpful-rate column tinted green/yellow/orange by 0.8/0.5
thresholds.

New endpoint `GET /api/admin/ai-quality` (requireAdmin-gated) returns
the raw `AppSettings.adminAiInsightsFeedbackSummary` blob so the
v1.4.17 ratchet that consumes the same shape for prompt-tuning can
read what the worker writes without an envelope-reshape step.

Empty state ("no summary yet" / "buckets[] is empty") rendered as a
quiet message rather than a fake zero row so the operator can tell
"no feedback" apart from "all-zeros". Loading + error banners follow
the existing host-metrics pattern.

Section wiring:
  - new `ai-quality` slug in ADMIN_SECTION_SLUGS (between
    integrations and feedback so the IA flows General → Integrations
    → AI Quality → Feedback Inbox)
  - new Sparkles icon entry in admin-shell
  - new switch case in [section]/renderer.tsx
  - EN+DE i18n keys: admin.section.ai-quality.{title,subtitle} +
    admin.aiQuality.{title,loading,loadError,empty,windowLabel,
    generatedAtLabel,col*}

Tests:
  - 5 new ai-quality-section tests (loading, empty-null, empty-buckets,
    table-render with multiple buckets, error)
  - 1 admin-sections smoke test ensures the empty branch renders +
    1 slug-list parity test

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 01:44:47 +02:00

33 lines
933 B
TypeScript

/**
* Server-safe constants for the v1.5 admin split. Mirrors the pattern in
* `src/components/settings/section-slugs.ts` so server-rendered code paths
* (`generateStaticParams()`, the page guard, route-existence tests) can
* import the slug list without dragging the `<AdminShell>` client bundle
* into the server graph.
*
* Order is the in-app navigation order — sidebar nav, mobile strip, and
* `generateStaticParams()` all consume it directly.
*/
export const ADMIN_SECTION_SLUGS = [
"system-status",
"general",
"services",
"integrations",
"ai-quality",
"feedback",
"reminders",
"users",
"api-tokens",
"login-overview",
"app-logs",
"backups",
"danger-zone",
] as const;
export type AdminSectionSlug = (typeof ADMIN_SECTION_SLUGS)[number];
export function isAdminSectionSlug(value: string): value is AdminSectionSlug {
return (ADMIN_SECTION_SLUGS as readonly string[]).includes(value);
}