Feat: Add segmented progress bar for data extractor with dynamic phase calculation
- Add ExtractionProgress type with phase, batch, and subProgress fields - Implement dynamic progress calculation: 1 (login) + N (batches) + 2 (merge/import) - Create SegmentedProgressBar component with 4 colored phases (purple/blue/amber/green) - Show batch-level progress during download phase (e.g., 批次 1/10) - Display sub-progress during login phase (连接数据库/解析订单号/登录 ERP) - Update IPC handler and extractor services to report detailed progress - Add phase status indicators (completed/active/pending) with color-coded dots
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
import { electronAPI } from '@electron-toolkit/preload'
|
||||
import type { MySqlConfig, SqlServerConfig } from '../main/types/ipc-api.types'
|
||||
import type { ExtractorInput } from '../main/types/extractor.types'
|
||||
import type { ExtractorInput, ExtractionProgress } from '../main/types/extractor.types'
|
||||
import type { CleanerInput, ExportResultItem } from '../main/types/cleaner.types'
|
||||
import type { ResolverInput } from '../main/ipc/resolver-handler'
|
||||
import type { LoginRequest } from '../main/ipc/auth-handler'
|
||||
@@ -28,11 +28,9 @@ const api = {
|
||||
// Extractor service
|
||||
extractor: {
|
||||
runExtractor: (input: ExtractorInput) => ipcRenderer.invoke('extractor:run', input),
|
||||
onProgress: (callback: (data: { message: string; progress: number }) => void) => {
|
||||
const subscription = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
data: { message: string; progress: number }
|
||||
) => callback(data)
|
||||
onProgress: (callback: (data: ExtractionProgress) => void) => {
|
||||
const subscription = (_event: Electron.IpcRendererEvent, data: ExtractionProgress) =>
|
||||
callback(data)
|
||||
ipcRenderer.on('extractor:progress', subscription)
|
||||
return () => ipcRenderer.removeListener('extractor:progress', subscription)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user