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: add setting to hide table comments in sidebar tree

t8y249dc85267a7f
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index e48e66ae04..02222dbed4 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -100,6 +100,7 @@ const editShortcuts = ref(normalizeShortcutSettings(settingsStore.editorSettings
const editSidebarActivation = ref(settingsStore.editorSettings.sidebarActivation);
const editAutoSelectActiveSidebarNode = ref(settingsStore.editorSettings.autoSelectActiveSidebarNode);
const editSidebarHiddenTablePrefixes = ref(settingsStore.editorSettings.sidebarHiddenTablePrefixes.join("\n"));
+const editSidebarHideTableComments = ref(settingsStore.editorSettings.sidebarHideTableComments);
const redisScanPageSizeOptions = [200, 1000, 5000, 10000];
const systemFonts = ref<string[]>([]);
const systemFontsLoading = ref(false);
@@ -231,6 +232,7 @@ watch(
editSidebarActivation.value = settingsStore.editorSettings.sidebarActivation;
editAutoSelectActiveSidebarNode.value = settingsStore.editorSettings.autoSelectActiveSidebarNode;
editSidebarHiddenTablePrefixes.value = settingsStore.editorSettings.sidebarHiddenTablePrefixes.join("\n");
+ editSidebarHideTableComments.value = settingsStore.editorSettings.sidebarHideTableComments;
editSnippets.value = settingsStore.editorSettings.snippets.map((s) => ({ ...s }));
void loadSystemFontOptions();
}
@@ -274,6 +276,7 @@ function hasChanges(): boolean {
JSON.stringify(editShortcuts.value) !== JSON.stringify(settingsStore.editorSettings.shortcuts) ||
editSidebarActivation.value !== settingsStore.editorSettings.sidebarActivation ||
editAutoSelectActiveSidebarNode.value !== settingsStore.editorSettings.autoSelectActiveSidebarNode ||
+ editSidebarHideTableComments.value !== settingsStore.editorSettings.sidebarHideTableComments ||
JSON.stringify(normalizeSidebarHiddenTablePrefixes(editSidebarHiddenTablePrefixes.value)) !==
JSON.stringify(settingsStore.editorSettings.sidebarHiddenTablePrefixes) ||
JSON.stringify(editSnippets.value) !== JSON.stringify(settingsStore.editorSettings.snippets)
@@ -296,6 +299,7 @@ async function applySettings() {
shortcuts: editShortcuts.value,
sidebarActivation: editSidebarActivation.value,
autoSelectActiveSidebarNode: editAutoSelectActiveSidebarNode.value,
+ sidebarHideTableComments: editSidebarHideTableComments.value,
sidebarHiddenTablePrefixes: normalizeSidebarHiddenTablePrefixes(editSidebarHiddenTablePrefixes.value),
snippets: editSnippets.value,
});
@@ -320,6 +324,7 @@ function resetDefaults() {
editShortcuts.value = normalizeShortcutSettings(DEFAULT_EDITOR_SETTINGS.shortcuts);
editSidebarActivation.value = DEFAULT_EDITOR_SETTINGS.sidebarActivation;
editAutoSelectActiveSidebarNode.value = DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode;
+ editSidebarHideTableComments.value = DEFAULT_EDITOR_SETTINGS.sidebarHideTableComments;
editSidebarHiddenTablePrefixes.value = DEFAULT_EDITOR_SETTINGS.sidebarHiddenTablePrefixes.join("\n");
editSnippets.value = DEFAULT_SQL_SNIPPETS.map((s) => ({ ...s }));
}
@@ -1226,6 +1231,20 @@ watch(
</div>
<Switch id="auto-select-active-sidebar-node" v-model="editAutoSelectActiveSidebarNode" />
</div>
+ <div class="flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
+ <div class="flex items-center gap-2">
+ <Label for="sidebar-hide-table-comments">{{ t("settings.sidebarHideTableComments") }}</Label>
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <CircleHelp class="h-3.5 w-3.5 cursor-help text-muted-foreground hover:text-foreground" />
+ </TooltipTrigger>
+ <TooltipContent class="max-w-[320px] text-xs leading-relaxed" side="top" align="start">
+ {{ t("settings.sidebarHideTableCommentsDescription") }}
+ </TooltipContent>
+ </Tooltip>
+ </div>
+ <Switch id="sidebar-hide-table-comments" v-model="editSidebarHideTableComments" />
+ </div>
<div class="space-y-2">
<Label for="sidebar-hidden-table-prefixes">{{ t("settings.sidebarHiddenTablePrefixes") }}</Label>
<textarea
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index e8d2e133a8..e275939584 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -1902,7 +1902,7 @@ const isDragging = computed(() => dragState.active && dragState.draggedId === pr
columnComment
}}</span>
<span
- v-if="tableComment"
+ v-if="tableComment && !settingsStore.editorSettings.sidebarHideTableComments"
class="truncate text-muted-foreground/60 text-[10px] max-w-[25%] group-hover:hidden"
:title="tableComment"
>{{ tableComment }}</span
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 56b36216d4..d2600e29d7 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -1391,6 +1391,9 @@ export default {
sidebarHiddenTablePrefixesDescription:
"One prefix per line. Only sidebar table, view, and collection labels are shortened; tooltips and actions still use the full name.",
sidebarHiddenTablePrefixesPlaceholder: "Example:\nODS_\nT8Y2_LONG_",
+ sidebarHideTableComments: "Hide table comments in sidebar",
+ sidebarHideTableCommentsDescription:
+ "Hide the inline table/view comments shown next to names in the sidebar tree to save horizontal space.",
snippetsDescription: "Customize SQL snippet templates triggered in the editor.",
snippetsAdd: "Add Snippet",
snippetsLabel: "Label",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index 63b8b53e59..b83f21a060 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -1287,6 +1287,9 @@ export default {
sidebarHiddenTablePrefixesDescription:
"Un prefijo por linea. Solo acorta etiquetas de tablas, vistas y colecciones en la barra lateral; las acciones y ayudas usan el nombre completo.",
sidebarHiddenTablePrefixesPlaceholder: "Ejemplo:\nODS_\nT8Y2_LONG_",
+ sidebarHideTableComments: "Ocultar comentarios de tablas en la barra lateral",
+ sidebarHideTableCommentsDescription:
+ "Oculta los comentarios de tablas/vistas junto a los nombres en el árbol de la barra lateral para ahorrar espacio horizontal.",
snippetsDescription: "Personaliza plantillas SQL activadas en el editor.",
snippetsAdd: "Agregar fragmento",
snippetsLabel: "Etiqueta",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index e4481fc888..06ce61d705 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -1362,6 +1362,8 @@ export default {
sidebarHiddenTablePrefixesDescription:
"每行一个前缀,仅影响侧边栏表、视图和集合的显示名称,悬浮提示和实际操作仍使用完整名称。",
sidebarHiddenTablePrefixesPlaceholder: "例如:\nODS_\nT8Y2_LONG_",
+ sidebarHideTableComments: "隐藏侧边栏表注释",
+ sidebarHideTableCommentsDescription: "隐藏侧边栏中表名旁边显示的表/视图注释,以节省横向空间。",
snippetsDescription: "自定义编辑器中触发的 SQL 代码片段模板。",
snippetsAdd: "添加片段",
snippetsLabel: "显示名",
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index e051a1cd5c..51a581372d 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -186,6 +186,7 @@ export interface EditorSettings {
sidebarActivation: SidebarActivation;
autoSelectActiveSidebarNode: boolean;
sidebarHiddenTablePrefixes: string[];
+ sidebarHideTableComments: boolean;
columnFormatters: Record<string, ColumnFormatterConfig>;
customColumnFormatters: Record<string, CustomColumnFormatterConfig>;
snippets: SqlSnippet[];
@@ -235,6 +236,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
sidebarActivation: "single",
autoSelectActiveSidebarNode: false,
sidebarHiddenTablePrefixes: [],
+ sidebarHideTableComments: false,
columnFormatters: {},
customColumnFormatters: {},
snippets: DEFAULT_SQL_SNIPPETS,
@@ -319,6 +321,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
autoSelectActiveSidebarNode:
settings.autoSelectActiveSidebarNode ?? DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode,
sidebarHiddenTablePrefixes: normalizeSidebarHiddenTablePrefixes(settings.sidebarHiddenTablePrefixes),
+ sidebarHideTableComments: settings.sidebarHideTableComments ?? DEFAULT_EDITOR_SETTINGS.sidebarHideTableComments,
columnFormatters: normalizeColumnFormatters(settings.columnFormatters),
customColumnFormatters: normalizeCustomColumnFormatters(settings.customColumnFormatters),
snippets: normalizeSqlSnippets(settings.snippets, existing?.snippets),
@@ -431,6 +434,9 @@ export const useSettingsStore = defineStore("settings", () => {
...(partial.sidebarHiddenTablePrefixes !== undefined
? { sidebarHiddenTablePrefixes: normalizeSidebarHiddenTablePrefixes(partial.sidebarHiddenTablePrefixes) }
: {}),
+ ...(partial.sidebarHideTableComments !== undefined
+ ? { sidebarHideTableComments: partial.sidebarHideTableComments }
+ : {}),
};
Object.assign(editorSettings.value, normalizedPartial);
saveEditorSettings(editorSettings.value);