From 7ccaa10496637de7cc0faa3209454f772898b33a Mon Sep 17 00:00:00 2001 From: Deng Liu Date: Fri, 27 Nov 2026 15:21:32 -0800 Subject: [PATCH] feat(remote-dev): distinguish remote windows and project switcher entries (#6557) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remote projects in the project switcher and the welcome screen's recent list now carry a server badge on their avatar and an 'SSH · host' (WSL, Dev Container) label above the remote path, with search highlights split between host and path. The Remote Host status bar item gains the remote icon, and shows its disconnected state as a warning-coloured label. Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com> --- e2e/projectSwitcherLayout.spec.ts | 3 ++ src/features/remote-dev/RemoteDev.module.css | 1 + src/features/remote-dev/RemoteStatus.tsx | 1 + src/features/remote-dev/resources.test.tsx | 14 ++++++ src/features/welcome/ProjectPopup.test.tsx | 26 ++++++++++ src/features/welcome/ProjectPopup.tsx | 25 +++++----- src/features/welcome/ProjectsPage.tsx | 16 +++++- src/features/welcome/RecentList.tsx | 45 ++++++++++++++++- src/features/welcome/Welcome.module.css | 52 ++++++++++++++++++++ src/features/welcome/recent.ts | 12 ++++- 10 files changed, 176 insertions(+), 19 deletions(-) diff --git a/e2e/projectSwitcherLayout.spec.ts b/e2e/projectSwitcherLayout.spec.ts index a68e9bc284..eeb8a6e973 100644 --- a/e2e/projectSwitcherLayout.spec.ts +++ b/e2e/projectSwitcherLayout.spec.ts @@ -50,6 +50,9 @@ test("project switcher keeps names and metadata on separate lines and highlights ); const remote = popup.getByRole("option", { name: /Payment Ledger/ }); + await expect(remote.locator("[data-remote-badge]")).toHaveCount(1); + await expect(remote.locator('[data-remote-kind="ssh"]')).toBeVisible(); + await expect(local.locator("[data-remote-badge]")).toHaveCount(0); await expectBelow(remote, "Payment Ledger", HOST); await expectBelow(remote, HOST, REMOTE_PATH); diff --git a/src/features/remote-dev/RemoteDev.module.css b/src/features/remote-dev/RemoteDev.module.css index 386576b3e5..7a07349add 100644 --- a/src/features/remote-dev/RemoteDev.module.css +++ b/src/features/remote-dev/RemoteDev.module.css @@ -88,4 +88,5 @@ display: inline-flex; align-items: center; gap: var(--space-1); + color: var(--warning); } diff --git a/src/features/remote-dev/RemoteStatus.tsx b/src/features/remote-dev/RemoteStatus.tsx index 75ace9134d..2915dbaf5c 100644 --- a/src/features/remote-dev/RemoteStatus.tsx +++ b/src/features/remote-dev/RemoteStatus.tsx @@ -61,6 +61,7 @@ export function RemoteStatus() { ]); }} > + {label} ); diff --git a/src/features/remote-dev/resources.test.tsx b/src/features/remote-dev/resources.test.tsx index e312334459..f8bacdf173 100644 --- a/src/features/remote-dev/resources.test.tsx +++ b/src/features/remote-dev/resources.test.tsx @@ -5,6 +5,7 @@ import type { HostMetrics, RemoteSession } from "@/platform/ipc"; import { useProject } from "@/platform/project"; import { disableRemote, enableRemote, useRemote } from "@/platform/remote"; import { RemoteResources, RemoteResourcesDashboard } from "./RemoteResources"; +import { RemoteStatus } from "./RemoteStatus"; import { compactResourceText, diskUsedBytes, @@ -235,4 +236,17 @@ describe("remote resources widget and dashboard", () => { await act(async () => inflight); expect(useRemoteResources.getState().metrics).toBeNull(); }); + + it("renders a server icon on the Remote Host status bar label and highlights disconnected text in warning tone", () => { + act(() => enableRemote(sshSession("deng@thinkpad"))); + const { rerender } = render(); + const connected = screen.getByRole("button", { name: "SSH: deng@thinkpad" }); + expect(connected.querySelector("svg")).not.toBeNull(); + expect(connected.querySelector('[class*="lost"]')).toBeNull(); + + act(() => useRemote.setState({ lost: "deng@thinkpad" })); + rerender(); + const disconnected = screen.getByRole("button", { name: "SSH: deng@thinkpad (disconnected)" }); + expect(disconnected.querySelector('[class*="lost"]')).not.toBeNull(); + }); }); diff --git a/src/features/welcome/ProjectPopup.test.tsx b/src/features/welcome/ProjectPopup.test.tsx index 98d2ebc899..8269a95d0c 100644 --- a/src/features/welcome/ProjectPopup.test.tsx +++ b/src/features/welcome/ProjectPopup.test.tsx @@ -73,6 +73,32 @@ describe("ProjectPopup", () => { expect(text.indexOf("datahub-front")).toBeLessThan(text.indexOf("Recent Projects")); expect(text.indexOf("Recent Projects")).toBeLessThan(text.indexOf("other")); expect(within(list).getAllByText("FastAPIProject")).toHaveLength(1); + const remoteRow = within(list).getByText("FastAPIProject").closest('[role="option"]')!; + expect(remoteRow.querySelector("[data-remote-badge]")).not.toBeNull(); + expect(remoteRow.querySelector('[data-remote-kind="wsl"]')?.textContent).toContain("WSL"); + }); + + it("leaves local project avatars and rows free of remote badges", async () => { + open = [ + { name: "same-name", root: "/home/me/same-name", current: false, remote: { kind: "ssh", config: "devbox" } }, + { name: "same-name", root: "/Users/me/same-name", current: true, remote: null }, + ]; + groups = []; + recent = []; + const anchor = createRef(); + render( + <> +