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: display table comments in sidebar tree with hover-hide behavior

t8y2fa9bf6a50841
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 6d9fab7cf9..462de1b8a6 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -1572,6 +1572,12 @@ const columnComment = computed(() =>
? (props.node.meta as any).comment
: null,
);
+const tableComment = computed(() =>
+ (props.node.type === "table" || props.node.type === "view" || props.node.type === "mongo-collection") &&
+ props.node.comment
+ ? props.node.comment
+ : null,
+);
const paddingLeft = computed(() => treeItemPaddingLeft(props.depth));
const isConnected = computed(
() =>
@@ -1891,6 +1897,12 @@ const isDragging = computed(() => dragState.active && dragState.draggedId === pr
<span v-if="columnComment" class="truncate text-muted-foreground/60 text-[10px] max-w-[40%]">{{
columnComment
}}</span>
+ <span
+ v-if="tableComment"
+ class="truncate text-muted-foreground/60 text-[10px] max-w-[50%] group-hover:hidden"
+ :title="tableComment"
+ >{{ tableComment }}</span
+ >
<span
v-if="
node.type === 'connection' && node.connectionId && connectionStore.connectedIds.has(node.connectionId)
diff --git a/apps/desktop/src/lib/tableTree.ts b/apps/desktop/src/lib/tableTree.ts
index 2f0b9ce507..7fef0a4d8b 100644
--- a/apps/desktop/src/lib/tableTree.ts
+++ b/apps/desktop/src/lib/tableTree.ts
@@ -25,6 +25,7 @@ export function buildTableTreeNodes({
id: `${nodeId}:${name}`,
label: name,
type: table.table_type === "VIEW" ? ("view" as const) : ("table" as const),
+ comment: table.comment,
connectionId,
database,
schema,
@@ -130,6 +131,7 @@ export function buildGroupedObjectTreeNodes({
id: `${nodeId}:${def.key}:${childSchema ? `${childSchema}:` : ""}${obj.name}`,
label: obj.name,
type: def.childType,
+ comment: obj.comment,
connectionId,
database,
schema: childSchema,
diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts
index 35793335e9..2efa4fed1b 100644
--- a/apps/desktop/src/types/database.ts
+++ b/apps/desktop/src/types/database.ts
@@ -292,6 +292,7 @@ export interface TreeNode {
database?: string;
schema?: string;
tableName?: string;
+ comment?: string | null;
objectCount?: number;
loadedKeyCount?: number;
totalKeyCount?: number;