From d2e3cc2a527514ecffd7d5f9dfa2adfa6306cc4f Mon Sep 17 00:00:00 2001 From: xuans Date: Thu, 24 Sep 2026 23:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=B8=AD=E6=96=87=E5=AE=A1?= =?UTF-8?q?=E8=AE=A1=E5=8A=A8=E4=BD=9C=E5=B9=B6=E4=BF=9D=E7=95=99=E6=9C=AA?= =?UTF-8?q?=E7=9F=A5=E7=B1=BB=E5=9E=8B=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Dashboard/Dashboard.js | 3 +++ frontend/src/views/Dashboard/Dashboard.test.js | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/frontend/src/views/Dashboard/Dashboard.js b/frontend/src/views/Dashboard/Dashboard.js index 3b9e635..eb45b34 100644 --- a/frontend/src/views/Dashboard/Dashboard.js +++ b/frontend/src/views/Dashboard/Dashboard.js @@ -303,6 +303,9 @@ export function useDashboard() { } function auditActionLabel(value) { + if (typeof value === "string" && /\p{Script=Han}/u.test(value)) { + return value.trim(); + } return displayLabel(auditActionLabels, value); } diff --git a/frontend/src/views/Dashboard/Dashboard.test.js b/frontend/src/views/Dashboard/Dashboard.test.js index 3ee7382..5b45e65 100644 --- a/frontend/src/views/Dashboard/Dashboard.test.js +++ b/frontend/src/views/Dashboard/Dashboard.test.js @@ -151,3 +151,15 @@ test("关闭管理设置会停止 DNS 等待计时器", async (t) => { pending.resolve(verifiedResponse()); await task; }); + +test("auditActionLabel", async (t) => { + const { state } = await setup(t, () => verifiedResponse()); + const localized = state.auditActionLabels.settings_update; + assert.equal(state.auditActionLabel(localized), localized); + assert.equal(state.auditActionLabel(` ${localized} `), localized); + assert.equal(state.auditActionLabel("settings_update"), localized); + assert.equal(state.auditActionLabel("unmapped_action"), state.taskTypeLabel("unmapped_action")); + assert.equal(state.auditActionLabel(null), state.taskTypeLabel(null)); + assert.equal(state.auditActionLabel(undefined), state.taskTypeLabel(undefined)); + assert.equal(state.auditActionLabel(""), state.taskTypeLabel("")); +}); \ No newline at end of file