Merge sidebar workspaces across all connected hosts (#1538)
* Merge workspaces across all hosts in the sidebar Replace per-host sidebar sections with a single merged project list. Projects that exist on multiple hosts (matched by projectKey) are collapsed into one row. Host identity is surfaced via: - A status-only footer pill showing online/offline host counts - Hover cards with a mandatory host row on every workspace entry - Subtitles showing the host name when a project spans >1 host - A host filter in the grouping dropdown (not a sidebar switcher) Order and group-mode stores migrated from per-server to global keys with zustand persist migrations. New-workspace screen now shows a merged project list with a host selector combobox. Key files: - workspace-structure.ts: merge algorithm by projectKey - sidebar-view-store.ts / sidebar-order-store.ts: global state - sidebar-workspace-list.tsx: context-based subtitle injection - new-workspace-screen.tsx: host selector in footer row * Add host filtering to the merged sidebar The sidebar now merges workspaces from every connected host, so a single global "active host" no longer fits. Host selection becomes explicit per action via a host chooser, and agent history pages across all hosts at once. Removes the active-host / active-server-id model and the all-agents-list hook that fed it. * Fix rebase fallout: translate archive host error, update stale workspace-key test archiveWorkspacesOptimistically used a raw "Host is not connected" string that the i18n completeness test forbids; route it through i18n.t with the existing hostDisconnected key. The selectors memoization test asserted un-prefixed workspace keys, but merged-sidebar keys are serverId-prefixed. * Fix sidebar review fallout * Address sidebar review followups * Fix sidebar workspace identity migration * Address sidebar review followups * Handle partial host history failures * Fix merged sidebar project removal and E2E drift * Restore history routes and project removal shape * Remove sidebar host context plumbing * Tighten sidebar status and host filter state * Keep new workspace project selection host-compatible * Migrate sidebar view storage * Streamline host selection flows * Update all-host history on archive * Fix empty project sidebar action Code regression: the main merge dropped the empty-project New workspace child row while keeping the empty project persistence contract. Restore the row using the project host target so the sidebar stays aligned with the no-host-selection model. * Fix Japanese shortcut translation key Stale-base integration: main added the Japanese locale after this branch added cycleAgentMode to the English shortcut help map. Merging main exposed the missing ja key in CI typecheck and resources.test. * Fix Playwright speech teardown race
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildSidebarProjectRowModel } from "./sidebar-project-row-model";
|
||||
import type {
|
||||
SidebarProjectEntry,
|
||||
SidebarWorkspaceEntry,
|
||||
} from "@/hooks/use-sidebar-workspaces-list";
|
||||
import {
|
||||
buildSidebarProjectRowModel,
|
||||
resolveSidebarProjectIconTarget,
|
||||
} from "./sidebar-project-row-model";
|
||||
|
||||
function workspace(overrides: Partial<SidebarWorkspaceEntry> = {}): SidebarWorkspaceEntry {
|
||||
return {
|
||||
@@ -11,6 +14,7 @@ function workspace(overrides: Partial<SidebarWorkspaceEntry> = {}): SidebarWorks
|
||||
serverId: "srv",
|
||||
workspaceId: "ws-root",
|
||||
projectKey: "project-1",
|
||||
projectName: "paseo",
|
||||
workspaceDirectory: "/repo",
|
||||
projectKind: "git",
|
||||
workspaceKind: "checkout",
|
||||
@@ -37,7 +41,9 @@ function project(overrides: Partial<SidebarProjectEntry> = {}): SidebarProjectEn
|
||||
projectName: "paseo",
|
||||
projectKind,
|
||||
iconWorkingDir: "/repo",
|
||||
canCreateWorktree: overrides.canCreateWorktree ?? projectKind === "git",
|
||||
hosts: overrides.hosts ?? [
|
||||
{ serverId: "srv", iconWorkingDir: "/repo", canCreateWorktree: projectKind === "git" },
|
||||
],
|
||||
workspaces: [workspace()],
|
||||
...overrides,
|
||||
};
|
||||
@@ -56,7 +62,7 @@ describe("buildSidebarProjectRowModel", () => {
|
||||
expect(result).toEqual({
|
||||
kind: "project_section",
|
||||
chevron: "collapse",
|
||||
trailingAction: "none",
|
||||
trailingAction: { kind: "none" },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,7 +78,29 @@ describe("buildSidebarProjectRowModel", () => {
|
||||
expect(result).toEqual({
|
||||
kind: "project_section",
|
||||
chevron: "expand",
|
||||
trailingAction: "new_worktree",
|
||||
trailingAction: {
|
||||
kind: "new_worktree",
|
||||
target: { serverId: "srv", iconWorkingDir: "/repo" },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("targets the project host, not route state, for new worktree actions", () => {
|
||||
const result = buildSidebarProjectRowModel({
|
||||
project: project({
|
||||
hosts: [
|
||||
{ serverId: "host-a", iconWorkingDir: "/repo/a", canCreateWorktree: false },
|
||||
{ serverId: "host-b", iconWorkingDir: "/repo/b", canCreateWorktree: true },
|
||||
],
|
||||
}),
|
||||
collapsed: false,
|
||||
});
|
||||
|
||||
expect(result).toMatchObject({
|
||||
trailingAction: {
|
||||
kind: "new_worktree",
|
||||
target: { serverId: "host-b", iconWorkingDir: "/repo/b" },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,10 +119,26 @@ describe("buildSidebarProjectRowModel", () => {
|
||||
expect(result).toEqual({
|
||||
kind: "project_section",
|
||||
chevron: "expand",
|
||||
trailingAction: "new_worktree",
|
||||
trailingAction: {
|
||||
kind: "new_worktree",
|
||||
target: { serverId: "srv", iconWorkingDir: "/repo" },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("resolves project icons from the project host, not the focused host", () => {
|
||||
const iconTarget = resolveSidebarProjectIconTarget(
|
||||
project({
|
||||
hosts: [
|
||||
{ serverId: "host-b", iconWorkingDir: "/repo/b", canCreateWorktree: true },
|
||||
{ serverId: "host-a", iconWorkingDir: "/repo/a", canCreateWorktree: true },
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
expect(iconTarget).toEqual({ serverId: "host-b", iconWorkingDir: "/repo/b" });
|
||||
});
|
||||
|
||||
it("renders an empty project as an expandable section", () => {
|
||||
const result = buildSidebarProjectRowModel({
|
||||
project: project({ projectKind: "git", workspaces: [] }),
|
||||
@@ -104,7 +148,10 @@ describe("buildSidebarProjectRowModel", () => {
|
||||
expect(result).toEqual({
|
||||
kind: "project_section",
|
||||
chevron: "collapse",
|
||||
trailingAction: "new_worktree",
|
||||
trailingAction: {
|
||||
kind: "new_worktree",
|
||||
target: { serverId: "srv", iconWorkingDir: "/repo" },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user