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:
@@ -1,9 +1,22 @@
|
||||
export type CleanerPhase = 'login' | 'processing' | 'complete'
|
||||
|
||||
export interface CleanerProgress {
|
||||
message: string
|
||||
progress: number
|
||||
currentOrderIndex: number
|
||||
totalOrders: number
|
||||
currentMaterialIndex: number
|
||||
totalMaterialsInOrder: number
|
||||
currentOrderNumber?: string
|
||||
phase: CleanerPhase
|
||||
}
|
||||
|
||||
export interface CleanerInput {
|
||||
orderNumbers: string[]
|
||||
materialCodes: string[]
|
||||
dryRun: boolean
|
||||
headless?: boolean
|
||||
onProgress?: (message: string, progress?: number) => void
|
||||
onProgress?: (message: string, progress?: number, extra?: Partial<CleanerProgress>) => void
|
||||
}
|
||||
|
||||
export interface CleanerResult {
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { ExtractorInput, ExtractorResult, ExtractionProgress } from './extr
|
||||
import type {
|
||||
CleanerInput,
|
||||
CleanerResult,
|
||||
CleanerProgress,
|
||||
ExportResultItem,
|
||||
ExportResultResponse
|
||||
} from './cleaner.types'
|
||||
@@ -108,6 +109,13 @@ export interface CleanerAPI {
|
||||
* @param items - Validation result items to export
|
||||
*/
|
||||
exportResults: (items: ExportResultItem[]) => Promise<ExportResultResponse>
|
||||
|
||||
/**
|
||||
* Subscribe to progress updates
|
||||
* @param callback - Callback function receiving progress data
|
||||
* @returns Unsubscribe function
|
||||
*/
|
||||
onProgress: (callback: (data: CleanerProgress) => void) => () => void
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user