feat: add progress indicator to cleaner execution report dialog
- Add CleanerProgress type for tracking execution progress - Implement progress calculation: (1 + i + j/Mᵢ)/(1+N) × 100 - Login complete: 1/(1+N) × 100 - Per material: (1 + orderIndex + materialIdx/totalMaterials)/(1+totalOrders) × 100 - Add cleaner.onProgress IPC event for real-time progress updates - Enhance ExecutionReportDialog with progress bar and status display - Update useCleaner hook with progress state management - Dialog opens immediately on execution start, showing progress then results
This commit is contained in:
@@ -2,7 +2,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, ExtractionProgress } from '../main/types/extractor.types'
|
||||
import type { CleanerInput, ExportResultItem } from '../main/types/cleaner.types'
|
||||
import type { CleanerInput, CleanerProgress, ExportResultItem } from '../main/types/cleaner.types'
|
||||
import type { ResolverInput } from '../main/ipc/resolver-handler'
|
||||
import type { LoginRequest } from '../main/ipc/auth-handler'
|
||||
import type { UserInfo } from '../main/types/user.types'
|
||||
@@ -47,7 +47,14 @@ const api = {
|
||||
// Cleaner service
|
||||
cleaner: {
|
||||
runCleaner: (input: CleanerInput) => ipcRenderer.invoke('cleaner:run', input),
|
||||
exportResults: (items: ExportResultItem[]) => ipcRenderer.invoke('cleaner:exportResults', items)
|
||||
exportResults: (items: ExportResultItem[]) =>
|
||||
ipcRenderer.invoke('cleaner:exportResults', items),
|
||||
onProgress: (callback: (data: CleanerProgress) => void) => {
|
||||
const subscription = (_event: Electron.IpcRendererEvent, data: CleanerProgress) =>
|
||||
callback(data)
|
||||
ipcRenderer.on('cleaner:progress', subscription)
|
||||
return () => ipcRenderer.removeListener('cleaner:progress', subscription)
|
||||
}
|
||||
},
|
||||
|
||||
// Order number resolver
|
||||
|
||||
Reference in New Issue
Block a user