From acf408ced251981a01ab1fe24da65986598208b2 Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Mon, 15 Jun 2026 21:03:48 +0800 Subject: [PATCH] fix(webui): collapse automation run history by default --- .../src/components/settings/SettingsView.tsx | 105 +++++++++--------- webui/src/i18n/locales/en/common.json | 2 - webui/src/i18n/locales/es/common.json | 2 - webui/src/i18n/locales/fr/common.json | 2 - webui/src/i18n/locales/id/common.json | 2 - webui/src/i18n/locales/ja/common.json | 2 - webui/src/i18n/locales/ko/common.json | 2 - webui/src/i18n/locales/vi/common.json | 2 - webui/src/i18n/locales/zh-CN/common.json | 2 - webui/src/i18n/locales/zh-TW/common.json | 2 - webui/src/tests/app-layout.test.tsx | 8 +- 11 files changed, 57 insertions(+), 74 deletions(-) diff --git a/webui/src/components/settings/SettingsView.tsx b/webui/src/components/settings/SettingsView.tsx index e5726167..2b64fbba 100644 --- a/webui/src/components/settings/SettingsView.tsx +++ b/webui/src/components/settings/SettingsView.tsx @@ -3965,67 +3965,64 @@ function AutomationRunHistory({ tx: (key: string, fallback: string, values?: Record) => string; }) { if (!history.length) return null; - const visible = expanded ? [...history].reverse() : history.slice(-4).reverse(); - const hiddenCount = history.length - visible.length; + const visible = [...history].reverse(); return (
-
-

+

- - {history.length} -
-
- {visible.map((run) => { - const status = automationRunStatusLabel(run.status, tx); - const duration = run.duration_ms === undefined - ? null - : formatAutomationRunDuration(run.duration_ms, locale, tx); - return ( -
- - + + {history.length} + + + + {expanded ? ( +
+ {visible.map((run) => { + const status = automationRunStatusLabel(run.status, tx); + const duration = run.duration_ms === undefined + ? null + : formatAutomationRunDuration(run.duration_ms, locale, tx); + return ( +
- {status} - {run.error ? ` · ${run.error}` : ""} + className={cn("mt-1.5 h-1.5 w-1.5 rounded-full", automationRunDotClass(run.status))} + aria-hidden + /> + + + {status} + {run.error ? ` · ${run.error}` : ""} + + + {fmtDateTime(run.run_at_ms, locale)} + - - {fmtDateTime(run.run_at_ms, locale)} - - - {duration ? ( - - {duration} - - ) : null} -
- ); - })} -
- {history.length > 4 ? ( - + {duration ? ( + + {duration} + + ) : null} +
+ ); + })} +
) : null}
); diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json index a691b13f..085bb19c 100644 --- a/webui/src/i18n/locales/en/common.json +++ b/webui/src/i18n/locales/en/common.json @@ -582,8 +582,6 @@ "skipped": "Skipped", "recent": "Last result", "timeline": "Run history", - "showMore": "Show {{count}} more", - "showRecent": "Show recent runs", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json index 55999f44..ae36bc52 100644 --- a/webui/src/i18n/locales/es/common.json +++ b/webui/src/i18n/locales/es/common.json @@ -582,8 +582,6 @@ "skipped": "Omitida", "recent": "Último resultado", "timeline": "Historial de ejecuciones", - "showMore": "Mostrar {{count}} más", - "showRecent": "Mostrar ejecuciones recientes", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json index be33556f..b7c886c5 100644 --- a/webui/src/i18n/locales/fr/common.json +++ b/webui/src/i18n/locales/fr/common.json @@ -582,8 +582,6 @@ "skipped": "Ignorée", "recent": "Dernier résultat", "timeline": "Historique d’exécution", - "showMore": "Afficher {{count}} de plus", - "showRecent": "Afficher les exécutions récentes", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json index f486f4cb..588bf3a1 100644 --- a/webui/src/i18n/locales/id/common.json +++ b/webui/src/i18n/locales/id/common.json @@ -582,8 +582,6 @@ "skipped": "Dilewati", "recent": "Hasil terakhir", "timeline": "Riwayat eksekusi", - "showMore": "Tampilkan {{count}} lagi", - "showRecent": "Tampilkan eksekusi terbaru", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json index faa9eec3..0c0bb222 100644 --- a/webui/src/i18n/locales/ja/common.json +++ b/webui/src/i18n/locales/ja/common.json @@ -582,8 +582,6 @@ "skipped": "スキップ", "recent": "最新結果", "timeline": "実行履歴", - "showMore": "さらに {{count}} 件表示", - "showRecent": "最近の実行のみ表示", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json index 73502c40..a7ac679a 100644 --- a/webui/src/i18n/locales/ko/common.json +++ b/webui/src/i18n/locales/ko/common.json @@ -582,8 +582,6 @@ "skipped": "건너뜀", "recent": "최근 결과", "timeline": "실행 기록", - "showMore": "{{count}}개 더 보기", - "showRecent": "최근 실행만 보기", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json index 5f565b47..be264693 100644 --- a/webui/src/i18n/locales/vi/common.json +++ b/webui/src/i18n/locales/vi/common.json @@ -582,8 +582,6 @@ "skipped": "Đã bỏ qua", "recent": "Kết quả gần nhất", "timeline": "Lịch sử chạy", - "showMore": "Hiển thị thêm {{count}}", - "showRecent": "Chỉ hiển thị lần chạy gần đây", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json index e3d13ff3..36e80dba 100644 --- a/webui/src/i18n/locales/zh-CN/common.json +++ b/webui/src/i18n/locales/zh-CN/common.json @@ -582,8 +582,6 @@ "skipped": "已跳过", "recent": "最近结果", "timeline": "运行记录", - "showMore": "再显示 {{count}} 条", - "showRecent": "只看最近记录", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json index 9ec2bb97..6e5e7713 100644 --- a/webui/src/i18n/locales/zh-TW/common.json +++ b/webui/src/i18n/locales/zh-TW/common.json @@ -582,8 +582,6 @@ "skipped": "已略過", "recent": "最近結果", "timeline": "執行記錄", - "showMore": "再顯示 {{count}} 筆", - "showRecent": "只看最近記錄", "statusWithDuration": "{{status}} · {{duration}}" }, "message": { diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx index 8fc5a013..965d89ce 100644 --- a/webui/src/tests/app-layout.test.tsx +++ b/webui/src/tests/app-layout.test.tsx @@ -629,9 +629,13 @@ describe("App layout", () => { expect(message!).not.toHaveClass("line-clamp-6"); expect(screen.queryByText(/oldest failure/)).not.toBeInTheDocument(); - fireEvent.click(within(detailPanel).getByRole("button", { name: "Show 2 more" })); + const historyToggle = within(detailPanel).getByRole("button", { name: /Run history/ }); + expect(historyToggle).toHaveAttribute("aria-expanded", "false"); + fireEvent.click(historyToggle); + expect(historyToggle).toHaveAttribute("aria-expanded", "true"); expect(screen.getAllByText(/oldest failure/)).toHaveLength(2); - fireEvent.click(within(detailPanel).getByRole("button", { name: "Show recent runs" })); + fireEvent.click(historyToggle); + expect(historyToggle).toHaveAttribute("aria-expanded", "false"); expect(screen.queryByText(/oldest failure/)).not.toBeInTheDocument(); });