diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue index 7db07ccdc..49a102931 100644 --- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue +++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue @@ -101,6 +101,7 @@ const editAppLayout = ref(settingsStore.editorSettings.appLayout); const editShowTrayIcon = ref(settingsStore.desktopSettings.show_tray_icon); const editIconTheme = ref(settingsStore.desktopSettings.icon_theme); const editDebugLoggingEnabled = ref(settingsStore.desktopSettings.debug_logging_enabled); +const editSidebarTablePageSize = ref(settingsStore.desktopSettings.sidebar_table_page_size ?? 500); const debugLogCopied = ref(false); const debugLogDownloaded = ref(false); const editShowColumnCommentsInHeader = ref(settingsStore.editorSettings.showColumnCommentsInHeader); @@ -346,6 +347,7 @@ watch( editShowTrayIcon.value = settingsStore.desktopSettings.show_tray_icon; editIconTheme.value = settingsStore.desktopSettings.icon_theme; editDebugLoggingEnabled.value = settingsStore.desktopSettings.debug_logging_enabled; + editSidebarTablePageSize.value = settingsStore.desktopSettings.sidebar_table_page_size ?? 500; editShowColumnCommentsInHeader.value = settingsStore.editorSettings.showColumnCommentsInHeader; editShowColumnTypesInHeader.value = settingsStore.editorSettings.showColumnTypesInHeader; editCompactColumnHeaderActions.value = settingsStore.editorSettings.compactColumnHeaderActions; @@ -402,6 +404,7 @@ function hasChanges(): boolean { editShowTrayIcon.value !== settingsStore.desktopSettings.show_tray_icon || editIconTheme.value !== settingsStore.desktopSettings.icon_theme || editDebugLoggingEnabled.value !== settingsStore.desktopSettings.debug_logging_enabled || + editSidebarTablePageSize.value !== (settingsStore.desktopSettings.sidebar_table_page_size ?? 500) || editShowColumnCommentsInHeader.value !== settingsStore.editorSettings.showColumnCommentsInHeader || editShowColumnTypesInHeader.value !== settingsStore.editorSettings.showColumnTypesInHeader || editCompactColumnHeaderActions.value !== settingsStore.editorSettings.compactColumnHeaderActions || @@ -464,6 +467,7 @@ async function persistSettings() { show_tray_icon: editShowTrayIcon.value, icon_theme: editIconTheme.value, debug_logging_enabled: editDebugLoggingEnabled.value, + sidebar_table_page_size: editSidebarTablePageSize.value, }); if (sidebarObjectDisplayChanged) { await connectionStore.refreshAllTree(); @@ -493,6 +497,7 @@ function resetDefaults() { editShowTrayIcon.value = DEFAULT_DESKTOP_SETTINGS.show_tray_icon; editIconTheme.value = DEFAULT_DESKTOP_SETTINGS.icon_theme; editDebugLoggingEnabled.value = DEFAULT_DESKTOP_SETTINGS.debug_logging_enabled; + editSidebarTablePageSize.value = 500; editShowColumnCommentsInHeader.value = DEFAULT_EDITOR_SETTINGS.showColumnCommentsInHeader; editShowColumnTypesInHeader.value = DEFAULT_EDITOR_SETTINGS.showColumnTypesInHeader; editCompactColumnHeaderActions.value = DEFAULT_EDITOR_SETTINGS.compactColumnHeaderActions; @@ -992,6 +997,7 @@ watch( editShowTrayIcon.value = settingsStore.desktopSettings.show_tray_icon; editIconTheme.value = settingsStore.desktopSettings.icon_theme; editDebugLoggingEnabled.value = settingsStore.desktopSettings.debug_logging_enabled; + editSidebarTablePageSize.value = settingsStore.desktopSettings.sidebar_table_page_size ?? 500; webdavPassword.value = ""; await refreshWebDavPasswordStatus(); syncAiEditState(); @@ -2045,6 +2051,29 @@ watch( {{ t("settings.sidebarHiddenTablePrefixesDescription") }}

+
+
+ +

+ {{ t("settings.sidebarTablePageSizeDescription") }} +

+
+ +
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts index 548735650..5c95a0fe2 100644 --- a/apps/desktop/src/i18n/locales/en.ts +++ b/apps/desktop/src/i18n/locales/en.ts @@ -2215,6 +2215,8 @@ export default { sidebarHiddenTablePrefixes: "Hidden table name prefixes", 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_", + sidebarTablePageSize: "Sidebar page size", + sidebarTablePageSizeDescription: "Maximum number of tables/objects loaded per page in the sidebar tree. Increase if you have many tables and want fewer pages.", 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.", sidebarAllowHorizontalScroll: "Allow sidebar horizontal scroll", diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts index 16c29fc8a..3b32f9e7c 100644 --- a/apps/desktop/src/i18n/locales/es.ts +++ b/apps/desktop/src/i18n/locales/es.ts @@ -1912,6 +1912,8 @@ export default { sidebarHiddenTablePrefixes: "Prefijos ocultos de tablas", 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_", + sidebarTablePageSize: "Tamaño de página de la barra lateral", + sidebarTablePageSizeDescription: "Número máximo de tablas/objetos cargados por página en el árbol lateral. Auméntalo si tienes muchas tablas para reducir páginas.", 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.", sidebarAllowHorizontalScroll: "Permitir desplazamiento horizontal lateral", diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts index 8b9161e77..6cee3a5d7 100644 --- a/apps/desktop/src/i18n/locales/it.ts +++ b/apps/desktop/src/i18n/locales/it.ts @@ -1985,6 +1985,8 @@ export default { sidebarHiddenTablePrefixes: "Prefissi dei nomi delle tabelle nascosti", sidebarHiddenTablePrefixesDescription: "Un prefisso per riga. Solo le etichette di tabelle, viste e collezioni della barra laterale vengono abbreviate; i suggerimenti e le azioni utilizzano ancora il nome completo.", sidebarHiddenTablePrefixesPlaceholder: "Esempio:\nODS_\nT8Y2_LONG_", + sidebarTablePageSize: "Dimensione pagina barra laterale", + sidebarTablePageSizeDescription: "Numero massimo di tabelle/oggetti caricati per pagina nell'albero laterale. Aumentalo se hai molte tabelle per ridurre le pagine.", sidebarHideTableComments: "Nascondi i commenti delle tabelle nella barra laterale", sidebarHideTableCommentsDescription: "Nascondi i commenti in linea delle tabelle/viste mostrati accanto ai nomi nell'albero della barra laterale per risparmiare spazio orizzontale.", sidebarAllowHorizontalScroll: "Consenti scorrimento orizzontale barra laterale", diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts index ccae23d28..4a16cd6a5 100644 --- a/apps/desktop/src/i18n/locales/ja.ts +++ b/apps/desktop/src/i18n/locales/ja.ts @@ -2200,6 +2200,8 @@ export default { sidebarHiddenTablePrefixes: "非表示テーブル名プレフィックス", sidebarHiddenTablePrefixesDescription: "1行に1つのプレフィックス。サイドバーのテーブル、ビュー、コレクションラベルのみ短縮されます。ツールチップと操作は完全な名前を使用します。", sidebarHiddenTablePrefixesPlaceholder: "Example:\nODS_\nT8Y2_LONG_", + sidebarTablePageSize: "サイドバーのページサイズ", + sidebarTablePageSizeDescription: "サイドバーツリーで1ページあたりに読み込むテーブル/オブジェクトの最大数です。テーブルが多い場合は増やすとページ切り替えが減ります。", sidebarHideTableComments: "サイドバーのテーブルコメントを非表示", sidebarHideTableCommentsDescription: "横のスペースを節約するため、サイドバーツリーで名前の横に表示されるテーブル/ビューコメントを非表示にします。", sidebarAllowHorizontalScroll: "サイドバーの横スクロールを許可", diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts index 1757aaaf6..d631af32d 100644 --- a/apps/desktop/src/i18n/locales/pt-BR.ts +++ b/apps/desktop/src/i18n/locales/pt-BR.ts @@ -1996,6 +1996,8 @@ export default { sidebarHiddenTablePrefixes: "Prefixos de nome de tabela ocultos", sidebarHiddenTablePrefixesDescription: "Um prefixo por linha. Apenas os rótulos de tabela, view e coleção da barra lateral são encurtados; tooltips e ações ainda usam o nome completo.", sidebarHiddenTablePrefixesPlaceholder: "Exemplo:\nODS_\nT8Y2_LONG_", + sidebarTablePageSize: "Tamanho da página da barra lateral", + sidebarTablePageSizeDescription: "Número máximo de tabelas/objetos carregados por página na árvore lateral. Aumente se tiver muitas tabelas para reduzir páginas.", sidebarHideTableComments: "Ocultar comentários de tabela na barra lateral", sidebarHideTableCommentsDescription: "Ocultar os comentários inline de tabela/view exibidos ao lado dos nomes na árvore da barra lateral para economizar espaço horizontal.", sidebarAllowHorizontalScroll: "Permitir rolagem horizontal da barra lateral", diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts index 23691c25f..a2ba6a994 100644 --- a/apps/desktop/src/i18n/locales/zh-CN.ts +++ b/apps/desktop/src/i18n/locales/zh-CN.ts @@ -2239,6 +2239,8 @@ export default { sidebarHiddenTablePrefixes: "隐藏表名前缀", sidebarHiddenTablePrefixesDescription: "每行一个前缀,仅影响侧边栏表、视图和集合的显示名称,悬浮提示和实际操作仍使用完整名称。", sidebarHiddenTablePrefixesPlaceholder: "例如:\nODS_\nT8Y2_LONG_", + sidebarTablePageSize: "侧边栏分页大小", + sidebarTablePageSizeDescription: "侧边栏树每页最多加载的表/对象数量。表多时可以调大减少翻页次数。", sidebarHideTableComments: "隐藏侧边栏表注释", sidebarHideTableCommentsDescription: "隐藏侧边栏中表名旁边显示的表/视图注释,以节省横向空间。", sidebarAllowHorizontalScroll: "允许侧边栏横向滚动", diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts index 772ddc004..eb0442412 100644 --- a/apps/desktop/src/i18n/locales/zh-TW.ts +++ b/apps/desktop/src/i18n/locales/zh-TW.ts @@ -2022,6 +2022,8 @@ export default { sidebarHiddenTablePrefixes: "隱藏資料表名稱字首", sidebarHiddenTablePrefixesDescription: "每行一個字首。只縮短側邊欄中的資料表、檢視和集合標籤;工具提示和實際操作仍使用完整名稱。", sidebarHiddenTablePrefixesPlaceholder: "範例:\nODS_\nT8Y2_LONG_", + sidebarTablePageSize: "側邊欄分頁大小", + sidebarTablePageSizeDescription: "側邊欄樹每頁最多載入的資料表/物件數量。資料表多時可調大減少翻頁次數。", sidebarHideTableComments: "隱藏側邊欄資料表註解", sidebarHideTableCommentsDescription: "隱藏側邊欄樹狀清單中名稱旁的資料表/檢視註解,以節省橫向空間。", sidebarAllowHorizontalScroll: "允許側邊欄水平捲動", diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts index 878705014..c5000c438 100644 --- a/apps/desktop/src/stores/connectionStore.ts +++ b/apps/desktop/src/stores/connectionStore.ts @@ -51,7 +51,11 @@ import { useSettingsStore } from "@/stores/settingsStore"; const PINNED_TREE_NODES_STORAGE_KEY = "dbx-pinned-tree-nodes"; const ACTIVE_CONNECTION_STORAGE_KEY = "dbx-active-connection"; -const SIDEBAR_OBJECT_GROUP_PAGE_SIZE = 500; +function sidebarObjectGroupPageSize(): number { + const settingsStore = useSettingsStore(); + const size = settingsStore.desktopSettings.sidebar_table_page_size; + return typeof size === "number" && size > 0 ? size : 500; +} type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip"; // Temporary storage for DataGrip import payload (used to read Keychain passwords after import) @@ -1321,9 +1325,9 @@ export const useConnectionStore = defineStore("connection", () => { effectiveSchema, objectTypes, offset: 0, - pageSize: SIDEBAR_OBJECT_GROUP_PAGE_SIZE, + pageSize: sidebarObjectGroupPageSize(), }); - children = page.hasMore && !sidebarSearchQuery.value ? [...page.children, buildLoadMoreNode(node, page.nextOffset, SIDEBAR_OBJECT_GROUP_PAGE_SIZE)] : page.children; + children = page.hasMore && !sidebarSearchQuery.value ? [...page.children, buildLoadMoreNode(node, page.nextOffset, sidebarObjectGroupPageSize())] : page.children; node.objectCount = page.objectCount; } else { const objects = await api.listObjects(node.connectionId, node.database, querySchema, objectTypes); diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts index ec93cff02..67b942217 100644 --- a/apps/desktop/src/stores/settingsStore.ts +++ b/apps/desktop/src/stores/settingsStore.ts @@ -44,6 +44,7 @@ export interface DesktopSettings { driver_store_dir?: string | null; plugin_store_dir?: string | null; agent_store_dir?: string | null; + sidebar_table_page_size?: number | null; } export type DesktopIconTheme = "default" | "black"; @@ -58,10 +59,12 @@ export const DEFAULT_DESKTOP_SETTINGS: DesktopSettings = { driver_store_dir: null, plugin_store_dir: null, agent_store_dir: null, + sidebar_table_page_size: 500, }; function normalizeDesktopSettings(settings: Partial | null | undefined): DesktopSettings { const iconTheme = settings?.icon_theme === "black" ? "black" : DEFAULT_DESKTOP_SETTINGS.icon_theme; + const sidebarTablePageSize = typeof settings?.sidebar_table_page_size === "number" && settings.sidebar_table_page_size > 0 ? settings.sidebar_table_page_size : DEFAULT_DESKTOP_SETTINGS.sidebar_table_page_size; return { show_tray_icon: settings?.show_tray_icon ?? DEFAULT_DESKTOP_SETTINGS.show_tray_icon, icon_theme: iconTheme, @@ -70,6 +73,7 @@ function normalizeDesktopSettings(settings: Partial | null | un driver_store_dir: settings?.driver_store_dir?.trim() || DEFAULT_DESKTOP_SETTINGS.driver_store_dir, plugin_store_dir: settings?.plugin_store_dir?.trim() || DEFAULT_DESKTOP_SETTINGS.plugin_store_dir, agent_store_dir: settings?.agent_store_dir?.trim() || DEFAULT_DESKTOP_SETTINGS.agent_store_dir, + sidebar_table_page_size: sidebarTablePageSize, }; } diff --git a/crates/dbx-core/src/storage.rs b/crates/dbx-core/src/storage.rs index d33d08acf..82382d4ae 100644 --- a/crates/dbx-core/src/storage.rs +++ b/crates/dbx-core/src/storage.rs @@ -46,6 +46,12 @@ pub struct DesktopSettings { pub plugin_store_dir: Option, #[serde(default)] pub agent_store_dir: Option, + #[serde(default = "default_sidebar_table_page_size")] + pub sidebar_table_page_size: usize, +} + +fn default_sidebar_table_page_size() -> usize { + 500 } impl Default for DesktopSettings { @@ -58,6 +64,7 @@ impl Default for DesktopSettings { driver_store_dir: None, plugin_store_dir: None, agent_store_dir: None, + sidebar_table_page_size: 500, } } } @@ -626,6 +633,11 @@ impl Storage { .map(str::trim) .filter(|value| !value.is_empty()) .map(ToString::to_string), + sidebar_table_page_size: settings + .get("sidebar_table_page_size") + .and_then(|value| value.as_u64()) + .map(|value| value as usize) + .unwrap_or_else(|| DesktopSettings::default().sidebar_table_page_size), }) }