Skip to content

Commit 3bccd58

Browse files
committed
fix(dashboard): use all models for log filter and compact Y-axis labels
- Derive model dropdown options from full model breakdown data instead of only recent 100 requests, so all models (e.g. haiku) appear - Add formatCompactNumber (1.2k, 3.5M) for trend chart Y-axis to prevent label clipping
1 parent ae2ce97 commit 3bccd58

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

dashboard/src/app.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ function DashboardContent({
166166
<>
167167
{activeTab === "overview" ? <OverviewPanel data={dashboardData} /> : null}
168168
{activeTab === "logs" ? (
169-
<RequestLogsPanel requests={dashboardData.recentRequests} />
169+
<RequestLogsPanel
170+
requests={dashboardData.recentRequests}
171+
allModels={dashboardData.requestModels}
172+
/>
170173
) : null}
171174
{activeTab === "models" ? (
172175
<ModelConfigPanel

dashboard/src/components/dashboard/request-logs-panel.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChevronLeft, ChevronRight } from "lucide-react"
22
import { useMemo, useState } from "react"
33

4-
import type { RecentRequestRow } from "../../lib/dashboard-api"
4+
import type { ModelBreakdownRow, RecentRequestRow } from "../../lib/dashboard-api"
55
import { formatTimestamp } from "../../lib/format"
66
import { cn } from "../../lib/utils"
77
import { Badge } from "../ui/badge"
@@ -21,8 +21,10 @@ const PAGE_SIZE = 20
2121

2222
export function RequestLogsPanel({
2323
requests,
24+
allModels,
2425
}: {
2526
requests: Array<RecentRequestRow>
27+
allModels: Array<ModelBreakdownRow>
2628
}) {
2729
const [filterModel, setFilterModel] = useState("")
2830
const [filterRoute, setFilterRoute] = useState("")
@@ -33,11 +35,11 @@ export function RequestLogsPanel({
3335

3436
const modelOptions = useMemo(() => {
3537
const set = new Set<string>()
36-
for (const r of requests) {
37-
if (r.modelRaw) set.add(r.modelRaw)
38+
for (const m of allModels) {
39+
if (m.modelRaw) set.add(m.modelRaw)
3840
}
3941
return Array.from(set).sort()
40-
}, [requests])
42+
}, [allModels])
4143

4244
const filtered = useMemo(() => {
4345
const fromMs = timeFrom ? new Date(timeFrom).getTime() : 0

dashboard/src/components/dashboard/request-trend-card.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "recharts"
1111

1212
import { loadTimeSeries, type TimeSeriesPoint } from "../../lib/dashboard-api"
13-
import { formatNumber } from "../../lib/format"
13+
import { formatCompactNumber, formatNumber } from "../../lib/format"
1414
import { Button } from "../ui/button"
1515
import { Card, CardContent, CardHeader, CardTitle } from "../ui/card"
1616

@@ -154,9 +154,9 @@ export function RequestTrendCard({
154154
<YAxis
155155
fontSize={11}
156156
stroke="#94a3b8"
157-
tickFormatter={(v: number) => formatNumber(v)}
157+
tickFormatter={(v: number) => formatCompactNumber(v)}
158158
tickLine={false}
159-
width={50}
159+
width={45}
160160
/>
161161
<Tooltip
162162
contentStyle={{

dashboard/src/lib/format.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ export function formatNumber(value: number): string {
44
return new Intl.NumberFormat().format(value)
55
}
66

7+
export function formatCompactNumber(value: number): string {
8+
if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`
9+
if (value >= 1_000) return `${(value / 1_000).toFixed(1)}k`
10+
return String(value)
11+
}
12+
713
export function formatPercent(value: number): string {
814
return `${value.toFixed(1)}%`
915
}

0 commit comments

Comments
 (0)