From 42a42281bde73b84a5e28ded1a694c4e8f94c7e2 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Fri, 21 Aug 2026 21:43:54 -0700 Subject: [PATCH] Remove agent map view from dashboard (#15853) * Remove agent map view from dashboard Removes the view toggle and simplifies the dashboard to show only the kanban board layout. * Assert boardProps is initialized on drawer open --- .../AgentKanbanBoard.test.tsx | 310 +----------------- .../dashboard-popout/AgentKanbanBoard.tsx | 188 +++-------- .../dashboard-popout/DashboardPopoutRoot.tsx | 18 +- .../dashboard/AgentDashboardDrawer.test.tsx | 17 +- .../dashboard/AgentDashboardDrawer.tsx | 9 - ...nt-dashboard-performance-isolation.test.ts | 7 +- src/renderer/src/popout.tsx | 6 +- 7 files changed, 55 insertions(+), 500 deletions(-) diff --git a/src/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsx b/src/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsx index fc3389d0dbc..41c4edd42dc 100644 --- a/src/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsx +++ b/src/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsx @@ -3,20 +3,15 @@ import '@testing-library/jest-dom/vitest' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { act, cleanup, fireEvent, render, screen, within } from '@testing-library/react' -import { readFileSync } from 'node:fs' -import { resolve } from 'node:path' import type { DashboardCard, DashboardFilterOptions, - DashboardSnapshot, - DashboardWorkspace + DashboardSnapshot } from '../../../../shared/dashboard-snapshot' import type { RepoIcon } from '../../../../shared/repo-icon' import { i18n } from '@/i18n/i18n' import { AgentKanbanBoard } from './AgentKanbanBoard' -const MAP_LOAD_TIMEOUT = { timeout: 5_000 } - // Stub the card and dialog so the board test stays free of xterm / Radix // machinery while still exercising the board-owned dialog wiring. vi.mock('./AgentKanbanCard', () => ({ @@ -59,17 +54,6 @@ vi.mock('./AgentTerminalDialog', () => ({ > - - {headerActions || onClose ? (
{headerActions} @@ -357,63 +270,36 @@ export function AgentKanbanBoard({
) : null} - {view !== 'board' ? ( - - - - ) : ( - <> - -
- {/* Auto margins center the capped board and collapse during horizontal overflow. */} -
- {visibleBuckets.map((bucket) => ( - - ))} -
-
- - )} - {view === 'board' ? ( - - ) : null} + +
+ {/* Auto margins center the capped board and collapse during horizontal overflow. */} +
+ {visibleBuckets.map((bucket) => ( + + ))} +
+
+ ) diff --git a/src/renderer/src/components/dashboard-popout/DashboardPopoutRoot.tsx b/src/renderer/src/components/dashboard-popout/DashboardPopoutRoot.tsx index 557036c569a..4f8f2bb9b3d 100644 --- a/src/renderer/src/components/dashboard-popout/DashboardPopoutRoot.tsx +++ b/src/renderer/src/components/dashboard-popout/DashboardPopoutRoot.tsx @@ -1,21 +1,11 @@ -import { useEffect, useState } from 'react' -import { AgentKanbanBoard, type AgentDashboardView } from './AgentKanbanBoard' +import { AgentKanbanBoard } from './AgentKanbanBoard' import { useDashboardSnapshot } from './useDashboardSnapshot' -type DashboardPopoutRootProps = { - /** The layout requested via popout.html?view=. */ - view: string | null -} - /** * Root of the pop-out dashboard window. Subscribes to the live snapshot relayed - * from the main window and renders the requested layout. + * from the main window and renders the agent board. */ -export function DashboardPopoutRoot(_props: DashboardPopoutRootProps): React.JSX.Element { +export function DashboardPopoutRoot(): React.JSX.Element { const snapshot = useDashboardSnapshot() - const [view, setView] = useState(() => - _props.view === 'map' || _props.view === 'rings' ? 'map' : 'board' - ) - useEffect(() => window.api.dashboard.onViewRequested(setView), []) - return + return } diff --git a/src/renderer/src/components/dashboard/AgentDashboardDrawer.test.tsx b/src/renderer/src/components/dashboard/AgentDashboardDrawer.test.tsx index ea1cdb80063..75b76e396b4 100644 --- a/src/renderer/src/components/dashboard/AgentDashboardDrawer.test.tsx +++ b/src/renderer/src/components/dashboard/AgentDashboardDrawer.test.tsx @@ -85,23 +85,14 @@ describe('AgentDashboardDrawer', () => { expect(useAppStore.getState().agentDashboardDrawerOpen).toBe(false) }) - it('hands map rendering to the dedicated popout', () => { - const openPopout = vi.mocked(window.api.dashboard.openPopout) + it('does not hand the drawer over to an agent map popout', () => { render() expect(mocks.boardProps).toBeNull() act(() => useAppStore.setState({ agentDashboardDrawerOpen: true })) - expect(mocks.boardProps?.initialView).toBe('board') - expect(mocks.boardProps?.workspaceContextMenusEnabled).toBeUndefined() - const onOpenMap = mocks.boardProps?.onOpenMap - expect(onOpenMap).toBeTypeOf('function') - - act(() => { - ;(onOpenMap as () => void)() - }) - - expect(openPopout).toHaveBeenCalledWith('map') - expect(useAppStore.getState().agentDashboardDrawerOpen).toBe(false) + expect(mocks.boardProps).not.toBeNull() + expect(mocks.boardProps?.onOpenMap).toBeUndefined() + expect(mocks.boardProps?.initialView).toBeUndefined() }) it('reveals a colliding worktree on the card execution host', () => { diff --git a/src/renderer/src/components/dashboard/AgentDashboardDrawer.tsx b/src/renderer/src/components/dashboard/AgentDashboardDrawer.tsx index e9e0efcc13d..a5df13c2395 100644 --- a/src/renderer/src/components/dashboard/AgentDashboardDrawer.tsx +++ b/src/renderer/src/components/dashboard/AgentDashboardDrawer.tsx @@ -13,7 +13,6 @@ import { WORKSPACE_TOP_CHROME_HEIGHT } from '../sidebar/workspace-chrome-metrics' import { AgentDashboardSettingsMenu } from './AgentDashboardSettingsMenu' -import { launchDashboardAgent } from './launch-dashboard-agent' import { useLiveDashboardSnapshot } from './useLiveDashboardSnapshot' import { translate } from '@/i18n/i18n' @@ -62,23 +61,15 @@ function AgentDashboardDrawerBody({ void window.api.dashboard.openPopout?.() }, [onClose]) - const handleOpenMap = useCallback(() => { - onClose() - void window.api.dashboard.openPopout?.('map') - }, [onClose]) - return ( { const drawer = source('components/dashboard/AgentDashboardDrawer.tsx') const toolbar = source('components/dashboard-popout/AgentDashboardToolbar.tsx') - expect(board).toContain("import('./AgentDashboardMapView')") + expect(board).not.toContain("import('./AgentDashboardMapView')") expect(board).not.toMatch(/from ['"].\/(?:AgentMap|useAgentMap|agent-map-)/) expect(toolbar).not.toMatch(/from ['"].\/(?:AgentMap|useAgentMap|agent-map-)/) - expect(drawer).toContain('initialView="board"') - expect(drawer).toContain("openPopout?.('map')") - expect(drawer).toContain('onOpenMap={handleOpenMap}') + expect(drawer).not.toContain("openPopout?.('map')") + expect(drawer).not.toContain('onOpenMap') }) }) diff --git a/src/renderer/src/popout.tsx b/src/renderer/src/popout.tsx index c9b8e762d6b..00470df1374 100644 --- a/src/renderer/src/popout.tsx +++ b/src/renderer/src/popout.tsx @@ -50,10 +50,6 @@ if (!rootElement) { throw new Error('Pop-out root element not found.') } -// The main process loads popout.html with ?view= so a single entry can -// host different dashboard layouts (kanban, etc.). -const requestedView = new URLSearchParams(window.location.search).get('view') - function PopoutSettingsSync(): null { const settings = useAppStore((state) => state.settings) @@ -109,7 +105,7 @@ function PopoutRoot(): React.JSX.Element { 'The dashboard could not finish rendering. Retry to remount it, or reopen it.' )} > - + ) }