From 0cc885a07b8568b7ab4ecd68307aeec278bc00d4 Mon Sep 17 00:00:00 2001 From: fylorn <249551762+fylorn@users.noreply.github.com> Date: Fri, 9 Oct 2026 16:31:40 +0800 Subject: [PATCH 1/2] Traffic: cap the name columns; long names are cut and shown in full on hover A long upstream name widened the request table without limit (330px for a 44-character name; the whole table went from 864 to 1193px at the default window), pushing the cost column out of view. - Upstream, model and key cells have one cap each, in `NAME_PX` (virtual.ts): model 208px (unchanged), upstream 160px including the logo, key 160px including the app logo and the remote mark (unchanged). Overflowing names are cut with an ellipsis; local answers and "not sent" phrases still wrap. - The width estimates that pick which cells the header sizers render are capped the same way (`capped`), so a short name with badges is still measured when several over-long names are around, and columns do not jump while scrolling. - Session header rows: the model and upstream lists stay within the same caps (the first name gives up the last ellipsis's room instead of widening the column by 12px). - `Tip clip`: a lazy tooltip that opens only when its text is actually cut, with the full text wrapping anywhere. Used on the model and upstream names (replacing the native `title` on the model), the session header lists, the session panel header and waterfall, and the request drawer header. The key cell keeps its tooltip, whose first line already holds the full name. With very long names in all three columns the table is now 1035px (zh) / 1053px (en) instead of 1193 / 1190; normal data is unchanged (864px). Co-Authored-By: Claude Opus 5.5 --- src/traffic/PanelHeader.tsx | 11 ++++- src/traffic/RequestTable.tsx | 62 +++++++++++++++++++++------- src/traffic/SessionPanel.tsx | 19 +++++++-- src/traffic/SessionRow.tsx | 36 +++++++++------- src/traffic/cells.tsx | 6 ++- src/traffic/drawer/RequestDrawer.tsx | 16 ++++--- src/traffic/virtual.test.ts | 34 ++++++++++++++- src/traffic/virtual.ts | 30 ++++++++++++++ src/ui/tip.test.ts | 25 +++++++++++ src/ui/tip.tsx | 36 +++++++++++++--- 10 files changed, 226 insertions(+), 49 deletions(-) create mode 100644 src/ui/tip.test.ts diff --git a/src/traffic/PanelHeader.tsx b/src/traffic/PanelHeader.tsx index 30c5166d..ebb3ea8c 100644 --- a/src/traffic/PanelHeader.tsx +++ b/src/traffic/PanelHeader.tsx @@ -5,6 +5,7 @@ import { commonText } from "@/i18n/common.i18n"; import { cn } from "@/lib/utils"; import { Button } from "@/ui/button"; import { Skeleton } from "@/ui/skeleton"; +import { Tip } from "@/ui/tip"; /** * 右侧浮层(请求详情、会话详情)顶上那一块:标题一行,下面一行要点,可选的一排 @@ -17,7 +18,7 @@ import { Skeleton } from "@/ui/skeleton"; * right-3` 的方块,和这一行的基线对不上;放进来之后它跟着标题走。 * * 标题截断、关闭钮 `shrink-0`:标题一长,浏览器会去挤按钮,按钮挤无可挤就把 - * 「关闭」折成两行。 + * 「关闭」折成两行。截断了的标题(请求详情的标题是模型名)悬停看全。 * * `tabs`:一排 `variant="line"` 的标签,贴着底边那条线 —— 和页头的标签同一个 * 做法(`PageHeader`),选中的那条下划线压在分隔线上。 @@ -47,7 +48,13 @@ export function PanelHeader({ className={cn("shrink-0 border-b border-border px-4 pt-3", tabs ? "pb-0" : "pb-3", className)} >
-

{title}

+ {typeof title === "string" ? ( + +

{title}

+
+ ) : ( +

{title}

+ )} {meta && {meta}}