From 57f2d2731348b334dadad655aa2b9ed0d1abcef9 Mon Sep 17 00:00:00 2001
From: zipg
Date: Thu, 23 Jul 2026 00:23:19 +0800
Subject: [PATCH] feat(sidebar): add configurable object metadata display
---
.../editor/EditorSettingsDialog.vue | 32 ++-
.../src/components/sidebar/ConnectionTree.vue | 68 ++++-
.../src/components/sidebar/TreeItem.vue | 100 ++-----
apps/desktop/src/i18n/locales/en.ts | 9 +-
apps/desktop/src/i18n/locales/es.ts | 9 +-
apps/desktop/src/i18n/locales/it.ts | 9 +-
apps/desktop/src/i18n/locales/ja.ts | 9 +-
apps/desktop/src/i18n/locales/pt-BR.ts | 9 +-
apps/desktop/src/i18n/locales/zh-CN.ts | 8 +-
apps/desktop/src/i18n/locales/zh-TW.ts | 8 +-
.../sidebar/sidebarDatabaseStorage.spec.ts | 65 +++++
.../sidebar/sidebarTreeItemLayout.spec.ts | 19 +-
apps/desktop/src/lib/backend/api.ts | 1 +
apps/desktop/src/lib/backend/http.ts | 5 +
apps/desktop/src/lib/backend/tauri.ts | 5 +
.../src/lib/settings/editorSettingsDraft.ts | 2 +-
.../src/lib/sidebar/sidebarDatabaseStorage.ts | 84 ++++++
.../src/lib/sidebar/sidebarTreeItemLayout.ts | 47 ++-
.../stores/__tests__/settingsStore.spec.ts | 19 ++
apps/desktop/src/stores/connectionStore.ts | 109 +++++++
apps/desktop/src/stores/settingsStore.ts | 34 ++-
apps/desktop/src/types/database.ts | 6 +
crates/dbx-core/src/db/postgres.rs | 70 ++++-
crates/dbx-core/src/schema.rs | 272 +++++++++++++++++-
crates/dbx-core/src/types.rs | 6 +
crates/dbx-web/src/main.rs | 1 +
crates/dbx-web/src/routes/schema.rs | 16 ++
src-tauri/src/commands/schema.rs | 9 +
src-tauri/src/lib.rs | 1 +
29 files changed, 889 insertions(+), 143 deletions(-)
create mode 100644 apps/desktop/src/lib/__tests__/sidebar/sidebarDatabaseStorage.spec.ts
create mode 100644 apps/desktop/src/lib/sidebar/sidebarDatabaseStorage.ts
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index e1ec1b8b1..45a19d8c6 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -39,6 +39,7 @@ import {
type InterfaceLayout,
type DisconnectTabHandlingMode,
type OpenTabsRestoreMode,
+ type SidebarObjectInfoMode,
type SqlSemanticDiagnosticsMode,
type UpdateDownloadSource,
type CustomThemeColors,
@@ -356,7 +357,7 @@ const editReuseDataTab = ref(settingsStore.editorSettings.reuseDataTab);
const editPrefillNewQueryWithSelect = ref(settingsStore.editorSettings.prefillNewQueryWithSelect);
const editUpdateNotificationsEnabled = ref(settingsStore.editorSettings.updateNotificationsEnabled);
const editSidebarHiddenTablePrefixes = ref(settingsStore.editorSettings.sidebarHiddenTablePrefixes.join("\n"));
-const editSidebarHideTableComments = ref(settingsStore.editorSettings.sidebarHideTableComments);
+const editSidebarObjectInfoMode = ref(settingsStore.editorSettings.sidebarObjectInfoMode);
const editSidebarAllowHorizontalScroll = ref(settingsStore.editorSettings.sidebarAllowHorizontalScroll);
const editExportBatchSize = ref(settingsStore.editorSettings.exportBatchSize);
const editGlobalDateTimeDisplayFormat = ref(settingsStore.editorSettings.globalDateTimeDisplayFormat);
@@ -456,7 +457,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
reuseDataTab: editReuseDataTab.value,
prefillNewQueryWithSelect: editPrefillNewQueryWithSelect.value,
updateNotificationsEnabled: editUpdateNotificationsEnabled.value,
- sidebarHideTableComments: editSidebarHideTableComments.value,
+ sidebarObjectInfoMode: editSidebarObjectInfoMode.value,
sidebarAllowHorizontalScroll: editSidebarAllowHorizontalScroll.value,
sidebarHiddenTablePrefixes: normalizeSidebarHiddenTablePrefixes(editSidebarHiddenTablePrefixes.value),
exportBatchSize: editExportBatchSize.value,
@@ -709,7 +710,7 @@ function syncEditorSettingsDraftFromStore() {
editPrefillNewQueryWithSelect.value = settingsStore.editorSettings.prefillNewQueryWithSelect;
editUpdateNotificationsEnabled.value = settingsStore.editorSettings.updateNotificationsEnabled;
editSidebarHiddenTablePrefixes.value = settingsStore.editorSettings.sidebarHiddenTablePrefixes.join("\n");
- editSidebarHideTableComments.value = settingsStore.editorSettings.sidebarHideTableComments;
+ editSidebarObjectInfoMode.value = settingsStore.editorSettings.sidebarObjectInfoMode;
editSidebarAllowHorizontalScroll.value = settingsStore.editorSettings.sidebarAllowHorizontalScroll;
editExportBatchSize.value = settingsStore.editorSettings.exportBatchSize;
editGlobalDateTimeDisplayFormat.value = settingsStore.editorSettings.globalDateTimeDisplayFormat;
@@ -817,6 +818,7 @@ async function persistSettings() {
const sidebarTablePageSizeChanged = editSidebarTablePageSize.value !== (settingsStore.desktopSettings.sidebar_table_page_size ?? DEFAULT_SIDEBAR_TABLE_PAGE_SIZE);
if (Object.keys(editorSettingsPatch).length > 0) {
settingsStore.updateEditorSettings(editorSettingsPatch);
+ await settingsStore.persistEditorSettings();
editEditorSettingsBase.value = editorSettingsDraftFromSettings(settingsStore.editorSettings);
}
await settingsStore.updateDesktopSettings({
@@ -907,7 +909,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editReuseDataTab.value = DEFAULT_EDITOR_SETTINGS.reuseDataTab;
editPrefillNewQueryWithSelect.value = DEFAULT_EDITOR_SETTINGS.prefillNewQueryWithSelect;
editUpdateNotificationsEnabled.value = DEFAULT_EDITOR_SETTINGS.updateNotificationsEnabled;
- editSidebarHideTableComments.value = DEFAULT_EDITOR_SETTINGS.sidebarHideTableComments;
+ editSidebarObjectInfoMode.value = DEFAULT_EDITOR_SETTINGS.sidebarObjectInfoMode;
editSidebarAllowHorizontalScroll.value = DEFAULT_EDITOR_SETTINGS.sidebarAllowHorizontalScroll;
editSidebarHiddenTablePrefixes.value = DEFAULT_EDITOR_SETTINGS.sidebarHiddenTablePrefixes.join("\n");
editToolbarItems.value = { ...DEFAULT_EDITOR_SETTINGS.toolbarItems };
@@ -992,7 +994,7 @@ function resetAllDefaults() {
editReuseDataTab.value = DEFAULT_EDITOR_SETTINGS.reuseDataTab;
editPrefillNewQueryWithSelect.value = DEFAULT_EDITOR_SETTINGS.prefillNewQueryWithSelect;
editUpdateNotificationsEnabled.value = DEFAULT_EDITOR_SETTINGS.updateNotificationsEnabled;
- editSidebarHideTableComments.value = DEFAULT_EDITOR_SETTINGS.sidebarHideTableComments;
+ editSidebarObjectInfoMode.value = DEFAULT_EDITOR_SETTINGS.sidebarObjectInfoMode;
editSidebarAllowHorizontalScroll.value = DEFAULT_EDITOR_SETTINGS.sidebarAllowHorizontalScroll;
editSidebarHiddenTablePrefixes.value = DEFAULT_EDITOR_SETTINGS.sidebarHiddenTablePrefixes.join("\n");
editExportBatchSize.value = DEFAULT_EDITOR_SETTINGS.exportBatchSize;
@@ -4002,14 +4004,24 @@ onUnmounted(cleanupPreviewEditor);
{{ t(`settings.${disconnectTabHandlingModeDescriptionKey}`) }}
-
+
-
-
- {{ t("settings.sidebarHideTableCommentsDescription") }}
+
+
+ {{ t("settings.sidebarObjectInfoModeDescription") }}
-
+
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index 1e6e6e60b..7ea976ae5 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -1,5 +1,5 @@