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();