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。

feat: add loading overlay with elapsed timer to DataGrid

t8y249f03b0c699c
diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue
index b061678b2e..2b76091a3e 100644
--- a/src/components/grid/DataGrid.vue
+++ b/src/components/grid/DataGrid.vue
@@ -2151,12 +2151,31 @@ function onDdlResizeEnd() {
window.removeEventListener("mouseup", onDdlResizeEnd);
}
+const loadingElapsed = ref(0);
+let _loadingTimer: ReturnType<typeof setInterval> | undefined;
+let _loadingStart = 0;
+
+watch(
+ () => props.loading,
+ (isLoading) => {
+ clearInterval(_loadingTimer);
+ if (isLoading) {
+ _loadingStart = Date.now();
+ loadingElapsed.value = 0;
+ _loadingTimer = setInterval(() => {
+ loadingElapsed.value = Date.now() - _loadingStart;
+ }, 100);
+ }
+ },
+);
+
onUnmounted(() => {
if (resetScrollFrame) cancelAnimationFrame(resetScrollFrame);
if (cancelScrollRestoreFrame) cancelAnimationFrame(cancelScrollRestoreFrame);
onDdlResizeEnd();
finishCellSelection();
clearTimeout(_searchTimer);
+ clearInterval(_loadingTimer);
});
const SQL_KEYWORDS =
@@ -2442,7 +2461,7 @@ defineExpose({
</div>
<!-- Content area: table + DDL drawer -->
<div class="flex-1 flex min-h-0 overflow-hidden">
- <div class="flex-1 flex flex-col min-w-0 overflow-hidden">
+ <div class="flex-1 flex flex-col min-w-0 overflow-hidden relative">
<!-- Sticky header -->
<div
ref="headerRef"
@@ -2743,6 +2762,14 @@ defineExpose({
</div>
</template>
</RecycleScroller>
+ <div v-if="loading" class="absolute inset-0 z-20 bg-background/50 flex items-center justify-center">
+ <div
+ class="flex items-center gap-2 px-3 py-1.5 rounded-md bg-background border shadow-sm text-xs text-muted-foreground"
+ >
+ <Loader2 class="w-3.5 h-3.5 animate-spin" />
+ <span>{{ (loadingElapsed / 1000).toFixed(1) }}s</span>
+ </div>
+ </div>
</div>
<!-- DDL Drawer -->
<div