Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 在现有 Tauri + Vue 应用中新增“量产烧录模式”,包含前端独立页面/导航入口、Pinia 状态管理、会话与端口事件日志,以及后端批量扫描串口并并发调度烧录任务的完整闭环。
Changes:
- 新增
/mass-production页面与导航入口,并在量产运行期间锁定页面导航 - 新增量产模式的前端类型定义、Pinia store(配置持久化、端口过滤规则、会话日志)
- 新增 Tauri 后端量产状态管理与 commands(扫描端口、并发 worker、进度事件、日志路径与打开日志)
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/views/MassProductionView.vue | 新增量产模式主界面:端口状态网格、过滤规则、会话/失败明细、日志入口与启动/停止 |
| src/types/massProduction.ts | 新增量产相关前端类型(snapshot / request / port info / filter rules 等) |
| src/types/massProductionLog.ts | 新增会话日志与端口事件日志的数据结构 |
| src/stores/massProductionStore.ts | 新增量产 store:配置/日志持久化、snapshot/progress 应用、过滤逻辑、调用后端 commands |
| src/router/index.ts | 新增 /mass-production 路由懒加载入口 |
| src/main.ts | 增加路由守卫(量产运行锁导航)+ 启动时预加载量产配置/日志 |
| src/i18n/locales/zh.json | 新增量产模式相关中文文案与导航文案 |
| src/i18n/locales/en.json | 新增量产模式相关英文文案与导航文案 |
| src/components/Navbar.vue | 新增量产模式导航项;量产运行时禁用其他导航入口 |
| src/components/FlashFileCard.vue | 支持外部传入 disabled,量产模式下禁用删除/编辑地址 |
| src/App.vue | 将 /mass-production 纳入特定路由的显示/布局控制逻辑 |
| src-tauri/src/types/mod.rs | 注册 mass_production types 模块导出 |
| src-tauri/src/types/mass_production.rs | 新增后端量产类型定义(request/snapshot/port/progress/log paths) |
| src-tauri/src/state/mod.rs | 注册 mass_production_state 模块导出 |
| src-tauri/src/state/mass_production_state.rs | 新增量产运行时状态:队列、活动端口、会话信息、计数、supervisor thread |
| src-tauri/src/state/app_state.rs | AppState 挂载 mass_production 全局共享状态 |
| src-tauri/src/commands/mod.rs | 注册 mass_production commands 模块导出 |
| src-tauri/src/commands/mass_production.rs | 新增量产核心后端逻辑:扫描、过滤、调度 worker、进度事件、日志与打开路径 |
| src-tauri/src/app.rs | 注册 Tauri invoke handler:mass_production_* commands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| "valuePlaceholder": "输入匹配关键字", | ||
| "handshakeFailed": "握手失败", | ||
| "previewMatchedPorts": "匹配端口预览 (基于当前模拟数据)", |
There was a problem hiding this comment.
The Chinese copy for the matched ports preview says it is "基于当前模拟数据" (based on simulated data), but this UI is rendering live enumerated ports. This wording is misleading; consider updating it to reflect real-time/current data instead of simulated data.
| "previewMatchedPorts": "匹配端口预览 (基于当前模拟数据)", | |
| "previewMatchedPorts": "匹配端口预览 (基于当前实时数据)", |
| alert(message); | ||
| } | ||
|
|
||
| return from.fullPath || '/mass-production'; |
There was a problem hiding this comment.
The navigation guard redirects to from.fullPath when mass production is enabled. In Vue Router this can cause an infinite redirect loop (the redirected navigation re-enters the same guard and is blocked again), and it also prevents users from staying on the current page safely. Prefer aborting the navigation (return false) or consistently redirecting to a fixed safe route (e.g. /mass-production) without using from.fullPath as the redirect target.
| return from.fullPath || '/mass-production'; | |
| return false; |
| return false; | ||
| } | ||
|
|
||
| const activeWhitelist = whitelist.value.filter(rule => rule.enabled); |
There was a problem hiding this comment.
Whitelist evaluation treats any enabled whitelist rule as active, even if its value is empty. Because matchRule returns false for empty values, adding an enabled-but-empty whitelist rule will make all ports disallowed (since activeWhitelist.length > 0 and none can match). Filter activeWhitelist to only include enabled rules with a non-empty trimmed value (or create new whitelist rules as disabled by default).
| const activeWhitelist = whitelist.value.filter(rule => rule.enabled); | |
| const activeWhitelist = whitelist.value.filter(rule => rule.enabled && rule.value.trim()); |
| } | ||
| }; | ||
|
|
||
| let active_whitelist: Vec<_> = request.whitelist.iter().filter(|r| r.enabled).collect(); |
There was a problem hiding this comment.
The whitelist logic considers any enabled whitelist rule as active even if its value is empty. Since match_rule returns false for empty values, an enabled-but-empty whitelist rule will block all ports from being allowed. Consider building active_whitelist from rules that are both enabled and have a non-empty trimmed value (and/or default new whitelist rules to enabled = false).
| let active_whitelist: Vec<_> = request.whitelist.iter().filter(|r| r.enabled).collect(); | |
| let active_whitelist: Vec<_> = request | |
| .whitelist | |
| .iter() | |
| .filter(|r| r.enabled && !r.value.trim().is_empty()) | |
| .collect(); |
No description provided.