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(settings): improve sidebar search

二丫讲梵35d5e90378fe
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 9d715acd03..45e29c7a93 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -276,6 +276,7 @@ const editingShortcutId = ref<ShortcutActionId | null>(null);
const editSidebarActivation = ref(settingsStore.editorSettings.sidebarActivation);
const editSidebarObjectDisplay = ref(settingsStore.editorSettings.sidebarObjectDisplay);
const sidebarObjectDisplayHelp = ref<"grouped" | "simple" | null>(null);
+const editSidebarTableSearchEnabled = ref(settingsStore.editorSettings.sidebarTableSearchEnabled);
const editAutoSelectActiveSidebarNode = ref(settingsStore.editorSettings.autoSelectActiveSidebarNode);
const editOpenTabsRestoreMode = ref<OpenTabsRestoreMode>(settingsStore.editorSettings.openTabsRestoreMode);
const editDisconnectTabHandlingMode = ref<DisconnectTabHandlingMode>(settingsStore.editorSettings.disconnectTabHandlingMode);
@@ -570,6 +571,7 @@ watch(
sqlFormatterConfigValid.value = true;
editSidebarActivation.value = settingsStore.editorSettings.sidebarActivation;
editSidebarObjectDisplay.value = settingsStore.editorSettings.sidebarObjectDisplay;
+ editSidebarTableSearchEnabled.value = settingsStore.editorSettings.sidebarTableSearchEnabled;
editAutoSelectActiveSidebarNode.value = settingsStore.editorSettings.autoSelectActiveSidebarNode;
editOpenTabsRestoreMode.value = settingsStore.editorSettings.openTabsRestoreMode;
editDisconnectTabHandlingMode.value = settingsStore.editorSettings.disconnectTabHandlingMode;
@@ -661,6 +663,7 @@ function hasChanges(): boolean {
JSON.stringify(editSqlFormatter.value) !== JSON.stringify(normalizeSqlFormatterSettings(settingsStore.editorSettings.sqlFormatter)) ||
editSidebarActivation.value !== settingsStore.editorSettings.sidebarActivation ||
editSidebarObjectDisplay.value !== settingsStore.editorSettings.sidebarObjectDisplay ||
+ editSidebarTableSearchEnabled.value !== settingsStore.editorSettings.sidebarTableSearchEnabled ||
editAutoSelectActiveSidebarNode.value !== settingsStore.editorSettings.autoSelectActiveSidebarNode ||
editOpenTabsRestoreMode.value !== settingsStore.editorSettings.openTabsRestoreMode ||
editDisconnectTabHandlingMode.value !== settingsStore.editorSettings.disconnectTabHandlingMode ||
@@ -711,6 +714,7 @@ async function persistSettings() {
sqlFormatter: normalizeSqlFormatterSettings(editSqlFormatter.value),
sidebarActivation: editSidebarActivation.value,
sidebarObjectDisplay: editSidebarObjectDisplay.value,
+ sidebarTableSearchEnabled: editSidebarTableSearchEnabled.value,
autoSelectActiveSidebarNode: editAutoSelectActiveSidebarNode.value,
openTabsRestoreMode: editOpenTabsRestoreMode.value,
disconnectTabHandlingMode: editDisconnectTabHandlingMode.value,
@@ -800,6 +804,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editSidebarTablePageSize.value = DEFAULT_SIDEBAR_TABLE_PAGE_SIZE;
editSidebarActivation.value = DEFAULT_EDITOR_SETTINGS.sidebarActivation;
editSidebarObjectDisplay.value = DEFAULT_EDITOR_SETTINGS.sidebarObjectDisplay;
+ editSidebarTableSearchEnabled.value = DEFAULT_EDITOR_SETTINGS.sidebarTableSearchEnabled;
editAutoSelectActiveSidebarNode.value = DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode;
editOpenTabsRestoreMode.value = DEFAULT_EDITOR_SETTINGS.openTabsRestoreMode;
editDisconnectTabHandlingMode.value = DEFAULT_EDITOR_SETTINGS.disconnectTabHandlingMode;
@@ -870,6 +875,7 @@ function resetAllDefaults() {
sqlFormatterConfigValid.value = true;
editSidebarActivation.value = DEFAULT_EDITOR_SETTINGS.sidebarActivation;
editSidebarObjectDisplay.value = DEFAULT_EDITOR_SETTINGS.sidebarObjectDisplay;
+ editSidebarTableSearchEnabled.value = DEFAULT_EDITOR_SETTINGS.sidebarTableSearchEnabled;
editAutoSelectActiveSidebarNode.value = DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode;
editOpenTabsRestoreMode.value = DEFAULT_EDITOR_SETTINGS.openTabsRestoreMode;
editDisconnectTabHandlingMode.value = DEFAULT_EDITOR_SETTINGS.disconnectTabHandlingMode;
@@ -2854,6 +2860,15 @@ onUnmounted(cleanupPreviewEditor);
</Button>
</div>
</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-table-search-enabled">{{ t("settings.sidebarTableSearchEnabled") }}</Label>
+ <HelpTooltip :label="t('settings.sidebarTableSearchEnabled')">
+ {{ t("settings.sidebarTableSearchEnabledDescription") }}
+ </HelpTooltip>
+ </div>
+ <Switch id="sidebar-table-search-enabled" v-model="editSidebarTableSearchEnabled" />
+ </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="auto-select-active-sidebar-node">{{ t("settings.autoSelectActiveSidebarNode") }}</Label>
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index 6d90819bce..50710d2ba9 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -73,6 +73,24 @@ function refreshActiveSidebarTableSearches() {
}
}
+watch(
+ () => settingsStore.editorSettings.sidebarTableSearchEnabled,
+ (enabled) => {
+ if (enabled) return;
+ const parentNodeIds = Object.keys(store.sidebarTableSearchQueries);
+ if (parentNodeIds.length === 0) return;
+
+ for (const parentNodeId of parentNodeIds) {
+ window.clearTimeout(tableSearchTimers.get(parentNodeId));
+ tableSearchTimers.delete(parentNodeId);
+ tableSearchFocusRestoreTokens.delete(parentNodeId);
+ store.setSidebarTableSearchQuery(parentNodeId, "");
+ }
+ latestTableSearchInteractionParentId = null;
+ void Promise.all(parentNodeIds.map((parentNodeId) => store.refreshSidebarTableSearch(parentNodeId))).catch(() => {});
+ },
+);
+
watch(deferredSearchQuery, (newQuery, oldQuery) => {
store.sidebarSearchQuery = newQuery;
const tasks: Promise<void>[] = [];
@@ -256,7 +274,7 @@ const filteredNodes = computed(() => {
const flatNodes = computed<FlatTreeNode[]>(() =>
insertSidebarTableSearchControls(flattenTree(filteredNodes.value), {
- enabled: !isFiltering.value,
+ enabled: settingsStore.editorSettings.sidebarTableSearchEnabled && !isFiltering.value,
sidebarObjectDisplay: settingsStore.editorSettings.sidebarObjectDisplay,
activeQueries: store.sidebarTableSearchQueries,
}),
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 63558f8031..787db9293c 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -3944,6 +3944,16 @@ const rowStyle = computed(() => {
"--tree-connection-active-focus-bg": hexToRgba(color, 0.22),
};
});
+const tableSearchStyle = computed(() => {
+ const color = connectionColor.value;
+ const rowBackgroundColor = color ? hexToRgba(color, isActiveConnectionScope.value ? 0.14 : 0.08) : "transparent";
+ return {
+ paddingLeft: paddingLeft.value,
+ "--tree-table-search-row-bg": rowBackgroundColor,
+ "--tree-table-search-input-bg": color ? hexToRgba(color, isActiveConnectionScope.value ? 0.05 : 0.03) : "hsl(var(--background) / 0.56)",
+ "--tree-table-search-border": color ? hexToRgba(color, isActiveConnectionScope.value ? 0.12 : 0.08) : "hsl(var(--border) / 0.36)",
+ };
+});
function togglePin() {
connectionStore.toggleTreeNodePin(props.node.id);
@@ -4933,7 +4943,7 @@ function treeItemMenuItems(): ContextMenuItem[] {
</script>
<template>
- <div v-if="node.type === 'table-search-control'" class="flex h-7 items-center py-0.5 pr-2" :style="{ paddingLeft }" @click.stop @dblclick.stop @mousedown.stop @keydown.stop>
+ <div v-if="node.type === 'table-search-control'" class="tree-table-search-control flex h-7 items-center py-0.5 pr-2" :style="tableSearchStyle" @click.stop @dblclick.stop @mousedown.stop @keydown.stop>
<div class="relative w-full min-w-0">
<Search class="pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" />
<Input
@@ -4941,7 +4951,8 @@ function treeItemMenuItems(): ContextMenuItem[] {
autocapitalize="off"
autocorrect="off"
spellcheck="false"
- class="h-6 w-full rounded border-border/70 bg-background pl-7 pr-6 text-xs shadow-none focus-visible:ring-1"
+ class="h-6 w-full rounded border pl-7 pr-6 text-xs shadow-none focus-visible:ring-1"
+ :style="{ backgroundColor: 'var(--tree-table-search-input-bg)', borderColor: 'var(--tree-table-search-border)' }"
:placeholder="t(node.label)"
:aria-label="t(node.label)"
:data-sidebar-table-search-parent-id="tableSearchParentId"
@@ -5606,6 +5617,26 @@ function treeItemMenuItems(): ContextMenuItem[] {
background-color: var(--tree-connection-active-focus-bg, var(--tree-connection-active-bg));
}
+.tree-table-search-control {
+ position: relative;
+ isolation: isolate;
+ background-color: transparent;
+}
+
+.tree-table-search-control::before {
+ content: "";
+ position: absolute;
+ inset: 0 -9999px;
+ z-index: 0;
+ background-color: var(--tree-table-search-row-bg);
+ pointer-events: none;
+}
+
+.tree-table-search-control > * {
+ position: relative;
+ z-index: 1;
+}
+
/* Unfocused: subtle gray */
.tree-item-active {
background-color: var(--tree-connection-active-bg, rgb(235 235 235)) !important;
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 293b085a56..9d7492087c 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -2883,6 +2883,8 @@ export default {
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.",
+ sidebarTableSearchEnabled: "Enable table search inside databases",
+ sidebarTableSearchEnabledDescription: "Show a local table search box under expanded databases, schemas, or table groups so each scope can filter tables independently.",
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 936cc6256d..dd03b4ddfd 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -2827,6 +2827,8 @@ export default withEnglishFallback({
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.",
+ sidebarTableSearchEnabled: "Activar búsqueda de tablas por base",
+ sidebarTableSearchEnabledDescription: "Muestra un buscador local bajo bases de datos, schemas o grupos de tablas expandidos para filtrar tablas por separado.",
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 69b4da48c7..3576e64e50 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -2825,6 +2825,8 @@ export default withEnglishFallback({
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.",
+ sidebarTableSearchEnabled: "Abilita ricerca tabelle nel database",
+ sidebarTableSearchEnabledDescription: "Mostra una casella di ricerca locale sotto database, schema o gruppi di tabelle espansi per filtrare le tabelle separatamente.",
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 e822922451..96ac11d777 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -2816,6 +2816,8 @@ export default withEnglishFallback({
sidebarHiddenTablePrefixesPlaceholder: "Example:\nODS_\nT8Y2_LONG_",
sidebarTablePageSize: "サイドバーのページサイズ",
sidebarTablePageSizeDescription: "サイドバーツリーで1ページあたりに読み込むテーブル/オブジェクトの最大数です。テーブルが多い場合は増やすとページ切り替えが減ります。",
+ sidebarTableSearchEnabled: "データベース内のテーブル検索を有効化",
+ sidebarTableSearchEnabledDescription: "展開済みのデータベース、schema、またはテーブルグループの下にローカル検索ボックスを表示し、スコープごとにテーブルを絞り込みます。",
sidebarHideTableComments: "サイドバーのテーブルコメントを非表示",
sidebarHideTableCommentsDescription: "横のスペースを節約するため、サイドバーツリーで名前の横に表示されるテーブル/ビューコメントを非表示にします。",
sidebarAllowHorizontalScroll: "サイドバーの横スクロールを許可",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index a7e528c9a9..0d30ce604d 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -2826,6 +2826,8 @@ export default withEnglishFallback({
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.",
+ sidebarTableSearchEnabled: "Ativar busca de tabelas por banco",
+ sidebarTableSearchEnabledDescription: "Mostra uma busca local sob bancos, schemas ou grupos de tabelas expandidos para filtrar tabelas separadamente.",
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 1337ff7acd..3ab6d75844 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -2883,6 +2883,8 @@ export default withEnglishFallback({
sidebarHiddenTablePrefixesPlaceholder: "例如:\nODS_\nT8Y2_LONG_",
sidebarTablePageSize: "侧边栏分页大小",
sidebarTablePageSizeDescription: "侧边栏树每页最多加载的表/对象数量。表多时可以调大减少翻页次数。",
+ sidebarTableSearchEnabled: "启用库下表搜索框",
+ sidebarTableSearchEnabledDescription: "在已展开的数据库、schema 或表分组下显示局部表搜索框,用于为不同库分别过滤表。",
sidebarHideTableComments: "隐藏侧边栏表注释",
sidebarHideTableCommentsDescription: "隐藏侧边栏中表名旁边显示的表/视图注释,以节省横向空间。",
sidebarAllowHorizontalScroll: "允许侧边栏横向滚动",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 62958cff7c..7cc28003ff 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -2723,6 +2723,8 @@ export default withEnglishFallback({
sidebarHiddenTablePrefixesPlaceholder: "範例:\nODS_\nT8Y2_LONG_",
sidebarTablePageSize: "側邊欄分頁大小",
sidebarTablePageSizeDescription: "側邊欄樹每頁最多載入的資料表/物件數量。資料表多時可調大減少翻頁次數。",
+ sidebarTableSearchEnabled: "啟用庫下資料表搜尋框",
+ sidebarTableSearchEnabledDescription: "在已展開的資料庫、schema 或資料表分組下顯示局部資料表搜尋框,用於為不同庫分別篩選資料表。",
sidebarHideTableComments: "隱藏側邊欄資料表註解",
sidebarHideTableCommentsDescription: "隱藏側邊欄樹狀清單中名稱旁的資料表/檢視註解,以節省橫向空間。",
sidebarAllowHorizontalScroll: "允許側邊欄水平捲動",
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index 0eac0e3ea0..731d686920 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -399,6 +399,7 @@ export interface EditorSettings {
sqlFormatter: SqlFormatterSettings;
sidebarActivation: SidebarActivation;
sidebarObjectDisplay: "grouped" | "simple";
+ sidebarTableSearchEnabled: boolean;
autoSelectActiveSidebarNode: boolean;
openTabsRestoreMode: OpenTabsRestoreMode;
disconnectTabHandlingMode: DisconnectTabHandlingMode;
@@ -522,6 +523,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
sqlFormatter: normalizeSqlFormatterSettings(DEFAULT_SQL_FORMATTER_SETTINGS),
sidebarActivation: "single",
sidebarObjectDisplay: "grouped",
+ sidebarTableSearchEnabled: false,
autoSelectActiveSidebarNode: false,
openTabsRestoreMode: "all",
disconnectTabHandlingMode: "close-tabs",
@@ -742,6 +744,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
sqlFormatter: normalizeSqlFormatterSettings(settings.sqlFormatter),
sidebarActivation: settings.sidebarActivation === "single" || settings.sidebarActivation === "double" ? settings.sidebarActivation : DEFAULT_EDITOR_SETTINGS.sidebarActivation,
sidebarObjectDisplay: settings.sidebarObjectDisplay === "simple" || settings.sidebarObjectDisplay === "grouped" ? settings.sidebarObjectDisplay : DEFAULT_EDITOR_SETTINGS.sidebarObjectDisplay,
+ sidebarTableSearchEnabled: typeof settings.sidebarTableSearchEnabled === "boolean" ? settings.sidebarTableSearchEnabled : DEFAULT_EDITOR_SETTINGS.sidebarTableSearchEnabled,
autoSelectActiveSidebarNode: settings.autoSelectActiveSidebarNode ?? DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode,
openTabsRestoreMode: normalizeOpenTabsRestoreMode((settings as Partial<EditorSettings>).openTabsRestoreMode, (settings as Partial<EditorSettings> & { restoreOpenTabsOnLaunch?: boolean }).restoreOpenTabsOnLaunch),
disconnectTabHandlingMode: normalizeDisconnectTabHandlingMode((settings as Partial<EditorSettings>).disconnectTabHandlingMode, (settings as Partial<EditorSettings> & { closeQueryTabsOnDisconnect?: boolean }).closeQueryTabsOnDisconnect),
@@ -978,6 +981,7 @@ export const useSettingsStore = defineStore("settings", () => {
if (partial.sqlFormatter !== undefined) editorSettings.value.sqlFormatter = normalizeSqlFormatterSettings(partial.sqlFormatter);
if (partial.sidebarActivation !== undefined) editorSettings.value.sidebarActivation = partial.sidebarActivation;
if (partial.sidebarObjectDisplay !== undefined) editorSettings.value.sidebarObjectDisplay = partial.sidebarObjectDisplay;
+ if (partial.sidebarTableSearchEnabled !== undefined) editorSettings.value.sidebarTableSearchEnabled = partial.sidebarTableSearchEnabled;
if (partial.autoSelectActiveSidebarNode !== undefined) editorSettings.value.autoSelectActiveSidebarNode = partial.autoSelectActiveSidebarNode;
if (partial.openTabsRestoreMode !== undefined) editorSettings.value.openTabsRestoreMode = normalizeOpenTabsRestoreMode(partial.openTabsRestoreMode);
if (partial.disconnectTabHandlingMode !== undefined) editorSettings.value.disconnectTabHandlingMode = normalizeDisconnectTabHandlingMode(partial.disconnectTabHandlingMode);
diff --git a/packages/app-tests/settingsStore.test.ts b/packages/app-tests/settingsStore.test.ts
index 8beae79f75..8b818a9318 100644
--- a/packages/app-tests/settingsStore.test.ts
+++ b/packages/app-tests/settingsStore.test.ts
@@ -148,6 +148,14 @@ test("defaults update notifications to enabled", () => {
assert.equal(normalizeEditorSettings({ updateNotificationsEnabled: false } as any).updateNotificationsEnabled, false);
});
+test("defaults sidebar table search to disabled and preserves saved booleans", () => {
+ assert.equal(DEFAULT_EDITOR_SETTINGS.sidebarTableSearchEnabled, false);
+ assert.equal(normalizeEditorSettings({}).sidebarTableSearchEnabled, false);
+ assert.equal(normalizeEditorSettings({ sidebarTableSearchEnabled: true }).sidebarTableSearchEnabled, true);
+ assert.equal(normalizeEditorSettings({ sidebarTableSearchEnabled: false }).sidebarTableSearchEnabled, false);
+ assert.equal(normalizeEditorSettings({ sidebarTableSearchEnabled: "yes" as any }).sidebarTableSearchEnabled, false);
+});
+
test("defaults shortcut settings", () => {
const settings = normalizeEditorSettings({});
diff --git a/packages/app-tests/sidebarTableSearchControl.test.ts b/packages/app-tests/sidebarTableSearchControl.test.ts
index c4059ef9b7..4fe6369e60 100644
--- a/packages/app-tests/sidebarTableSearchControl.test.ts
+++ b/packages/app-tests/sidebarTableSearchControl.test.ts
@@ -205,3 +205,23 @@ test("hides local table search controls while global sidebar filtering is active
assert.deepEqual(nodes.map((item) => item.node.type), ["database"]);
});
+
+test("does not insert local table search controls when the user setting is disabled", () => {
+ const tableGroup: TreeNode = {
+ id: "conn:app:__tables",
+ label: "tree.tables",
+ type: "group-tables",
+ connectionId: "conn",
+ database: "app",
+ isExpanded: true,
+ children: [{ id: "conn:app:orders", label: "orders", type: "table", connectionId: "conn", database: "app" }],
+ };
+
+ const nodes = insertSidebarTableSearchControls([flat(tableGroup, 1)], {
+ enabled: false,
+ sidebarObjectDisplay: "grouped",
+ activeQueries: { "conn:app:__tables": "orders" },
+ });
+
+ assert.deepEqual(nodes.map((item) => item.node.type), ["group-tables"]);
+});