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(sidebar): expand connection node on double-click activation

Freedombd36b5f1d0cd
diff --git a/apps/desktop/src/lib/__tests__/sidebar/treeNodeClick.spec.ts b/apps/desktop/src/lib/__tests__/sidebar/treeNodeClick.spec.ts
index 8d7ba4a202..c1edb95bfe 100644
--- a/apps/desktop/src/lib/__tests__/sidebar/treeNodeClick.spec.ts
+++ b/apps/desktop/src/lib/__tests__/sidebar/treeNodeClick.spec.ts
@@ -78,6 +78,12 @@ describe("treeNodeClick", () => {
expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "postgres", false)).toBe("toggle");
});
+ it("expands the connection node on double-click activation even when the database browser is available", () => {
+ expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "postgres", true)).toBe("toggle");
+ expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "mysql", true)).toBe("toggle");
+ expect(treeNodeRowDoubleClickAction("connection", false, "double", false, "postgres", true)).toBe("none");
+ });
+
it("opens the object browser on single click when the database single-click switch is on", () => {
expect(treeNodeRowAction("database", true, "single", "postgres", true, true)).toBe("open-object-browser-and-expand");
expect(treeNodeRowAction("database", false, "single", "postgres", true, true)).toBe("open-object-browser");
diff --git a/apps/desktop/src/lib/sidebar/treeNodeClick.ts b/apps/desktop/src/lib/sidebar/treeNodeClick.ts
index 4283a2782a..0b00553cf7 100644
--- a/apps/desktop/src/lib/sidebar/treeNodeClick.ts
+++ b/apps/desktop/src/lib/sidebar/treeNodeClick.ts
@@ -147,7 +147,9 @@ export function treeNodeRowDoubleClickAction(type: TreeNodeType, canOpenObjectBr
// sequence. Only double-click activation needs a second-stage table action.
if (type === "table") return activation === "double" ? "activate-data" : "none";
if (openDatabaseOnSingleClick && canOpenObjectBrowser && shouldOpenObjectBrowserOnSingleClick(type, true)) return "none";
- if (type === "connection" && canOpenDatabaseBrowser) return "open-database-browser";
+ // 双击激活模式下,双击连接节点应当展开树(与单击模式下单击展开一致),
+ // “打开数据库浏览”只保留给单击激活模式下的双击手势。
+ if (type === "connection" && canOpenDatabaseBrowser && activation !== "double") return "open-database-browser";
if (activation === "double") {
if (type === "extension") return "open-extension-details";
if (dataNodeTypes.has(type)) return "open-data";