Fix mobile Usage dashboard table clipping found validating OM-218

This commit is contained in:
Forge Sandbox committed 2026-11-30 05:49:21 +00:00
1 parent 71fe35cd02
commit 97b94c1d07
6 files changed
+121 -115

No files matched your search

@@ -70,7 +70,7 @@ export function SessionUsageContent({ sessionId, compact }: SessionUsageContentP
query.error instanceof Error ? query.error.message : 'The session usage request failed.'
return (
<div className={compact ? 'min-h-0 flex-1 space-y-4 overflow-y-auto px-3 pb-3' : 'space-y-6'}>
<div className={compact ? 'min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto px-3 pb-3' : 'space-y-6'}>
<div className="flex flex-wrap items-end gap-2">
<UsageRangePicker value={range} onChange={setRange} />
<UsageModelFilter
@@ -18,7 +18,7 @@ export function SessionUsageDialog({ open, onOpenChange, sessionId }: SessionUsa
<DialogTitle>Session usage</DialogTitle>
</DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto px-4 pb-4">
<div className="min-h-0 min-w-0 flex-1 overflow-y-auto px-4 pb-4">
{open && <SessionUsageContent sessionId={sessionId} />}
</div>
</DialogContent>
@@ -18,7 +18,7 @@ export function UsageDialog() {
}}
>
<DialogContent fullscreen>
<div className="flex h-full min-h-0 flex-col">
<div className="flex h-full min-h-0 min-w-0 flex-col">
<header className="flex items-center justify-between gap-3 border-b border-border px-4 py-3">
<DialogTitle className="text-base font-semibold">Usage</DialogTitle>
<div className="flex items-center gap-2">
@@ -28,7 +28,7 @@ export function UsageDialog() {
</Button>
</div>
</header>
<div className="min-h-0 flex-1 overflow-y-auto p-3 sm:p-4">
<div className="min-h-0 min-w-0 flex-1 overflow-y-auto p-3 sm:p-4">
{isOpen && <UsageDashboard serverId={serverId} />}
</div>
</div>
@@ -15,31 +15,33 @@ export function UsageModelsTable({ models }: UsageModelsTableProps) {
{models.length === 0 ? (
<p className="text-sm text-muted-foreground">No model usage in this range.</p>
) : (
<table className="w-full text-sm">
<thead className="border-b border-border/60 text-xs uppercase text-muted-foreground">
<tr>
<th scope="col" className="px-3 py-2.5 text-left font-medium">Model</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Steps</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Tokens</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Cost</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Share</th>
</tr>
</thead>
<tbody className="divide-y divide-border/60">
{models.map((model) => {
const share = totalCost === 0 ? '—' : `${((model.cost / totalCost) * 100).toFixed(1)}%`
return (
<tr key={modelUsageKey(model.model)}>
<td className="px-3 py-2.5">{modelUsageKey(model.model)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(model.steps)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{formatCompactTokens(totalTokens(model.tokens))}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{formatUsd(model.cost)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{share}</td>
</tr>
)
})}
</tbody>
</table>
<div className="overflow-x-auto">
<table className="w-full min-w-[28rem] text-sm">
<thead className="border-b border-border/60 text-xs uppercase text-muted-foreground">
<tr>
<th scope="col" className="px-3 py-2.5 text-left font-medium">Model</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Steps</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Tokens</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Cost</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Share</th>
</tr>
</thead>
<tbody className="divide-y divide-border/60">
{models.map((model) => {
const share = totalCost === 0 ? '—' : `${((model.cost / totalCost) * 100).toFixed(1)}%`
return (
<tr key={modelUsageKey(model.model)}>
<td className="px-3 py-2.5">{modelUsageKey(model.model)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(model.steps)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{formatCompactTokens(totalTokens(model.tokens))}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{formatUsd(model.cost)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{share}</td>
</tr>
)
})}
</tbody>
</table>
</div>
)}
</div>
)
@@ -172,57 +172,59 @@ export function UsageSessionsTable({ serverId, range }: UsageSessionsTableProps)
<p className="text-sm text-muted-foreground">No sessions in this range.</p>
) : (
<>
<table className="w-full text-sm">
<thead className="border-b border-border/60 text-xs uppercase text-muted-foreground">
<tr>
<th scope="col" className="px-3 py-2.5 text-left font-medium">
Session
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Steps
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Input
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Output
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Cache read
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Avg tokens/s
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Cost
</th>
</tr>
</thead>
<tbody className="divide-y divide-border/60">
{visibleSessions.map((session, index) => {
const metrics = sessionMetrics(usageQueries[index])
return (
<tr key={session.id}>
<td className="px-3 py-2.5">{renderTitle(session)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{metrics.steps}</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatCompactTokens(session.tokens.input)}
</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatCompactTokens(session.tokens.output)}
</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatCompactTokens(session.tokens.cache.read)}
</td>
<td className="px-3 py-2.5 text-right tabular-nums">{metrics.throughput}</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatUsd(session.cost)}
</td>
</tr>
)
})}
</tbody>
</table>
<div className="overflow-x-auto">
<table className="w-full min-w-[40rem] text-sm">
<thead className="border-b border-border/60 text-xs uppercase text-muted-foreground">
<tr>
<th scope="col" className="px-3 py-2.5 text-left font-medium">
Session
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Steps
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Input
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Output
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Cache read
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Avg tokens/s
</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">
Cost
</th>
</tr>
</thead>
<tbody className="divide-y divide-border/60">
{visibleSessions.map((session, index) => {
const metrics = sessionMetrics(usageQueries[index])
return (
<tr key={session.id}>
<td className="px-3 py-2.5">{renderTitle(session)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{metrics.steps}</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatCompactTokens(session.tokens.input)}
</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatCompactTokens(session.tokens.output)}
</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatCompactTokens(session.tokens.cache.read)}
</td>
<td className="px-3 py-2.5 text-right tabular-nums">{metrics.throughput}</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{formatUsd(session.cost)}
</td>
</tr>
)
})}
</tbody>
</table>
</div>
{sortedSessions.length > showCount && (
<button
type="button"
@@ -14,42 +14,44 @@ export function UsageToolsTable({ totals, usage }: UsageToolsTableProps) {
{usage.length === 0 ? (
<p className="text-sm text-muted-foreground">No tool calls in this range.</p>
) : (
<table className="w-full text-sm">
<thead className="border-b border-border/60 text-xs uppercase text-muted-foreground">
<tr>
<th scope="col" className="px-3 py-2.5 text-left font-medium">Tool</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Calls</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Succeeded</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Failed</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Unfinished</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">P50</th>
</tr>
</thead>
<tbody className="divide-y divide-border/60">
{usage.map((entry) => (
<tr key={entry.name}>
<td className="px-3 py-2.5">{entry.name}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.calls)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.succeeded)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.failed)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.unfinished)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{entry.durationP50 !== undefined ? `${Math.round(entry.durationP50)} ms` : '—'}
</td>
<div className="overflow-x-auto">
<table className="w-full min-w-[28rem] text-sm">
<thead className="border-b border-border/60 text-xs uppercase text-muted-foreground">
<tr>
<th scope="col" className="px-3 py-2.5 text-left font-medium">Tool</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Calls</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Succeeded</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Failed</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">Unfinished</th>
<th scope="col" className="px-3 py-2.5 text-right font-medium">P50</th>
</tr>
))}
</tbody>
<tfoot className="border-t border-border/60">
<tr>
<td className="px-3 py-2.5 font-medium">Total</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.calls)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.succeeded)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.failed)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.unfinished)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">—</td>
</tr>
</tfoot>
</table>
</thead>
<tbody className="divide-y divide-border/60">
{usage.map((entry) => (
<tr key={entry.name}>
<td className="px-3 py-2.5">{entry.name}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.calls)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.succeeded)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.failed)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">{String(entry.unfinished)}</td>
<td className="px-3 py-2.5 text-right tabular-nums">
{entry.durationP50 !== undefined ? `${Math.round(entry.durationP50)} ms` : '—'}
</td>
</tr>
))}
</tbody>
<tfoot className="border-t border-border/60">
<tr>
<td className="px-3 py-2.5 font-medium">Total</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.calls)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.succeeded)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.failed)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">{String(totals.unfinished)}</td>
<td className="px-3 py-2.5 text-right font-medium tabular-nums">—</td>
</tr>
</tfoot>
</table>
</div>
)}
</div>
)