From 94c945bc19a8cbb22308e81ce8b85113f28e49b7 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Sun, 19 Apr 2026 14:30:14 +0800 Subject: [PATCH] Rename last good config in UI --- internal/web/ui/templates/config_preview.html | 4 ++-- internal/web/ui_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/web/ui/templates/config_preview.html b/internal/web/ui/templates/config_preview.html index 862583e..c888cea 100644 --- a/internal/web/ui/templates/config_preview.html +++ b/internal/web/ui/templates/config_preview.html @@ -120,7 +120,7 @@
sha: {{shortHash .ConfigStatus.Sha256}}
-
last_good
+
上一份配置
{{if and .ConfigStatus.LastGood .ConfigStatus.LastGood.Exists .ConfigStatus.LastGood.Metadata.ConfigID}}{{.ConfigStatus.LastGood.Metadata.ConfigID}} / {{if .ConfigStatus.LastGood.Metadata.ConfigVersion}}{{.ConfigStatus.LastGood.Metadata.ConfigVersion}}{{else}}未标记{{end}}{{else}}-{{end}}
{{if and .ConfigStatus.LastGood .ConfigStatus.LastGood.Metadata.Overlays}}{{range $i, $name := .ConfigStatus.LastGood.Metadata.Overlays}}{{if $i}}, {{end}}{{$name}}{{end}}{{else}}-{{end}}
sha: {{if .ConfigStatus.LastGood}}{{shortHash .ConfigStatus.LastGood.Sha256}}{{end}}
@@ -135,7 +135,7 @@
{{if and .ConfigStatus.LastGood .ConfigStatus.Sha256 .ConfigStatus.LastGood.Sha256 (eq .ConfigStatus.Metadata.ConfigID .ConfigStatus.LastGood.Metadata.ConfigID) (eq .ConfigStatus.Metadata.ConfigVersion .ConfigStatus.LastGood.Metadata.ConfigVersion) (ne .ConfigStatus.Sha256 .ConfigStatus.LastGood.Sha256)}} -
当前运行与 last_good 的 config_id/config_version 相同,但文件内容不同,请以 overlaysha 为准。
+
当前运行与上一份配置回滚点的 config_id/config_version 相同,但文件内容不同,请以 overlaysha 为准。
{{end}} {{end}} diff --git a/internal/web/ui_test.go b/internal/web/ui_test.go index 1921787..0b41815 100644 --- a/internal/web/ui_test.go +++ b/internal/web/ui_test.go @@ -562,7 +562,7 @@ func TestUI_ConfigPreviewShowsApplySummaryAfterApplyResult(t *testing.T) { "应用结果摘要", "当前运行", "preview_edge-01 / v2", - "last_good", + "上一份配置", "local_3588_face_debug / 20260419.120246", "face_test_sensitive, production_quiet", "face_debug", @@ -697,6 +697,7 @@ func TestUI_ActionDeviceConfigCandidateApplyReloadsStatusAfterApply(t *testing.T "local_3588_face_debug / 20260419.120246", "已清空", "运行中", + "上一份配置", } { if !strings.Contains(body, want) { t.Fatalf("expected apply result HTML to contain %q, got:\n%s", want, body)