From d0b4f8aaf6b5ee8cce35b499296c315ea3b76799 Mon Sep 17 00:00:00 2001 From: nntrivi2001 Date: Tue, 3 Nov 2026 08:47:13 +0700 Subject: [PATCH] fix(health): the user hover card sits on the name row only Over the whole tile it opened together with the CPU bar's own help tip and the two overlapped. --- client/src/components/health/HostHealth.tsx | 48 ++++++++++--------- .../health/__tests__/HostHealth.test.tsx | 8 +++- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/client/src/components/health/HostHealth.tsx b/client/src/components/health/HostHealth.tsx index 9fa70b3c..cc9643aa 100644 --- a/client/src/components/health/HostHealth.tsx +++ b/client/src/components/health/HostHealth.tsx @@ -721,8 +721,10 @@ export function HostSections({ host, heap }: { host: HostState; heap?: HeapInfo const name = groupName(g); const isOpen = open === g.key; return ( - -
+
+ {/* The hover card sits on the name row only: over the whole + tile it stacked on the CPU bar's own help tip. */} + - - - {isOpen && ( -
    - {g.top.map((p) => ( -
  • - - {p.name} #{p.pid} - - - {fmtPct(p.cpu)} · {formatBytes(p.memory)} - -
  • - ))} -
- )} -
- + + + + {isOpen && ( +
    + {g.top.map((p) => ( +
  • + + {p.name} #{p.pid} + + + {fmtPct(p.cpu)} · {formatBytes(p.memory)} + +
  • + ))} +
+ )} +
); })} diff --git a/client/src/components/health/__tests__/HostHealth.test.tsx b/client/src/components/health/__tests__/HostHealth.test.tsx index b7dfcabf..a7507568 100644 --- a/client/src/components/health/__tests__/HostHealth.test.tsx +++ b/client/src/components/health/__tests__/HostHealth.test.tsx @@ -207,18 +207,22 @@ describe("HostHealth", () => { render(); const tile = await screen.findByTestId("server-user"); await vi.waitFor(() => expect(api.users.list).toHaveBeenCalled()); - fireEvent.mouseEnter(tile.parentElement!); + fireEvent.mouseEnter(within(tile).getByRole("button").parentElement!); const tip = await screen.findByText(/Login: mia/); expect(tip.textContent).toContain("Role: Developer"); expect(tip.textContent).toMatch(/Today: \$1\.5/); expect(tip.textContent).toContain("2 workspaces · 5 sessions"); + // Only the name row carries it: the CPU bar keeps its own help tip alone. + fireEvent.mouseLeave(within(tile).getByRole("button").parentElement!); + fireEvent.mouseEnter(within(tile).getByRole("meter", { name: "CPU" })); + expect(screen.queryByText(/Login: mia/)).toBeNull(); }); it("shows a developer only the login name, without reading the users list", async () => { Object.assign(perms, { seesAll: false, local: false, isAdmin: false }); render(); const tile = await screen.findByTestId("server-user"); - fireEvent.mouseEnter(tile.parentElement!); + fireEvent.mouseEnter(within(tile).getByRole("button").parentElement!); const tip = await screen.findByText(/Login: mia/); expect(tip.textContent).not.toContain("Today"); expect(api.users.list).not.toHaveBeenCalled();