163 Commits

Author SHA1 Message Date
Misaka_Company
557ed174c3 feat(extractor): add operation history tracking
Add a new operation history feature for the extractor module that tracks
all extraction operations with persistent database storage.

Features:
- Records extraction operations with batch tracking (UUID-based)
- Preserves production ID to order number mapping
- Shows batch statistics (orders, records, success/failure counts)
- Expandable details for each batch showing individual order records
- User-based permission: Admin sees all records, User sees own records only
- Delete functionality with permission validation

Database:
- New ExtractorOperationHistory table schema
- Supports both SQL Server and MySQL
- Indexed on BatchId, UserId, and OperationTime

Files:
- Add DAO class for history operations
- Add IPC handler with permission checks
- Add preload API wrapper
- Add React modal component with expandable batch details
- Integrate history recording into extractor handler
- Add operation history button to ExtractorPage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 15:22:53 +08:00
Misaka_Company
491f2afe3f refactor(auth): remove Guest role from user type system
Remove all references to 'Guest' user type from the codebase, simplifying the role system to only support 'Admin' and 'User' roles.

Changes:
- Update type definitions to exclude 'Guest' from UserType
- Remove isGuest() method from SessionManager
- Remove Guest-specific logic from update services
- Update all type assertions from 'Admin | User | Guest' to 'Admin | User'
- Remove Guest UI styling from UserSelectionDialog
- Replace Guest fallback with ValidationError in settings handler

Error handling:
- Zod schema now rejects 'Guest' as invalid user type
- TypeScript will fail compilation if 'Guest' is referenced
- Runtime errors occur if database contains Guest users

No database migration needed (confirmed: no Guest users exist)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:50:18 +08:00
Misaka_Company
4a1a78ee14 refactor(ui): restructure ReportAnalysisDialog into modular architecture
Break down 948-line monolithic component into 11 focused modules following
Vercel React best practices:

**Module Structure:**
- types.ts: Centralized type definitions and constants
- hooks/: Custom hooks for data management (useReportData, useChartData, useReportFilters)
- components/: Reusable UI components (MetricSelector, ViewModeToggle, UserFilter, ReportChart, Tooltips)
- utils/: Parser and aggregator utility functions

**Key Improvements:**
- Reduced main component from 948 to ~200 lines (79% reduction)
- Separated concerns: data fetching, state management, and UI rendering
- Enhanced reusability and testability of individual components
- Maintained backward compatibility with existing imports

**Additional Fixes:**
- Fixed tooltip displaying duplicate average time values
- Formatted time values to 1 decimal place in both views
- Removed redundant time display from tooltip footer

**Performance Optimizations Applied:**
- Moved tooltip components outside parent component (rerender-no-inline-components)
- Hoisted regex pattern creation outside loops (js-hoist-regexp)
- Used functional setState updates (rerender-functional-setState)
- Memoized expensive computations and callbacks

All changes maintain existing functionality while improving code quality
and maintainability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:14:35 +08:00
Misaka_Company
43e6d1f4b4 feat(ui): add single-select mode for metrics in comparison view
- Restrict metric selection to single choice in user comparison view
- Auto-keep first selected metric when switching to comparison mode
- Update UI label to show "单选" or "多选" based on view mode
- Improve chart readability by preventing metric overload in comparison mode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:35:35 +08:00
Misaka_Company
5ff5e5d18b fix(ui): correct per-order execution time calculation in report analysis
Fix bug where chart displayed accumulated total execution time instead of per-order average. The executionTimeSecs field now correctly shows average time per order (total time / total orders) for proper performance metrics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:32:41 +08:00
Misaka_Company
18a81ae030 fix(ui): improve execution time extraction in report analysis dialog
Enhanced value extraction with multi-pattern regex approach to handle various markdown table formats. Improved parseDurationToSeconds error handling for edge cases. Added debug logging for failed extractions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 09:47:25 +08:00
google-labs-jules[bot]
5178a2425a feat(ui): add report analysis feature for admin
Added a new ReportAnalysisDialog component, accessible from the ReportViewerDialog, strictly for Admin users. It parses execution reports, extracts markdown metrics like processed orders, skipped materials, errors, and execution time, and presents them in an interactive recharts line chart aggregated by day.

