Feat: Add real-time progress and logging to data extractor
- Implement IPC event system for pushing progress updates from main to renderer - Add Zustand store for centralized extractor state management - Refactor useExtractor hook to use store pattern - Add chromium-bidi dependency and externalize Playwright for build compatibility - Show detailed logs during extraction (DB connection, order resolution, ERP login, data import)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import type { ErpSession } from './erp.types'
|
||||
|
||||
export type LogLevel = 'info' | 'success' | 'warning' | 'error' | 'system'
|
||||
|
||||
export interface ExtractorInput {
|
||||
orderNumbers: string[]
|
||||
batchSize?: number
|
||||
onProgress?: (message: string, progress: number) => void
|
||||
onLog?: (level: LogLevel, message: string) => void
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,6 +77,18 @@ export interface ExtractorAPI {
|
||||
runExtractor: (
|
||||
input: ExtractorInput
|
||||
) => Promise<{ success: boolean; data?: ExtractorResult; error?: string }>
|
||||
/**
|
||||
* Subscribe to progress updates
|
||||
* @param callback - Callback function receiving progress data
|
||||
* @returns Unsubscribe function
|
||||
*/
|
||||
onProgress: (callback: (data: { message: string; progress: number }) => void) => () => void
|
||||
/**
|
||||
* Subscribe to log messages
|
||||
* @param callback - Callback function receiving log data
|
||||
* @returns Unsubscribe function
|
||||
*/
|
||||
onLog: (callback: (data: { level: string; message: string }) => void) => () => void
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user