feat: display table comments in sidebar tree with hover-hide behavior

Show table/view comments next to names in the sidebar, hiding them on
row hover to avoid overlap with the pin button.
This commit is contained in:
t8y2 2026-05-26 15:57:48 +08:00
parent 11ed019b0e
commit fa9bf6a508
3 changed files with 15 additions and 0 deletions

View File

@ -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)

View File

@ -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,

View File

@ -292,6 +292,7 @@ export interface TreeNode {
database?: string;
schema?: string;
tableName?: string;
comment?: string | null;
objectCount?: number;
loadedKeyCount?: number;
totalKeyCount?: number;