From 45fb7fb7e6168333f38361999e28252d419f9588 Mon Sep 17 00:00:00 2001 From: zipg Date: Sun, 30 Aug 2026 03:05:10 +0800 Subject: [PATCH] fix(grid): move total row count refresh into the total label Refs: #7520 --- apps/desktop/src/components/grid/DataGrid.vue | 32 +++++++++++-------- .../__tests__/DataGridTotalRowCount.spec.ts | 12 ++++--- apps/desktop/src/i18n/locales/en.ts | 1 + apps/desktop/src/i18n/locales/es.ts | 1 + apps/desktop/src/i18n/locales/it.ts | 1 + apps/desktop/src/i18n/locales/ja.ts | 1 + apps/desktop/src/i18n/locales/ko.ts | 1 + apps/desktop/src/i18n/locales/pt-BR.ts | 1 + apps/desktop/src/i18n/locales/zh-CN.ts | 1 + apps/desktop/src/i18n/locales/zh-TW.ts | 1 + packages/app-tests/dataGridPagination.test.ts | 2 +- 11 files changed, 34 insertions(+), 20 deletions(-) diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 30dab0f17b..7e0b4323fb 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -14109,26 +14109,30 @@ function openGridSnapshot() { count: result.rows.length, }) }} - {{ t(totalRowCountLabelKey, { count: displayedTotalRowCount }) }} + + + + + {{ t(totalRowCountLabelKey, { count: displayedTotalRowCount }) }} {{ t("grid.totalRowCountLoading") }} - (truncated) {{ t("grid.rowsAffected", { count: result.affected_rows }) }} diff --git a/apps/desktop/src/components/grid/__tests__/DataGridTotalRowCount.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridTotalRowCount.spec.ts index 7eb4fdf627..bb4ef83f82 100644 --- a/apps/desktop/src/components/grid/__tests__/DataGridTotalRowCount.spec.ts +++ b/apps/desktop/src/components/grid/__tests__/DataGridTotalRowCount.spec.ts @@ -12,7 +12,7 @@ const statusRenderSource = (() => { })(); const rerunBranch = (() => { - const start = statusRenderSource.indexOf("} else if ($setup.showRerunTotalCountAction) {"); + const start = statusRenderSource.indexOf("$setup.showRerunTotalCountAction && !($setup.totalRowCountBusy && !$setup.manualTotalRowCountLoading)"); return start === -1 ? "" : statusRenderSource.slice(start, statusRenderSource.indexOf("", start)); })(); @@ -48,19 +48,21 @@ describe("DataGrid rerun total row count action", () => { expect(showDataGridRerunTotalCountAction({ canCalculateTotalRowCount: true, displayedTotalRowCount: NaN, totalRowCountIsExact: true })).toBe(false); }); - it("keeps the numeric total outside the action chain and orders busy, inline link, then rerun icon", () => { + it("places the rerun icon before the numeric total and keeps the other actions ordered", () => { const numericTotal = statusRenderSource.indexOf('typeof $setup.displayedTotalRowCount === "number" && $setup.displayedTotalRowCount >= 0'); + const rerunAction = statusRenderSource.indexOf("$setup.showRerunTotalCountAction && !($setup.totalRowCountBusy && !$setup.manualTotalRowCountLoading)"); const busyBranch = statusRenderSource.indexOf("if ($setup.totalRowCountBusy && !($setup.showRerunTotalCountAction && $setup.manualTotalRowCountLoading)) {"); const inlineLink = statusRenderSource.indexOf("} else if ($setup.showExactTotalCountAction) {"); - const rerunAction = statusRenderSource.indexOf("} else if ($setup.showRerunTotalCountAction) {"); expect(numericTotal).toBeGreaterThan(-1); + expect(rerunAction).toBeGreaterThan(-1); + expect(rerunAction).toBeLessThan(numericTotal); expect(busyBranch).toBeGreaterThan(numericTotal); expect(inlineLink).toBeGreaterThan(busyBranch); - expect(rerunAction).toBeGreaterThan(inlineLink); }); it("renders a spaced rerun icon labelled for the total-count action and disabled while counting", () => { - expect(rerunBranch).toContain('