Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(grid): drop full-grid overlay during total row count

zipg87e3258b098d
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index cbf03da08a..2f8a905f0a 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -241,6 +241,7 @@ import {
elasticsearchCursorPageJumpRequestCount,
hasCompleteLocalDataGridResult,
hasShortDataGridSqlPage,
+ isDataGridSurfaceBusy,
reconcileDataGridExactTotalWithObservedPage,
resolveDataGridPaginationTotal,
showDataGridRerunTotalCountAction,
@@ -3644,6 +3645,8 @@ watch(
);
const manualTotalRowCount = ref<number | undefined>(undefined);
const manualTotalRowCountLoading = ref(false);
+/** True only for count-then-navigate flows (e.g. jump to last page), where the grid must stay covered. */
+const manualTotalRowCountCoversSurface = ref(false);
let manualTotalRowCountGeneration = 0;
function invalidateManualTotalRowCount() {
manualTotalRowCountGeneration++;
@@ -3772,8 +3775,20 @@ const rowPreparationProgress = shallowRef<DataGridRowPreparationProgress | null>
let rowPreparationController: AbortController | null = null;
let gridClipboardLifecycle = 0;
let gridClipboardActive = true;
-/** Automatic background counts keep rows interactive; explicit count navigation still blocks the surface. */
-const gridSurfaceBusy = computed(() => isRefreshingData.value || props.loading === true || manualTotalRowCountLoading.value || pageJumpBusy.value || rowPreparationProgress.value !== null);
+/**
+ * Automatic background counts keep rows interactive. A manual footer count only covers the grid when it is
+ * part of a navigation flow; counting total rows on demand must not look like a table refresh.
+ */
+const gridSurfaceBusy = computed(() =>
+ isDataGridSurfaceBusy({
+ isRefreshingData: isRefreshingData.value,
+ loading: props.loading === true,
+ pageJumpBusy: pageJumpBusy.value,
+ rowPreparationBusy: rowPreparationProgress.value !== null,
+ manualTotalRowCountLoading: manualTotalRowCountLoading.value,
+ manualTotalRowCountCoversSurface: manualTotalRowCountCoversSurface.value,
+ }),
+);
const gridPaginationBusy = computed(() => gridSurfaceBusy.value || totalRowCountBusy.value);
const dataGridNativeSelectionBlockOwner = {};
watch(
@@ -4251,20 +4266,26 @@ function jumpToCountedLastPage(total: number) {
requestServerPageJump(lastPageNum);
}
-async function beginManualTotalRowCount(): Promise<number | undefined> {
+async function beginManualTotalRowCount(coversSurface = false): Promise<number | undefined> {
if (manualTotalRowCountLoading.value) return undefined;
const generation = manualTotalRowCountGeneration;
+ manualTotalRowCountCoversSurface.value = coversSurface;
manualTotalRowCountLoading.value = true;
- // Flush busy UI (overlay / spinner) before the slow COUNT starts.
+ // Flush the button spinner (and the overlay for count-then-navigate flows) before the slow COUNT starts.
await nextTick();
return generation;
}
+function finishManualTotalRowCount() {
+ manualTotalRowCountLoading.value = false;
+ manualTotalRowCountCoversSurface.value = false;
+}
+
async function lastPage() {
if (infiniteScrollEnabled.value || allRowsLoaded.value) return;
// Navicat-style: always re-COUNT when jumping to the last page.
if (props.countTotalRows) {
- const generation = await beginManualTotalRowCount();
+ const generation = await beginManualTotalRowCount(true);
if (generation === undefined) return;
try {
if (generation !== manualTotalRowCountGeneration) return;
@@ -4283,12 +4304,12 @@ async function lastPage() {
5000,
);
} finally {
- manualTotalRowCountLoading.value = false;
+ finishManualTotalRowCount();
}
return;
}
if (props.connectionId && (props.countSql || canCountTableRows.value)) {
- const generation = await beginManualTotalRowCount();
+ const generation = await beginManualTotalRowCount(true);
if (generation === undefined) return;
try {
if (generation !== manualTotalRowCountGeneration) return;
@@ -4306,7 +4327,7 @@ async function lastPage() {
} catch {
// COUNT query failed — ignore silently
} finally {
- manualTotalRowCountLoading.value = false;
+ finishManualTotalRowCount();
}
return;
}
@@ -4378,7 +4399,7 @@ async function calculateTotalRowCount() {
} catch (e: any) {
toast(t("grid.calculateTotalRowsFailed", { message: e?.message || String(e) }), 5000);
} finally {
- manualTotalRowCountLoading.value = false;
+ finishManualTotalRowCount();
}
}
diff --git a/apps/desktop/src/lib/dataGrid/__tests__/dataGridPagination.spec.ts b/apps/desktop/src/lib/dataGrid/__tests__/dataGridPagination.spec.ts
index f9b151be0d..fc5b5a3af2 100644
--- a/apps/desktop/src/lib/dataGrid/__tests__/dataGridPagination.spec.ts
+++ b/apps/desktop/src/lib/dataGrid/__tests__/dataGridPagination.spec.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { ELASTICSEARCH_PAGE_JUMP_WARNING_REQUESTS, elasticsearchCursorPageJumpRequestCount, hasCompleteLocalDataGridResult, reconcileDataGridExactTotalWithObservedPage } from "@/lib/dataGrid/dataGridPagination";
+import { ELASTICSEARCH_PAGE_JUMP_WARNING_REQUESTS, elasticsearchCursorPageJumpRequestCount, hasCompleteLocalDataGridResult, isDataGridSurfaceBusy, reconcileDataGridExactTotalWithObservedPage } from "@/lib/dataGrid/dataGridPagination";
describe("Elasticsearch cursor page jumps", () => {
it("counts only missing forward cursors", () => {
@@ -55,6 +55,26 @@ describe("complete local DataGrid results", () => {
});
});
+describe("DataGrid surface busy overlay", () => {
+ const idle = { isRefreshingData: false, loading: false, pageJumpBusy: false };
+
+ it("keeps the full-surface overlay off while a footer total-row count runs", () => {
+ expect(isDataGridSurfaceBusy({ ...idle, manualTotalRowCountLoading: true, manualTotalRowCountCoversSurface: false })).toBe(false);
+ });
+
+ it("covers the surface for count-then-navigate flows", () => {
+ expect(isDataGridSurfaceBusy({ ...idle, manualTotalRowCountLoading: true, manualTotalRowCountCoversSurface: true })).toBe(true);
+ });
+
+ it("covers the surface for real reloads, page jumps, and row preparation", () => {
+ expect(isDataGridSurfaceBusy({ ...idle, isRefreshingData: true })).toBe(true);
+ expect(isDataGridSurfaceBusy({ ...idle, loading: true })).toBe(true);
+ expect(isDataGridSurfaceBusy({ ...idle, pageJumpBusy: true })).toBe(true);
+ expect(isDataGridSurfaceBusy({ ...idle, rowPreparationBusy: true })).toBe(true);
+ expect(isDataGridSurfaceBusy(idle)).toBe(false);
+ });
+});
+
describe("reconciling an exact total with an observed page (#10968)", () => {
it("adopts the observed extent when a page lands past the counted total", () => {
// Issue screenshot: COUNT said 2892, but the counted last page (offset 2800,
diff --git a/apps/desktop/src/lib/dataGrid/dataGridPagination.ts b/apps/desktop/src/lib/dataGrid/dataGridPagination.ts
index 8a1cbe3359..0b17413550 100644
--- a/apps/desktop/src/lib/dataGrid/dataGridPagination.ts
+++ b/apps/desktop/src/lib/dataGrid/dataGridPagination.ts
@@ -41,6 +41,15 @@ export interface DataGridLoadAllSegment {
limit: number;
}
+export interface DataGridSurfaceBusyOptions {
+ isRefreshingData: boolean;
+ loading: boolean;
+ pageJumpBusy: boolean;
+ rowPreparationBusy?: boolean;
+ manualTotalRowCountLoading?: boolean;
+ manualTotalRowCountCoversSurface?: boolean;
+}
+
export type DataGridInexactTotalRowCountMode = "at-least" | "estimated";
export const ELASTICSEARCH_PAGE_JUMP_WARNING_REQUESTS = 100;
@@ -72,6 +81,17 @@ export function showDataGridRerunTotalCountAction(options: { canCalculateTotalRo
return typeof options.displayedTotalRowCount === "number" && Number.isFinite(options.displayedTotalRowCount) && options.displayedTotalRowCount >= 0;
}
+/**
+ * The full-surface overlay (translucent cover + spinner + elapsed timer) is for
+ * real data reloads and page navigation only. A plain "count total rows" click
+ * runs in the background and reports progress in the result footer; covering
+ * the grid made it look like the table itself was being refreshed.
+ */
+export function isDataGridSurfaceBusy(options: DataGridSurfaceBusyOptions): boolean {
+ const manualCountCoversSurface = options.manualTotalRowCountLoading === true && options.manualTotalRowCountCoversSurface === true;
+ return options.isRefreshingData || options.loading || manualCountCoversSurface || options.pageJumpBusy || options.rowPreparationBusy === true;
+}
+
export function resolveDataGridPaginationTotal(options: { paginationTotalRowCount?: number; serverKnownTotalRowCount?: number; totalRowCountIsExact: boolean; maxRows?: number }): number | undefined {
const total = options.paginationTotalRowCount ?? (options.totalRowCountIsExact ? options.serverKnownTotalRowCount : undefined);
if (total === undefined || options.maxRows === undefined) return total;