feat: folder mapping UI on account add (probe + map modal)
ADD now probes both connections, lists folders on each side, and opens a
mapping modal to route source->destination folders (e.g. Спам -> Spam) so we
append into the existing folder instead of creating a duplicate.
- store: SetTaskFolderMapping (+ round-trip test)
- httpapi: POST /tasks/{id}/probe (test both, return folder lists),
PUT /tasks/{id}/folder-mapping
- web: FolderMappingModal (reuses Modal, size=lg), submitAccount probes then
opens the modal; confirm creates the account and saves the task mapping
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMHQTtnQtQqL8muAXHr9kd
This commit is contained in:
@@ -84,6 +84,25 @@ export const deleteAccount = (taskId: number, accountId: number) =>
|
||||
export const cancelAccount = (taskId: number, accountId: number) =>
|
||||
api(`/api/tasks/${taskId}/accounts/${accountId}/cancel`, { method: 'POST' })
|
||||
|
||||
export interface ProbeSide {
|
||||
ok: boolean
|
||||
folders?: string[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface ProbeResult {
|
||||
src: ProbeSide
|
||||
dst: ProbeSide
|
||||
}
|
||||
|
||||
export const probeFolders = (
|
||||
taskId: number,
|
||||
creds: { src_login: string; src_pass: string; dst_login: string; dst_pass: string },
|
||||
) => api<ProbeResult>(`/api/tasks/${taskId}/probe`, jsonBody(creds))
|
||||
|
||||
export const setFolderMapping = (taskId: number, mapping: Record<string, string>) =>
|
||||
api(`/api/tasks/${taskId}/folder-mapping`, { ...jsonBody({ mapping }), method: 'PUT' })
|
||||
|
||||
export const listTasks = () => api<Task[]>('/api/tasks')
|
||||
|
||||
export const getTask = (id: number) => api<TaskDetail>(`/api/tasks/${id}`)
|
||||
|
||||
Reference in New Issue
Block a user