兩個問題一次修:
1. Stage 順序亂跳 — 「Stage 1 等待中、Stage 2 完成、Stage 3 進行中」
根因:Wails Webview JS load 需 1-3 秒(Windows 乾淨環境更慢),這段
期間 Go 的 Pipeline.Start 已經 emit Stage 1 running event 甚至跑完
Stage 1 / Stage 2,但前端 EventsOn 還沒掛上去,events 全被丟掉。前端
接到的第一個 event 可能是 Stage 2 completed 或 Stage 3 running,
stages[1].status 仍是初始 pending 值,UI 顯示亂序。
修法:
- 新增 Go binding GetStartupSnapshot() 回傳 pipeline 當前所有 stages
狀態(含 current / startedAt / status)。
- 前端 init 流程在 subscribeEvents 後立即拉一次 snapshot,補上漏掉
的 stage 狀態。
- updateStage 加 monotonic 模式:snapshot 補漏時不會用較舊狀態覆蓋
已收到的較新狀態(避免 race condition 倒退)。
- status 優先級 STAGE_STATUS_RANK = pending<running<{skipped,failed}<completed
2. 進度條已等待秒數顯示錯誤 — 「進度 3 / 6 · 已等待 20 秒」
根因:pause 機制讓 elapsed 計算失準(pause 期間 wall clock 仍走但
stages[i].startedAt 沒重設,會顯示明顯比真實還久的數字)。使用者
覺得不需要顯示秒數。
修法:
- paintProgressBar 移除 elapsedText 邏輯,永遠顯示 progressLabel
- i18n 文案移除 {elapsed} placeholder(zh-TW + en):
stage.1.detail.seedSlow / stage.3.detail.waitHealth /
stage.3.detail.waitHealthSlow 都改為固定文案
- Go 端 emit 仍會傳 elapsed(waitProgress callback 不變),但前端
i18n template 不再用該變數,自然就不顯示
驗證:
- visiona-local 套件 go build / vet / test -race 全綠
- macOS dmg 163MB 重 build OK
- Wails bindings 自動 regen 含 GetStartupSnapshot
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
84 lines
2.0 KiB
JavaScript
Executable File
84 lines
2.0 KiB
JavaScript
Executable File
// @ts-check
|
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
// This file is automatically generated. DO NOT EDIT
|
|
|
|
export function ClearLogs() {
|
|
return window['go']['main']['App']['ClearLogs']();
|
|
}
|
|
|
|
export function ExportLog() {
|
|
return window['go']['main']['App']['ExportLog']();
|
|
}
|
|
|
|
export function ForceKillServer() {
|
|
return window['go']['main']['App']['ForceKillServer']();
|
|
}
|
|
|
|
export function GetBootstrapStatus() {
|
|
return window['go']['main']['App']['GetBootstrapStatus']();
|
|
}
|
|
|
|
export function GetPreferences() {
|
|
return window['go']['main']['App']['GetPreferences']();
|
|
}
|
|
|
|
export function GetRecentLogs(arg1) {
|
|
return window['go']['main']['App']['GetRecentLogs'](arg1);
|
|
}
|
|
|
|
export function GetServerStatus() {
|
|
return window['go']['main']['App']['GetServerStatus']();
|
|
}
|
|
|
|
export function GetServerStatusV2() {
|
|
return window['go']['main']['App']['GetServerStatusV2']();
|
|
}
|
|
|
|
export function GetServerURL() {
|
|
return window['go']['main']['App']['GetServerURL']();
|
|
}
|
|
|
|
export function GetStartupSnapshot() {
|
|
return window['go']['main']['App']['GetStartupSnapshot']();
|
|
}
|
|
|
|
export function GetSystemInfo() {
|
|
return window['go']['main']['App']['GetSystemInfo']();
|
|
}
|
|
|
|
export function InstallKneronDriver() {
|
|
return window['go']['main']['App']['InstallKneronDriver']();
|
|
}
|
|
|
|
export function OpenBrowser(arg1) {
|
|
return window['go']['main']['App']['OpenBrowser'](arg1);
|
|
}
|
|
|
|
export function OpenInBrowser(arg1) {
|
|
return window['go']['main']['App']['OpenInBrowser'](arg1);
|
|
}
|
|
|
|
export function RestartServer() {
|
|
return window['go']['main']['App']['RestartServer']();
|
|
}
|
|
|
|
export function RestartStartupSequence() {
|
|
return window['go']['main']['App']['RestartStartupSequence']();
|
|
}
|
|
|
|
export function RevealLogsFolder() {
|
|
return window['go']['main']['App']['RevealLogsFolder']();
|
|
}
|
|
|
|
export function SetPreferences(arg1) {
|
|
return window['go']['main']['App']['SetPreferences'](arg1);
|
|
}
|
|
|
|
export function StartServer() {
|
|
return window['go']['main']['App']['StartServer']();
|
|
}
|
|
|
|
export function StopServer() {
|
|
return window['go']['main']['App']['StopServer']();
|
|
}
|