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:
Misaka_Company
2026-03-05 13:25:04 +08:00
parent 921ca15be6
commit dc01896d8b
8 changed files with 481 additions and 133 deletions

View File

@@ -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 {

View File

@@ -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
}
/**