Co-authored-by: luwamgere15-crypto <255338376+luwamgere15-crypto@users.noreply.github.com>
2026-03-25 10:47:32 +00:00
Misaka
ffc3cbb4a9 feat: implement background update download without blocking user login
- Change update check and download to async execution, allowing immediate app entry for User users
- Updates run in background, showing update prompt when download completes
- Optimize login flow experience, eliminating blocking time caused by update downloads
- Add release notes for version 1.5.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 21:43:03 +08:00
Misaka_Company
2adfc77a58 fix: correct progress speed and ETA display logic 2026-03-24 17:26:18 +08:00
Misaka_Company
2343fb2188 fix: re-trigger authentication after Playwright download completes 2026-03-24 17:16:04 +08:00
Misaka_Company
fb46586a13 fix: remove unused dialog import from runtime.ts 2026-03-24 16:13:28 +08:00
Misaka_Company
6f21785c64 feat: add retry mechanism with exponential backoff for download failures 2026-03-24 16:08:38 +08:00
Misaka_Company
fbd62fe390 feat: integrate Playwright download dialog into startup flow 2026-03-24 16:02:31 +08:00
Misaka_Company
a711781f21 feat: add Playwright browser download progress dialog component 2026-03-24 15:48:07 +08:00
Misaka_Company
6ad916998c feat: add IPC handlers for Playwright browser download 2026-03-24 15:41:09 +08:00
Misaka_Company
32df3cea67 feat: add Playwright browser download service and preload types 2026-03-24 15:33:52 +08:00
Misaka
c09e0eb4e7 test: cover renderer state helpers 2026-03-21 19:45:19 +08:00
Misaka
86614efa22 refactor: lazy load renderer dialogs 2026-03-21 19:32:03 +08:00
Misaka
16ac892c93 refactor: isolate extractor and update dialog state 2026-03-21 19:28:01 +08:00
Misaka
1fc2eab816 refactor: split cleaner page layout 2026-03-21 19:15:35 +08:00
Misaka
2baf55bd2e refactor: split app bootstrap and shell 2026-03-21 19:05:10 +08:00
Misaka
13db99d51d refactor: extract update catalog decisions 2026-03-21 18:14:08 +08:00
Misaka
84c6b81959 refactor: split update service responsibilities 2026-03-21 18:06:10 +08:00
Misaka
9a1f5a483e fix: harden startup flow and auth re-entry 2026-03-21 11:02:17 +08:00
Misaka
ed65312fff refactor: split preload api by domain 2026-03-21 10:49:13 +08:00
Misaka
26c05f3726 refactor: move ipc orchestration into application services 2026-03-21 10:40:36 +08:00
Misaka
546d005c19 refactor: split main process bootstrap flow 2026-03-21 10:33:33 +08:00
Misaka
2b4a09dabe fix: resolve lint and typecheck issues 2026-03-21 09:33:07 +08:00
Misaka
2fba07fd8f fix: restore full typecheck stability 2026-03-21 09:17:58 +08:00
Misaka
7b57545127 refactor: extract cleaner hook helpers and api 2026-03-21 09:02:45 +08:00
Misaka
b979b73ba1 refactor: split validation handler responsibilities 2026-03-21 08:54:35 +08:00
Misaka
7d73592d41 Merge remote-tracking branch 'origin/dev' into dev 2026-03-20 23:25:32 +08:00
Misaka
6ad9463e73 feat: rebuild portable auto-update flow 2026-03-20 21:20:28 +08:00
Misaka_Company
7644b8d4ea feat(report-viewer): add searchable combobox for report selection
Replace native select dropdown with Headless UI Combobox component to enable:
- Search/filter functionality for reports
- Better UX with keyboard navigation
- Improved visual feedback for selected items
- Empty state handling for no matches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 17:33:16 +08:00
test
5e50a8fbcf feat(report-viewer): add syntax highlighting and GitHub-style markdown rendering
Add rehype plugins for enhanced markdown rendering:
- rehype-highlight: syntax highlighting for code blocks
- rehype-slug: generates heading IDs for anchoring
- rehype-autolink-headings: auto-links headings
- github-markdown-css: GitHub-flavored markdown styling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 20:13:40 +08:00
Misaka_Company
29f29f6a9e feat(cleaner): expand protected row number range to 2000-7999
Change the protected row number range from 7000-7999 to 2000-7999 to prevent deletion of materials in this broader range.

