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(transfer): avoid nested dialog scrollbars

t8y2e3361ad9286a
diff --git a/apps/desktop/src/components/transfer/DataTransferDialog.vue b/apps/desktop/src/components/transfer/DataTransferDialog.vue
index 5c3ee2b57f..1b244bf2e0 100644
--- a/apps/desktop/src/components/transfer/DataTransferDialog.vue
+++ b/apps/desktop/src/components/transfer/DataTransferDialog.vue
@@ -359,15 +359,15 @@ function getConnectionName(id: string) {
<template>
<Dialog v-model:open="open">
<DialogContent class="sm:max-w-[780px] max-h-[80vh] flex flex-col overflow-hidden" @interact-outside.prevent>
- <DialogHeader>
+ <DialogHeader class="shrink-0">
<DialogTitle class="flex items-center gap-2">
<ArrowRightLeft class="w-4 h-4" />
{{ t("transfer.title") }}
</DialogTitle>
</DialogHeader>
- <div class="flex-1 min-h-0 overflow-auto">
- <div class="grid gap-4 py-3">
+ <div class="min-h-0 flex-1 overflow-hidden">
+ <div class="grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)_auto] gap-4 py-3">
<!-- Source / Target Side by Side -->
<div class="grid grid-cols-[1fr_auto_1fr] gap-4 items-start">
<!-- Source Section -->
@@ -495,7 +495,7 @@ function getConnectionName(id: string) {
</div>
<!-- Tables Section -->
- <div class="space-y-2">
+ <div class="flex min-h-0 flex-col gap-2">
<div class="flex items-center justify-between">
<div class="text-xs font-medium text-muted-foreground uppercase tracking-wider">
{{ t("transfer.tables") }}
@@ -518,7 +518,7 @@ function getConnectionName(id: string) {
<div v-else-if="sourceTables.length === 0" class="text-xs text-muted-foreground py-4 text-center">
{{ t("transfer.noTables") }}
</div>
- <div v-else class="border rounded-md max-h-[200px] overflow-y-auto">
+ <div v-else class="min-h-0 max-h-[200px] overflow-y-auto rounded-md border">
<div v-for="table in filteredTables" :key="table" class="flex items-center gap-2 px-2.5 py-1.5 hover:bg-muted/50 cursor-pointer text-xs" @click="toggleTable(table)">
<CheckSquare v-if="selectedTables.has(table)" class="w-3.5 h-3.5 text-primary shrink-0" />
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
@@ -568,7 +568,7 @@ function getConnectionName(id: string) {
</div>
</div>
- <DialogFooter>
+ <DialogFooter class="shrink-0">
<Button variant="outline" size="sm" @click="open = false">
{{ t("transfer.cancel") }}
</Button>
diff --git a/apps/desktop/src/components/transfer/__tests__/DataTransferDialog.spec.ts b/apps/desktop/src/components/transfer/__tests__/DataTransferDialog.spec.ts
new file mode 100644
index 0000000000..427e972b13
--- /dev/null
+++ b/apps/desktop/src/components/transfer/__tests__/DataTransferDialog.spec.ts
@@ -0,0 +1,22 @@
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+
+const dialogSource = readFileSync(new URL("../DataTransferDialog.vue", import.meta.url), "utf8");
+
+describe("DataTransferDialog layout", () => {
+ it("keeps the header and footer outside the shrinking content region", () => {
+ expect(dialogSource).toContain('<DialogHeader class="shrink-0">');
+ expect(dialogSource).toContain('<DialogFooter class="shrink-0">');
+ expect(dialogSource).toContain('class="min-h-0 flex-1 overflow-hidden"');
+ });
+
+ it("shrinks the table row on short viewports without adding dialog scrolling", () => {
+ expect(dialogSource).toContain('class="grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)_auto] gap-4 py-3"');
+ expect(dialogSource).toContain('class="flex min-h-0 flex-col gap-2"');
+ expect(dialogSource).not.toContain('class="flex-1 min-h-0 overflow-auto"');
+ });
+
+ it("keeps long table lists independently scrollable", () => {
+ expect(dialogSource).toContain('class="min-h-0 max-h-[200px] overflow-y-auto rounded-md border"');
+ });
+});