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:
Misaka
2026-03-04 20:51:54 +08:00
parent fed76b4fe0
commit 9e1b5530ea
12 changed files with 297 additions and 55 deletions

View File

@@ -27,7 +27,23 @@ const api = {
// Extractor service
extractor: {
runExtractor: (input: ExtractorInput) => ipcRenderer.invoke('extractor:run', input)
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)
ipcRenderer.on('extractor:progress', subscription)
return () => ipcRenderer.removeListener('extractor:progress', subscription)
},
onLog: (callback: (data: { level: string; message: string }) => void) => {
const subscription = (
_event: Electron.IpcRendererEvent,
data: { level: string; message: string }
) => callback(data)
ipcRenderer.on('extractor:log', subscription)
return () => ipcRenderer.removeListener('extractor:log', subscription)
}
},
// Cleaner service