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(sidebar): show table comments on hover

t8y2a9882d5312a4
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index a8f93f231a..495e688ef6 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -271,7 +271,22 @@ function visibleLabel(node: TreeNode): string {
return displayLabel(node);
}
+function cleanTooltipValue(value: string | null | undefined): string {
+ return String(value ?? "").trim();
+}
+
+const tableInfoTooltip = computed(() => {
+ const node = props.node;
+ if (node.type !== "table" && node.type !== "view") return null;
+ const rows = [
+ { label: t("structureEditor.tableName"), value: visibleLabel(node) },
+ { label: t("structureEditor.comment"), value: cleanTooltipValue(node.comment), multiline: true },
+ ].filter((row) => row.value);
+ return { rows };
+});
+
function isTooltipDisabled(): boolean {
+ if (tableInfoTooltip.value?.rows.length) return isRenamingGroup.value;
return isRenamingGroup.value || !isLabelTruncated();
}
@@ -3068,6 +3083,19 @@ function treeItemMenuItems(): ContextMenuItem[] {
<Pin class="w-3 h-3" :class="{ 'fill-current': isPinned }" />
</button>
</div>
+ <template v-if="tableInfoTooltip" #content>
+ <div class="w-max min-w-40 max-w-[min(28rem,calc(100vw-24px))] rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-lg">
+ <div class="space-y-1">
+ <div v-for="row in tableInfoTooltip.rows" :key="row.label" class="grid grid-cols-[max-content_minmax(0,1fr)] gap-2 text-[11px] leading-4">
+ <span class="text-muted-foreground">{{ row.label }}</span>
+ <span v-if="row.multiline" class="max-h-20 overflow-hidden whitespace-pre-wrap break-words text-foreground/90">
+ {{ row.value }}
+ </span>
+ <span v-else class="truncate font-mono text-foreground/90" :title="row.value">{{ row.value }}</span>
+ </div>
+ </div>
+ </div>
+ </template>
</LightTooltip>
</div>
</CustomContextMenu>