- Updated isMaterialDeletable() method logic
- Updated getSkipReason() error messages
- Updated test cases to reflect new range boundaries
- Updated documentation templates and error collection guide

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 13:14:09 +08:00
google-labs-jules[bot]
a020ee537d feat: Add Report Viewer Dialog to Cleaner Page
Added a new "View Reports" button to the CleanerPage which opens a new ReportViewerDialog. This dialog lists all available execution reports stored in S3 for the current user, or for all users if the current user is an admin.
The reports are downloaded as Markdown and rendered using react-markdown.
Added three new IPC channels to fetch and download reports using the existing RustfsService and S3Client.

Co-authored-by: luwamgere15-crypto <255338376+luwamgere15-crypto@users.noreply.github.com>
2026-03-17 23:03:13 +00:00
test
f5514dd721 Merge branch 'dev' 2026-03-17 22:03:01 +08:00
test
b94640ca81 fix(modal): prevent accidental closure during execution
- Add disableBackdropClick prop to Modal component
- Prevent closing ExecutionReportDialog by clicking backdrop during execution
- Complements existing disableEscapeKey behavior for ongoing operations

This prevents users from accidentally interrupting long-running operations by clicking outside the dialog.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 22:02:00 +08:00
test
b8163d7d4f refactor(cleaner): improve order number tracking and error reporting
- Add QueryResultRow interface to represent query results with order numbers
- Add collectQueryResultRows() method to extract order numbers upfront before processing
- Add extractOrderNumberFromQueryRow() helper to parse order numbers from query result cells
- Process rows with order number context instead of just row indexes
- Use actual order numbers in error details instead of BATCH_ROW_X placeholders
- Pass expected order number to detail processing for better validation
- Fix retry success handling to properly update statistics when retries succeed

This change provides better error context by associating each processed row with its actual order number from the query results, improving traceability and debugging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 21:53:13 +08:00
Misaka_Company
fbcc656b99 fix(order-resolver): support case-insensitive production ID lookup
Add case-insensitive comparison for production ID database queries:
- SQL Server: use COLLATE SQL_Latin1_General_CP1_CI_AS
- MySQL: use UPPER() function for both field and input
- Map lookup: store keys in lowercase for consistent matching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 16:37:59 +08:00
Misaka_Company
3854c0f048 Merge branch 'dev-rustfs' into dev 2026-03-17 15:49:31 +08:00
Misaka_Company
7bc6daf1b7 feat(rustfs): add test script, dependencies, and configuration template
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:49:20 +08:00
Misaka_Company
db44618ee5 feat(rustfs): integrate report upload into cleaner execution flow
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:48:50 +08:00
Misaka_Company
2d17a6b792 feat(rustfs): add RustFS configuration schema and manager support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:48:16 +08:00
Misaka_Company
e8aa7d21a8 feat(rustfs): add RustFS object storage service for report persistence
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:30:00 +08:00
Misaka_Company
defeb01808 fix: show elapsed time in execution result dialog
- Remove setStartTime(null) from finally block to preserve start time for result display
- Add resetStartTime function to useCleaner hook
- Call resetStartTime when execution report dialog closes
- Add useEffect to update timer when execution completes

Now the total elapsed time (总耗时) will be shown in the result dialog after execution completes.
2026-03-17 14:50:57 +08:00
Misaka_Company
b289fb9624 fix: use updateProcessConcurrency to persist slider changes to config.yaml
- CleanerPage now uses updateProcessConcurrency instead of setProcessConcurrency
- This ensures slider changes are persisted to config.yaml via IPC
- Remove unused queryBatchSize and setProcessConcurrency from destructuring
2026-03-17 10:57:24 +08:00
test
103effcfca ♻️ style: format code with Prettier and fix .gitattributes
- Add *.yaml text eol=lf rule to .gitattributes for consistent line endings
- Format cleaner.ts with Prettier (parameter and chain formatting)
- Format CleanerPage.tsx (JSX formatting)
- Format cleaner.test.ts (array formatting)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 22:42:16 +08:00
test
6a2fba0e57 refactor(cleaner): batch query and controlled parallel order processing 2026-03-16 21:47:13 +08:00