From c14d345ac50d4b4ead1a81976e0400607c8518b3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 26 Jul 2026 06:26:48 +0000 Subject: [PATCH 1/4] Initial plan From bd61498f849c827e26b235157befb1b16c033926 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 26 Jul 2026 06:31:47 +0000 Subject: [PATCH 2/4] Fix review comments from PR #59: connection-manager, App.tsx, connection-dialog, and test file --- src/App.tsx | 10 +- .../connection-dialog-folder.test.tsx | 111 ++++++++++++++++++ src/components/connection-dialog.tsx | 11 +- src/components/connection-manager.tsx | 17 ++- 4 files changed, 143 insertions(+), 6 deletions(-) create mode 100644 src/__tests__/connection-dialog-folder.test.tsx diff --git a/src/App.tsx b/src/App.tsx index 2c5eacb2..d5fc6cb9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -60,6 +60,7 @@ function AppContent() { // Modal states const [connectionDialogOpen, setConnectionDialogOpen] = useState(false); + const [connectionInitialFolder, setConnectionInitialFolder] = useState(); const [settingsModalOpen, setSettingsModalOpen] = useState(false); const [editingConnection, setEditingConnection] = useState(null); const [updateCheckSignal, setUpdateCheckSignal] = useState(0); @@ -670,7 +671,8 @@ function AppContent() { } }, [state.groups, dispatch]); - const handleNewTab = useCallback(() => { + const handleNewTab = useCallback((folderPath?: string) => { + setConnectionInitialFolder(typeof folderPath === 'string' ? folderPath : undefined); setConnectionDialogOpen(true); setEditingConnection(null); }, []); @@ -1699,9 +1701,13 @@ function AppContent() { {/* Modals */} { + setConnectionDialogOpen(open); + if (!open) setConnectionInitialFolder(undefined); + }} onConnect={handleConnectionDialogConnect} editingConnection={editingConnection} + initialFolder={connectionInitialFolder} /> ({ + invoke: vi.fn(), +})); + +vi.mock('sonner', () => ({ + toast: { error: vi.fn(), info: vi.fn(), success: vi.fn() }, +})); + +const mockFolders = [ + { path: 'All Connections' }, + { path: 'Work' }, + { path: 'Personal' }, + { path: 'Work/ProjectA' }, +]; + +vi.mock('../lib/connection-storage', () => ({ + ConnectionStorageManager: { + getValidFolders: vi.fn(() => mockFolders), + }, +})); + +vi.mock('../lib/connection-profiles', () => ({ + ConnectionProfileManager: { + getProfiles: vi.fn(() => []), + }, +})); + +const defaultConnection = { + name: 'My Server', + host: '192.168.1.1', + port: 22, + username: 'admin', + protocol: 'SSH' as const, + authMethod: 'password' as const, + folder: 'Personal', + id: 'conn-1', +}; + +beforeEach(() => { + vi.clearAllMocks(); +}); + +/** + * Helper: get the folder select trigger (second combobox - first is protocol). + * The dialog has two