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(sidebar): show comments and object sizes together

二丫讲梵b07f043e7e4d
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index ab122229c7..e98dda01f5 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -8605,6 +8605,7 @@ onUnmounted(() => {
<SelectItem value="comment-aligned">{{ t("settings.sidebarObjectInfoModeCommentAligned") }}</SelectItem>
<SelectItem value="comment-right">{{ t("settings.sidebarObjectInfoModeCommentRight") }}</SelectItem>
<SelectItem value="size">{{ t("settings.sidebarObjectInfoModeSize") }}</SelectItem>
+ <SelectItem value="comment-and-size">{{ t("settings.sidebarObjectInfoModeCommentAndSize") }}</SelectItem>
<SelectItem value="hidden">{{ t("settings.sidebarObjectInfoModeHidden") }}</SelectItem>
</SelectContent>
</Select>
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index fc30bb9154..3dbada050d 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -958,7 +958,7 @@ function scheduleSidebarCommentLabelMeasure() {
function sidebarNodeHasTrailingMetadata(node: TreeNode): boolean {
const mode = settingsStore.editorSettings.sidebarObjectInfoMode;
if (mode.startsWith("comment-") && sidebarTreeNodeComment(node, settingsStore.editorSettings.sidebarShowConnectionNotes)) return true;
- return mode === "size" && sidebarStorageDisplayTypes.has(node.type) && !!formatSidebarObjectStorage(node.sizeBytes);
+ return (mode === "size" || mode === "comment-and-size") && sidebarStorageDisplayTypes.has(node.type) && !!formatSidebarObjectStorage(node.sizeBytes);
}
const sidebarTreeNaturalWidthItems = computed(() =>
@@ -1022,7 +1022,7 @@ watch(
);
const visibleSidebarTableStorageScopes = computed(() => {
- if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size") return [];
+ if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size" && settingsStore.editorSettings.sidebarObjectInfoMode !== "comment-and-size") return [];
return sidebarTableStorageScopes(flatNodes.value.map(({ node }) => node)).filter((scope) => supportsSidebarTableStorage(store.getConfig(scope.connectionId)));
});
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 414d54b271..1528d0f0d7 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -934,7 +934,8 @@ function refreshTrailingCommentMeasurement() {
}
function formattedObjectStorage(): string {
- if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size" || (activeNode.value.type !== "database" && activeNode.value.type !== "table" && activeNode.value.type !== "materialized_view")) return "";
+ const mode = settingsStore.editorSettings.sidebarObjectInfoMode;
+ if ((mode !== "size" && mode !== "comment-and-size") || (activeNode.value.type !== "database" && activeNode.value.type !== "table" && activeNode.value.type !== "materialized_view")) return "";
return formatSidebarObjectStorage(activeNode.value.sizeBytes);
}
@@ -942,7 +943,11 @@ function formattedObjectStorage(): string {
// 后留下一大段空白。无论全局是 aligned 还是 inline,连接节点的 comment 都紧跟 label。
const alignedCommentLabelWidth = computed(() => (settingsStore.editorSettings.sidebarObjectInfoMode === "comment-aligned" && activeNode.value.type !== "connection" ? props.commentLabelWidth : undefined));
-function alignedCommentLeadingStyle(): { width: string } | undefined {
+function alignedCommentLeadingStyle(): { width: string } | { maxWidth: string } | undefined {
+ if (settingsStore.editorSettings.sidebarObjectInfoMode === "comment-and-size" && trailingComment.value) {
+ // Reserve the inline comment's margin so a long name cannot push into the size column.
+ return { maxWidth: "max(0px, calc(100% - 1rem))" };
+ }
const width = alignedCommentLeadingWidth(alignedCommentLabelWidth.value, canTreeNodePin(activeNode.value.type));
return width === undefined ? undefined : { width: `${width}px` };
}
@@ -1700,7 +1705,7 @@ function onKeydown(event: KeyboardEvent) {
<Ban class="h-2.5 w-2.5 stroke-[3]" aria-hidden="true" />
</span>
</span>
- <div ref="trailingCommentLayoutRef" :class="hasTrailingMetadata() ? 'flex flex-1 min-w-0 items-center' : 'contents'">
+ <div ref="trailingCommentLayoutRef" :class="[hasTrailingMetadata() ? 'flex flex-1 min-w-0 items-center' : 'contents', { 'overflow-hidden': settingsStore.editorSettings.sidebarObjectInfoMode === 'comment-and-size' }]">
<div ref="trailingCommentLeadingRef" :class="trailingComment ? 'flex max-w-full min-w-0 shrink-0 items-center gap-2' : formattedObjectStorage() ? 'flex min-w-0 flex-1 items-center gap-2' : 'contents'" :style="alignedCommentLeadingStyle()">
<input
v-if="isRenamingGroup || isRenamingSavedSql || isRenamingConnection"
diff --git a/apps/desktop/src/components/sidebar/__tests__/TreeItem.routineComments.spec.ts b/apps/desktop/src/components/sidebar/__tests__/TreeItem.routineComments.spec.ts
index 3ee16cbf04..23e657c947 100644
--- a/apps/desktop/src/components/sidebar/__tests__/TreeItem.routineComments.spec.ts
+++ b/apps/desktop/src/components/sidebar/__tests__/TreeItem.routineComments.spec.ts
@@ -7,7 +7,8 @@ import TreeItem from "@/components/sidebar/TreeItem.vue";
import { createSidebarTreeRuntime, sidebarTreeRuntimeKey, type SidebarTreeRuntimeHost } from "@/lib/sidebar/sidebarTreeRuntime";
import type { ConnectionConfig, TreeNode } from "@/types/database";
-let commentMode = "comment-inline";
+const commentMode = ref("comment-inline");
+const allowHorizontalScroll = ref(false);
const connectionStore = {
activeConnectionId: "connection-1",
@@ -48,9 +49,13 @@ vi.mock("@/stores/settingsStore", () => ({
editorSettings: {
shortcuts: { openDataInNewTab: "" },
sidebarActivation: "double",
- sidebarAllowHorizontalScroll: false,
+ get sidebarAllowHorizontalScroll() {
+ return allowHorizontalScroll.value;
+ },
sidebarHiddenTablePrefixes: [],
- sidebarObjectInfoMode: commentMode,
+ get sidebarObjectInfoMode() {
+ return commentMode.value;
+ },
sidebarShowConnectionNotes: false,
sidebarShowTooltips: true,
},
@@ -90,17 +95,106 @@ async function mountTreeItem(initialNode: TreeNode, commentLabelWidth?: number)
}
beforeEach(async () => {
- commentMode = "comment-inline";
+ commentMode.value = "comment-inline";
+ allowHorizontalScroll.value = false;
await setLocale("en");
});
afterEach(async () => {
for (const app of mountedApps.splice(0)) app.unmount();
document.body.replaceChildren();
+ vi.restoreAllMocks();
await setLocale("en");
});
describe("TreeItem routine and object comments (#9962)", () => {
+ const tableNode: TreeNode = {
+ id: "connection-1:master:dbo:orders:TABLE",
+ label: "orders",
+ type: "table",
+ comment: "Customer orders",
+ sizeBytes: 1536,
+ connectionId: "connection-1",
+ database: "master",
+ schema: "dbo",
+ };
+
+ it.each([
+ ["both", "Customer orders", 1536],
+ ["comment only", "Customer orders", undefined],
+ ["size only", undefined, 1536],
+ ["neither", undefined, undefined],
+ ] as const)("renders available metadata in combination mode: %s", async (_name, comment, sizeBytes) => {
+ commentMode.value = "comment-and-size";
+ const { container } = await mountTreeItem({ ...tableNode, comment, sizeBytes });
+ expect(container.querySelector(".sidebar-object-comment")?.textContent ?? null).toBe(comment ?? null);
+ expect(container.querySelector(".tabular-nums")?.textContent ?? null).toBe(sizeBytes === undefined ? null : "1.5 KB");
+ });
+
+ it("updates both metadata fields when lazy-loaded object data arrives", async () => {
+ commentMode.value = "comment-and-size";
+ const { container, node } = await mountTreeItem({ ...tableNode, comment: undefined, sizeBytes: undefined });
+ node.value.comment = "Loaded comment";
+ node.value.sizeBytes = 0;
+ await nextTick();
+ expect(container.querySelector(".sidebar-object-comment")?.textContent).toBe("Loaded comment");
+ expect(container.querySelector(".tabular-nums")?.textContent).toBe("0 B");
+ });
+
+ it.each([false, true])("reserves the right-hand size slot when horizontal scrolling is %s", async (horizontalScroll) => {
+ commentMode.value = "comment-and-size";
+ allowHorizontalScroll.value = horizontalScroll;
+ const { container } = await mountTreeItem({ ...tableNode, label: "long_table_name_".repeat(20), comment: "Long comment ".repeat(40) });
+ const comment = container.querySelector(".sidebar-object-comment")!;
+ const label = container.querySelector(".tree-object-label")!;
+ const size = container.querySelector(".tabular-nums")!;
+ const metadata = comment.parentElement!;
+ expect(metadata.contains(label)).toBe(true);
+ expect(metadata.contains(size)).toBe(false);
+ expect(metadata.parentElement).toBe(size.parentElement);
+ expect(metadata.classList.contains("min-w-0")).toBe(true);
+ expect(metadata.classList.contains("overflow-hidden")).toBe(true);
+ expect((label.parentElement as HTMLElement).style.maxWidth).toBe("max(0px, calc(100% - 1rem))");
+ expect(comment.classList.contains("truncate")).toBe(true);
+ expect(label.classList.contains("truncate")).toBe(true);
+ expect(size.classList.contains("shrink-0")).toBe(true);
+ expect(size.classList.contains("ml-auto")).toBe(true);
+ });
+
+ it.each(["comment-inline", "comment-aligned", "size", "hidden"])("preserves the existing %s mode", async (mode) => {
+ commentMode.value = mode;
+ const { container } = await mountTreeItem(tableNode, 100);
+ expect(container.querySelector(".sidebar-object-comment")?.textContent ?? null).toBe(mode.startsWith("comment-") ? "Customer orders" : null);
+ expect(container.querySelector(".tabular-nums")?.textContent ?? null).toBe(mode === "size" ? "1.5 KB" : null);
+ });
+
+ it("preserves right-aligned comments without displaying size", async () => {
+ commentMode.value = "comment-right";
+ const frames: FrameRequestCallback[] = [];
+ vi.spyOn(window, "requestAnimationFrame").mockImplementation((callback) => {
+ frames.push(callback);
+ return frames.length;
+ });
+ const { container } = await mountTreeItem(tableNode);
+ const leading = container.querySelector(".tree-object-label")!.parentElement!;
+ Object.defineProperty(leading, "scrollWidth", { configurable: true, value: 100 });
+ Object.defineProperty(leading.parentElement!, "clientWidth", { configurable: true, value: 400 });
+ for (const callback of frames.splice(0)) callback(0);
+ await nextTick();
+ expect(container.querySelector(".sidebar-object-comment--right")?.textContent).toBe("Customer orders");
+ expect(container.querySelector(".tabular-nums")).toBeNull();
+ });
+
+ it("switches between existing and combined modes without remounting", async () => {
+ const { container } = await mountTreeItem(tableNode);
+ for (const mode of ["comment-and-size", "size", "hidden", "comment-inline", "comment-and-size"]) {
+ commentMode.value = mode;
+ await nextTick();
+ expect(container.querySelector(".sidebar-object-comment")?.textContent ?? null).toBe(mode.startsWith("comment-") ? "Customer orders" : null);
+ expect(container.querySelector(".tabular-nums")?.textContent ?? null).toBe(mode === "size" || mode === "comment-and-size" ? "1.5 KB" : null);
+ }
+ });
+
it("renders inline comments for procedures and functions", async () => {
const procedureNode: TreeNode = {
id: "connection-1:master:dbo:usp_calculate_tax:PROCEDURE",
diff --git a/apps/desktop/src/i18n/__tests__/thaiLocale.spec.ts b/apps/desktop/src/i18n/__tests__/thaiLocale.spec.ts
index 96a227ac08..65a624cea0 100644
--- a/apps/desktop/src/i18n/__tests__/thaiLocale.spec.ts
+++ b/apps/desktop/src/i18n/__tests__/thaiLocale.spec.ts
@@ -66,6 +66,12 @@ describe("Thai locale", () => {
expect(`${placeholder}\n${hint}\n${tableFilterExample}`).not.toContain("{'|'}");
});
+ it("localizes the combined sidebar comment and object-size mode", () => {
+ expect(th.settings.sidebarObjectInfoModeCommentAndSize).toBe("คอมเมนต์ + ขนาดออบเจ็กต์");
+ expect(th.settings.sidebarObjectInfoModeDescription).toContain("ทั้งสองอย่าง");
+ expect(th.settings.sidebarObjectInfoModeDescription).not.toContain("ใช้พร้อมกันไม่ได้");
+ });
+
it("loads Thai lazily and persists an explicit selection", async () => {
globalThis.localStorage.clear();
await setLocale("th");
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index e2d5aa90c8..5cf72ba92c 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -7738,11 +7738,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "Hər əhatə dairəsində cədvəlləri müstəqil süzmək üçün genişləndirilmiş verilənlər bazaları, sxemlər və ya cədvəl qruplarının altında yerli cədvəl axtarışı sahəsi göstər.",
sidebarObjectInfoMode: "Yan paneldə əlavə məlumat",
sidebarObjectInfoModeDescription:
- "Adlardan sonra şərhlər, obyekt ölçüləri və ya əlavə mətnin olmamasını seçin. Şərhlər və ölçülər eyni anda göstərilə bilməz. Verilənlər bazalarının ümumi ölçüləri hazırda PostgreSQL üçün; cədvəl ölçüləri isə MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng və ClickHouse üçün dəstəklənir.",
+ "Şərhləri, obyekt ölçülərini, hər ikisini göstərməyi və ya əlavə məlumatı gizlətməyi seçin. Hər ikisi seçildikdə şərh addan sonra, ölçü isə ən sağda göstərilir. Məlumatı olmayan hissələr gizlədilir. Verilənlər bazalarının ümumi ölçüləri hazırda PostgreSQL üçün; cədvəl ölçüləri isə MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng və ClickHouse üçün dəstəklənir.",
sidebarObjectInfoModeCommentInline: "Şərhlər (addan sonra)",
sidebarObjectInfoModeCommentAligned: "Şərhlər (eyni səviyyədəkiləri düzləndir)",
sidebarObjectInfoModeCommentRight: "Şərhlər (sağa düzləndir)",
sidebarObjectInfoModeSize: "Obyekt ölçüsü",
+ sidebarObjectInfoModeCommentAndSize: "Şərhlər + obyekt ölçüsü",
sidebarObjectInfoModeHidden: "Yoxdur",
sidebarAllowHorizontalScroll: "Yan paneldə üfüqi sürüşdürməyə icazə ver",
sidebarAllowHorizontalScrollDescription: "Yan paneldə üfüqi sürüşdürməyə icazə verərək uzun cədvəl, görünüş və kolleksiya adlarını tam göstər.",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 5e8f9da424..b7098e82b0 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -9064,11 +9064,12 @@ export default {
sidebarSearchOpenedDatabasesOnlyDescription: "The sidebar search loads only databases you have opened in the active connection (all of them when none is opened). Turn off to search every database of the connection.",
sidebarObjectInfoMode: "Sidebar supplementary info",
sidebarObjectInfoModeDescription:
- "Choose comments, object sizes, or no supplementary text after names. Comments and sizes are mutually exclusive. Database totals currently support PostgreSQL; table sizes support MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng, and ClickHouse.",
+ "Choose comments, object sizes, both, or no supplementary text after names. When both are enabled, the comment follows the name and the size is shown at the far right. Information with no corresponding data is hidden. Database totals currently support PostgreSQL; table sizes support MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng, and ClickHouse.",
sidebarObjectInfoModeCommentInline: "Comments (after name)",
sidebarObjectInfoModeCommentAligned: "Comments (align siblings)",
sidebarObjectInfoModeCommentRight: "Comments (align right)",
sidebarObjectInfoModeSize: "Object size",
+ sidebarObjectInfoModeCommentAndSize: "Comments + object size",
sidebarObjectInfoModeHidden: "None",
sidebarAllowHorizontalScroll: "Allow sidebar horizontal scroll",
sidebarAllowHorizontalScrollDescription: "Show long table, view, and collection names in full by allowing horizontal sidebar scrolling.",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index e6fe9624d9..9ad2f7186e 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -8160,11 +8160,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "Muestra un buscador local bajo bases de datos, schemas o grupos de tablas expandidos para filtrar tablas por separado.",
sidebarObjectInfoMode: "Información adicional lateral",
sidebarObjectInfoModeDescription:
- "Elige comentarios, tamaños de objetos o ningún texto tras los nombres. Los comentarios y tamaños son excluyentes. El tamaño total de bases admite PostgreSQL; los tamaños de tablas admiten MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng y ClickHouse.",
+ "Elige comentarios, tamaños de objetos, ambos o ninguna información adicional. Al mostrar ambos, el comentario aparece tras el nombre y el tamaño en el extremo derecho. La información sin datos disponibles se oculta. El tamaño total de bases admite PostgreSQL; los tamaños de tablas admiten MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng y ClickHouse.",
sidebarObjectInfoModeCommentInline: "Comentarios (junto al nombre)",
sidebarObjectInfoModeCommentAligned: "Comentarios (alinear nivel)",
sidebarObjectInfoModeCommentRight: "Comentarios (alinear a la derecha)",
sidebarObjectInfoModeSize: "Tamaño del objeto",
+ sidebarObjectInfoModeCommentAndSize: "Comentarios + tamaño del objeto",
sidebarObjectInfoModeHidden: "Ninguna",
sidebarAllowHorizontalScroll: "Permitir desplazamiento horizontal lateral",
sidebarAllowHorizontalScrollDescription: "Muestra completos los nombres largos de tablas, vistas y colecciones permitiendo desplazamiento horizontal en la barra lateral.",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index 78f86040ec..bf38ef8a15 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -8502,11 +8502,12 @@ export default withEnglishFallback({
sidebarSearchOpenedDatabasesOnlyDescription: "Pencarian bilah sisi hanya memuat database yang sudah Anda buka pada koneksi aktif (semuanya jika tidak ada yang terbuka). Nonaktifkan untuk mencari semua database pada koneksi tersebut.",
sidebarObjectInfoMode: "Info tambahan bilah sisi",
sidebarObjectInfoModeDescription:
- "Pilih komentar, ukuran objek, atau tanpa teks tambahan setelah nama. Komentar dan ukuran saling eksklusif. Total database saat ini mendukung PostgreSQL; ukuran tabel mendukung MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng, dan ClickHouse.",
+ "Pilih komentar, ukuran objek, keduanya, atau tanpa info tambahan. Jika keduanya dipilih, komentar tampil setelah nama dan ukuran di paling kanan. Informasi yang datanya tidak tersedia akan disembunyikan. Total database saat ini mendukung PostgreSQL; ukuran tabel mendukung MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng, dan ClickHouse.",
sidebarObjectInfoModeCommentInline: "Komentar (setelah nama)",
sidebarObjectInfoModeCommentAligned: "Komentar (sejajarkan dengan item sejenis)",
sidebarObjectInfoModeCommentRight: "Komentar (rata kanan)",
sidebarObjectInfoModeSize: "Ukuran objek",
+ sidebarObjectInfoModeCommentAndSize: "Komentar + ukuran objek",
sidebarObjectInfoModeHidden: "Tidak ada",
sidebarAllowHorizontalScroll: "Izinkan gulir horizontal bilah sisi",
sidebarAllowHorizontalScrollDescription: "Tampilkan nama tabel, tampilan, dan koleksi yang panjang secara lengkap dengan mengizinkan gulir horizontal pada bilah sisi.",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 6152809b4b..4e7eff1f9e 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -7939,11 +7939,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "Mostra una casella di ricerca locale sotto database, schema o gruppi di tabelle espansi per filtrare le tabelle separatamente.",
sidebarObjectInfoMode: "Informazioni aggiuntive laterali",
sidebarObjectInfoModeDescription:
- "Scegli commenti, dimensioni degli oggetti o nessun testo dopo i nomi. Commenti e dimensioni sono alternativi. La dimensione totale dei database supporta PostgreSQL; le dimensioni delle tabelle supportano MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng e ClickHouse.",
+ "Scegli commenti, dimensioni degli oggetti, entrambi o nessuna informazione aggiuntiva. Quando sono visualizzati entrambi, il commento segue il nome e la dimensione appare all’estrema destra. Le informazioni senza dati disponibili vengono nascoste. La dimensione totale dei database supporta PostgreSQL; le dimensioni delle tabelle supportano MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng e ClickHouse.",
sidebarObjectInfoModeCommentInline: "Commenti (accanto al nome)",
sidebarObjectInfoModeCommentAligned: "Commenti (allinea livello)",
sidebarObjectInfoModeCommentRight: "Commenti (allinea a destra)",
sidebarObjectInfoModeSize: "Dimensione oggetto",
+ sidebarObjectInfoModeCommentAndSize: "Commenti + dimensione oggetto",
sidebarObjectInfoModeHidden: "Nessuna",
sidebarAllowHorizontalScroll: "Consenti scorrimento orizzontale barra laterale",
sidebarAllowHorizontalScrollDescription: "Mostra i nomi lunghi di tabelle, viste e collezioni per intero consentendo lo scorrimento orizzontale della barra laterale.",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 38dfaa67cc..1a220bd335 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -7951,11 +7951,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "展開済みのデータベース、schema、またはテーブルグループの下にローカル検索ボックスを表示し、スコープごとにテーブルを絞り込みます。",
sidebarObjectInfoMode: "サイドバーの補足情報",
sidebarObjectInfoModeDescription:
- "名前の後にコメント、オブジェクトサイズ、または何も表示しないかを選択します。コメントとサイズは同時に表示されません。データベース全体のサイズは PostgreSQL、テーブルサイズは MySQL、PostgreSQL、GaussDB、KingbaseES、GBase 8a、SQL Server、Oracle、Dameng、ClickHouse に対応しています。",
+ "コメント、オブジェクトサイズ、両方、または何も表示しないかを選択します。両方を表示する場合、コメントは名前の直後、サイズは右端に表示されます。対応するデータがない情報は非表示になります。データベース全体のサイズは PostgreSQL、テーブルサイズは MySQL、PostgreSQL、GaussDB、KingbaseES、GBase 8a、SQL Server、Oracle、Dameng、ClickHouse に対応しています。",
sidebarObjectInfoModeCommentInline: "コメント(名前の直後)",
sidebarObjectInfoModeCommentAligned: "コメント(同階層で整列)",
sidebarObjectInfoModeCommentRight: "コメント(右揃え)",
sidebarObjectInfoModeSize: "オブジェクトサイズ",
+ sidebarObjectInfoModeCommentAndSize: "コメント + オブジェクトサイズ",
sidebarObjectInfoModeHidden: "表示しない",
sidebarAllowHorizontalScroll: "サイドバーの横スクロールを許可",
sidebarAllowHorizontalScrollDescription: "サイドバーの横スクロールを許可して、長いテーブル、ビュー、コレクション名を完全に表示します。",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index b2a8777554..2c0122e1a3 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -7804,11 +7804,13 @@ export default withEnglishFallback({
sidebarTableSearchEnabled: "데이터베이스 내 테이블 검색 활성화",
sidebarTableSearchEnabledDescription: "확장된 데이터베이스, 스키마 또는 테이블 그룹 아래에 로컬 테이블 검색 상자를 표시하여 각 범위가 독립적으로 테이블을 필터링할 수 있게 합니다.",
sidebarObjectInfoMode: "사이드바 추가 정보",
- sidebarObjectInfoModeDescription: "이름 뒤에 주석, 객체 크기 또는 추가 텍스트 없음을 선택하세요. 주석과 크기는 상호 배타적입니다. 데이터베이스 합계는 현재 PostgreSQL을 지원하며, 테이블 크기는 MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng, ClickHouse를 지원합니다.",
+ sidebarObjectInfoModeDescription:
+ "주석, 객체 크기, 둘 다 표시하거나 추가 정보를 표시하지 않도록 선택하세요. 둘 다 표시하면 주석은 이름 뒤에, 크기는 맨 오른쪽에 표시됩니다. 해당 데이터가 없는 정보는 숨겨집니다. 데이터베이스 합계는 현재 PostgreSQL을 지원하며, 테이블 크기는 MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng, ClickHouse를 지원합니다.",
sidebarObjectInfoModeCommentInline: "주석 (이름 뒤)",
sidebarObjectInfoModeCommentAligned: "주석 (형제 정렬)",
sidebarObjectInfoModeCommentRight: "주석 (오른쪽 정렬)",
sidebarObjectInfoModeSize: "객체 크기",
+ sidebarObjectInfoModeCommentAndSize: "주석 + 객체 크기",
sidebarObjectInfoModeHidden: "없음",
sidebarAllowHorizontalScroll: "사이드바 가로 스크롤 허용",
sidebarAllowHorizontalScrollDescription: "사이드바 가로 스크롤을 허용하여 긴 테이블, 뷰, 컬렉션 이름을 전체로 표시합니다.",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 44e55ce687..c53769eacc 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -7938,11 +7938,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "Mostra uma busca local sob bancos, schemas ou grupos de tabelas expandidos para filtrar tabelas separadamente.",
sidebarObjectInfoMode: "Informações adicionais laterais",
sidebarObjectInfoModeDescription:
- "Escolha comentários, tamanhos de objetos ou nenhum texto após os nomes. Comentários e tamanhos são mutuamente exclusivos. O tamanho total dos bancos aceita PostgreSQL; os tamanhos das tabelas aceitam MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng e ClickHouse.",
+ "Escolha comentários, tamanhos de objetos, ambos ou nenhuma informação adicional. Ao exibir ambos, o comentário aparece após o nome e o tamanho na extremidade direita. Informações sem dados disponíveis são ocultadas. O tamanho total dos bancos aceita PostgreSQL; os tamanhos das tabelas aceitam MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng e ClickHouse.",
sidebarObjectInfoModeCommentInline: "Comentários (junto ao nome)",
sidebarObjectInfoModeCommentAligned: "Comentários (alinhar nível)",
sidebarObjectInfoModeCommentRight: "Comentários (alinhar à direita)",
sidebarObjectInfoModeSize: "Tamanho do objeto",
+ sidebarObjectInfoModeCommentAndSize: "Comentários + tamanho do objeto",
sidebarObjectInfoModeHidden: "Nenhuma",
sidebarAllowHorizontalScroll: "Permitir rolagem horizontal da barra lateral",
sidebarAllowHorizontalScrollDescription: "Mostrar nomes longos de tabelas, views e coleções por completo, permitindo a rolagem horizontal da barra lateral.",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index f63aef8f9a..c6fe069a49 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -9258,11 +9258,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "Показывать поле локального поиска таблиц под развёрнутыми базами данных, схемами или группами таблиц, чтобы в каждой области можно было фильтровать таблицы независимо.",
sidebarObjectInfoMode: "Дополнительная информация в боковой панели",
sidebarObjectInfoModeDescription:
- "Выберите комментарии, размеры объектов или отсутствие дополнительного текста после имён. Комментарии и размеры взаимоисключающи. Итоги по базе данных сейчас поддерживаются в PostgreSQL; размеры таблиц поддерживаются в MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng и ClickHouse.",
+ "Выберите комментарии, размеры объектов, оба варианта или отсутствие дополнительной информации. При отображении обоих вариантов комментарий следует за именем, а размер отображается у правого края. Информация без соответствующих данных скрывается. Итоги по базе данных сейчас поддерживаются в PostgreSQL; размеры таблиц поддерживаются в MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng и ClickHouse.",
sidebarObjectInfoModeCommentInline: "Комментарии (после имени)",
sidebarObjectInfoModeCommentAligned: "Комментарии (выравнивать соседей)",
sidebarObjectInfoModeCommentRight: "Комментарии (по правому краю)",
sidebarObjectInfoModeSize: "Размер объекта",
+ sidebarObjectInfoModeCommentAndSize: "Комментарии + размер объекта",
sidebarObjectInfoModeHidden: "Нет",
sidebarAllowHorizontalScroll: "Разрешить горизонтальную прокрутку боковой панели",
sidebarAllowHorizontalScrollDescription: "Показывать длинные имена таблиц, представлений и коллекций полностью, разрешив горизонтальную прокрутку боковой панели.",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index 205edbacbe..8918851991 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -9718,11 +9718,13 @@ export default withEnglishFallback({
sidebarSearchOpenedDatabasesOnly: "ค้นหาเฉพาะฐานข้อมูลที่เปิด",
sidebarSearchOpenedDatabasesOnlyDescription: "การค้นหา Sidebar จะโหลดเฉพาะฐานข้อมูลที่เปิดในการเชื่อมต่อปัจจุบัน (ทั้งหมดเมื่อยังไม่ได้เปิด) ปิดเพื่อค้นหาทุกฐานข้อมูลของการเชื่อมต่อ",
sidebarObjectInfoMode: "ข้อมูลเสริมของ Sidebar",
- sidebarObjectInfoModeDescription: "เลือกคอมเมนต์ ขนาดออบเจ็กต์ หรือไม่แสดงข้อความเสริมหลังชื่อ คอมเมนต์และขนาดใช้พร้อมกันไม่ได้ ขณะนี้ยอดฐานข้อมูลรองรับ PostgreSQL ส่วนขนาดตารางรองรับ MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng และ ClickHouse",
+ sidebarObjectInfoModeDescription:
+ "เลือกคอมเมนต์ ขนาดออบเจ็กต์ ทั้งสองอย่าง หรือไม่แสดงข้อมูลเสริม เมื่อแสดงทั้งสองอย่าง คอมเมนต์จะอยู่หลังชื่อและขนาดจะแสดงทางขวาสุด ข้อมูลที่ไม่มีจะถูกซ่อน ขณะนี้ยอดฐานข้อมูลรองรับ PostgreSQL ส่วนขนาดตารางรองรับ MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng และ ClickHouse",
sidebarObjectInfoModeCommentInline: "คอมเมนต์ (หลังชื่อ)",
sidebarObjectInfoModeCommentAligned: "คอมเมนต์ (จัดแนวตามรายการข้างเคียง)",
sidebarObjectInfoModeCommentRight: "คอมเมนต์ (จัดชิดขวา)",
sidebarObjectInfoModeSize: "ขนาดออบเจ็กต์",
+ sidebarObjectInfoModeCommentAndSize: "คอมเมนต์ + ขนาดออบเจ็กต์",
sidebarObjectInfoModeHidden: "ไม่มี",
sidebarAllowHorizontalScroll: "อนุญาตให้ Sidebar เลื่อนแนวนอน",
sidebarAllowHorizontalScrollDescription: "แสดงชื่อตาราง View และ Collection แบบเต็ม โดยอนุญาตให้ Sidebar เลื่อนแนวนอน",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index 26988f47a7..3d675b42f7 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -7637,11 +7637,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabledDescription: "Her kapsamın tabloları bağımsız filtreleyebilmesi için genişletilmiş veritabanları, şemalar veya tablo grupları altında yerel bir tablo arama kutusu göster.",
sidebarObjectInfoMode: "Kenar çubuğu ek bilgisi",
sidebarObjectInfoModeDescription:
- "Adların ardından açıklamaları, nesne boyutlarını ya da hiçbir ek metni göstermeyi seçin. Açıklamalar ve boyutlar birbirini dışlar. Veritabanı toplamları şu anda PostgreSQL'i destekler; tablo boyutları MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng ve ClickHouse'u destekler.",
+ "Açıklamaları, nesne boyutlarını, her ikisini göstermeyi veya ek bilgileri gizlemeyi seçin. Her ikisi seçildiğinde açıklama adın ardından, boyut ise en sağda gösterilir. Verisi bulunmayan bilgiler gizlenir. Veritabanı toplamları şu anda PostgreSQL'i destekler; tablo boyutları MySQL, PostgreSQL, GaussDB, KingbaseES, GBase 8a, SQL Server, Oracle, Dameng ve ClickHouse'u destekler.",
sidebarObjectInfoModeCommentInline: "Açıklamalar (addan sonra)",
sidebarObjectInfoModeCommentAligned: "Açıklamalar (kardeşlerle hizalı)",
sidebarObjectInfoModeCommentRight: "Açıklamalar (sağa hizalı)",
sidebarObjectInfoModeSize: "Nesne boyutu",
+ sidebarObjectInfoModeCommentAndSize: "Açıklamalar + nesne boyutu",
sidebarObjectInfoModeHidden: "Yok",
sidebarAllowHorizontalScroll: "Kenar çubuğunda yatay kaydırmaya izin ver",
sidebarAllowHorizontalScrollDescription: "Yatay kenar çubuğu kaydırmasına izin vererek uzun tablo, görünüm ve koleksiyon adlarını tam göster.",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index df57127df1..efa75dd6a4 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -9045,11 +9045,12 @@ export default withEnglishFallback({
sidebarSearchOpenedDatabasesOnly: "仅搜索已打开的数据库",
sidebarSearchOpenedDatabasesOnlyDescription: "侧边栏搜索只加载当前连接中已打开的数据库(若一个都没打开则搜索全部)。关闭后会搜索该连接的全部数据库。",
sidebarObjectInfoMode: "侧边栏附加信息",
- sidebarObjectInfoModeDescription: "选择在名称后显示注释、对象大小或不显示。注释与大小互斥;数据库总大小目前支持 PostgreSQL,表大小支持 MySQL、PostgreSQL、GaussDB、KingbaseES、GBase 8a、SQL Server、Oracle、达梦和 ClickHouse。",
+ sidebarObjectInfoModeDescription: "选择在名称后显示注释、对象大小、两者同时显示或不显示。组合模式下,注释跟随名称,大小显示在最右侧,缺少对应数据时自动隐藏。数据库总大小目前支持 PostgreSQL,表大小支持 MySQL、PostgreSQL、GaussDB、KingbaseES、GBase 8a、SQL Server、Oracle、达梦和 ClickHouse。",
sidebarObjectInfoModeCommentInline: "注释(紧跟名称)",
sidebarObjectInfoModeCommentAligned: "注释(同级对齐)",
sidebarObjectInfoModeCommentRight: "注释(右侧对齐)",
sidebarObjectInfoModeSize: "对象大小",
+ sidebarObjectInfoModeCommentAndSize: "注释 + 对象大小",
sidebarObjectInfoModeHidden: "不显示",
sidebarAllowHorizontalScroll: "允许侧边栏横向滚动",
sidebarAllowHorizontalScrollDescription: "完整显示较长的表、视图和集合名称;默认关闭以保留省略号截断。",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index a862b301d6..27e4136bb7 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -7282,11 +7282,12 @@ export default withEnglishFallback({
sidebarTableSearchEnabled: "啟用庫下資料表搜尋框",
sidebarTableSearchEnabledDescription: "在已展開的資料庫、schema 或資料表分組下顯示局部資料表搜尋框,用於為不同庫分別篩選資料表。",
sidebarObjectInfoMode: "側邊欄附加資訊",
- sidebarObjectInfoModeDescription: "選擇在名稱後顯示註解、物件大小或不顯示。註解與大小互斥;資料庫總大小目前支援 PostgreSQL,資料表大小支援 MySQL、PostgreSQL、GaussDB、KingbaseES、GBase 8a、SQL Server、Oracle、達夢和 ClickHouse。",
+ sidebarObjectInfoModeDescription: "選擇在名稱後顯示註解、物件大小、同時顯示兩者或不顯示。組合模式下,註解跟隨名稱,大小顯示在最右側,缺少對應資料時自動隱藏。資料庫總大小目前支援 PostgreSQL,資料表大小支援 MySQL、PostgreSQL、GaussDB、KingbaseES、GBase 8a、SQL Server、Oracle、達夢和 ClickHouse。",
sidebarObjectInfoModeCommentInline: "註解(緊接名稱)",
sidebarObjectInfoModeCommentAligned: "註解(同層對齊)",
sidebarObjectInfoModeCommentRight: "註解(靠右對齊)",
sidebarObjectInfoModeSize: "物件大小",
+ sidebarObjectInfoModeCommentAndSize: "註解 + 物件大小",
sidebarObjectInfoModeHidden: "不顯示",
sidebarAllowHorizontalScroll: "允許側邊欄水平捲動",
sidebarAllowHorizontalScrollDescription: "透過啟用側邊欄的水平捲動功能,完整顯示長表格、檢視和集合的名稱",
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.sidebarTableStorage.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.sidebarTableStorage.spec.ts
index c4bd07d9f5..6cb5ac4b07 100644
--- a/apps/desktop/src/stores/__tests__/connectionStore.sidebarTableStorage.spec.ts
+++ b/apps/desktop/src/stores/__tests__/connectionStore.sidebarTableStorage.spec.ts
@@ -27,7 +27,7 @@ describe("connectionStore sidebar table storage", () => {
setActivePinia(createPinia());
});
- it("reloads table sizes after refreshing an object list with a newly created table", async () => {
+ it.each(["size", "comment-and-size"] as const)("%s: reloads table sizes after refreshing an object list with a newly created table", async (mode) => {
const listTables = vi.fn().mockResolvedValue([
{ name: "EXISTING_TABLE", table_type: "BASE TABLE", comment: null },
{ name: "NEW_TABLE", table_type: "BASE TABLE", comment: null },
@@ -54,7 +54,7 @@ describe("connectionStore sidebar table storage", () => {
const store = useConnectionStore();
const settingsStore = useSettingsStore();
settingsStore.editorSettings.sidebarObjectDisplay = "simple";
- settingsStore.editorSettings.sidebarObjectInfoMode = "size";
+ settingsStore.editorSettings.sidebarObjectInfoMode = mode;
const connection = {
id: "oracle-1",
@@ -108,7 +108,7 @@ describe("connectionStore sidebar table storage", () => {
expect(newTable?.sizeBytes).toBe(16384);
});
- it("does not cache a table-size request that finishes after the connection is lost", async () => {
+ it.each(["size", "comment-and-size"] as const)("%s: does not cache a table-size request that finishes after the connection is lost", async (mode) => {
const staleStatistics = deferred<Array<{ name: string; schema: string; total_bytes: number }>>();
const listObjectStatistics = vi
.fn()
@@ -126,7 +126,7 @@ describe("connectionStore sidebar table storage", () => {
const { useConnectionStore } = await import("@/stores/connectionStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
const store = useConnectionStore();
- useSettingsStore().editorSettings.sidebarObjectInfoMode = "size";
+ useSettingsStore().editorSettings.sidebarObjectInfoMode = mode;
const connection = { id: "oracle-1", name: "Oracle", db_type: "oracle", host: "127.0.0.1", port: 1521, username: "APP", password: "", database: "ORCL" } as ConnectionConfig;
const tableNode = (): TreeNode => ({ id: "oracle-1:ORCL:APP:USERS", label: "USERS", type: "table", connectionId: connection.id, database: connection.database, schema: "APP" });
const setLiveTree = () => {
@@ -148,7 +148,7 @@ describe("connectionStore sidebar table storage", () => {
expect(store.treeNodes[0]?.children?.[0]?.sizeBytes).toBe(8192);
});
- it("does not cache a database-size request that finishes after the connection is lost", async () => {
+ it.each(["size", "comment-and-size"] as const)("%s: does not cache a database-size request that finishes after the connection is lost", async (mode) => {
const staleStorage = deferred<Array<{ name: string; size_bytes: number }>>();
const listDatabaseStorage = vi
.fn()
@@ -166,7 +166,7 @@ describe("connectionStore sidebar table storage", () => {
const { useConnectionStore } = await import("@/stores/connectionStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
const store = useConnectionStore();
- useSettingsStore().editorSettings.sidebarObjectInfoMode = "size";
+ useSettingsStore().editorSettings.sidebarObjectInfoMode = mode;
const connection = { id: "pg-1", name: "PostgreSQL", db_type: "postgres", host: "127.0.0.1", port: 5432, username: "postgres", password: "" } as ConnectionConfig;
const setLiveTree = () => {
store.connectedIds.add(connection.id);
diff --git a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
index 34891e5cbb..874c6cf7a0 100644
--- a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
+++ b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
@@ -328,6 +328,7 @@ describe("normalizeEditorSettings", () => {
expect(normalizeEditorSettings({ sidebarObjectInfoMode: "comment-inline" }).sidebarObjectInfoMode).toBe("comment-inline");
expect(normalizeEditorSettings({ sidebarObjectInfoMode: "comment-right" }).sidebarObjectInfoMode).toBe("comment-right");
expect(normalizeEditorSettings({ sidebarObjectInfoMode: "size" }).sidebarObjectInfoMode).toBe("size");
+ expect(normalizeEditorSettings({ sidebarObjectInfoMode: "comment-and-size" }).sidebarObjectInfoMode).toBe("comment-and-size");
expect(normalizeEditorSettings({ sidebarTableCommentLayout: "aligned" } as any).sidebarObjectInfoMode).toBe("comment-aligned");
expect(normalizeEditorSettings({ sidebarTableCommentLayout: "hidden" } as any).sidebarObjectInfoMode).toBe("hidden");
expect(normalizeEditorSettings({ sidebarHideTableComments: false } as any).sidebarObjectInfoMode).toBe("comment-inline");
diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts
index 0c0f8d531f..16aede5975 100644
--- a/apps/desktop/src/stores/connectionStore.ts
+++ b/apps/desktop/src/stores/connectionStore.ts
@@ -5324,7 +5324,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
async function loadSidebarDatabaseStorage(connectionId: string, options?: { force?: boolean }): Promise<void> {
- if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size" || !connectedIds.value.has(connectionId)) return;
+ if ((settingsStore.editorSettings.sidebarObjectInfoMode !== "size" && settingsStore.editorSettings.sidebarObjectInfoMode !== "comment-and-size") || !connectedIds.value.has(connectionId)) return;
if (!supportsSidebarDatabaseStorage(getConfig(connectionId))) return;
const connectionNode = findConnectionNode(connectionId);
const databases = sidebarDatabaseNames(connectionNode?.children);
@@ -5366,7 +5366,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
async function loadSidebarTableStorage(scope: SidebarTableStorageScope, options?: { force?: boolean }): Promise<void> {
- if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size" || !connectedIds.value.has(scope.connectionId)) return;
+ if ((settingsStore.editorSettings.sidebarObjectInfoMode !== "size" && settingsStore.editorSettings.sidebarObjectInfoMode !== "comment-and-size") || !connectedIds.value.has(scope.connectionId)) return;
if (!supportsSidebarTableStorage(getConfig(scope.connectionId))) return;
const requestKey = sidebarTableStorageRequestKey(scope);
const cacheScope = sidebarTableStorageCacheScope(scope);
@@ -5396,7 +5396,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
const sidebarDatabaseStorageScope = computed(() => {
- if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size") return "";
+ if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size" && settingsStore.editorSettings.sidebarObjectInfoMode !== "comment-and-size") return "";
return [...connectedIds.value]
.filter((connectionId) => supportsSidebarDatabaseStorage(getConfig(connectionId)))
.map((connectionId) => sidebarDatabaseStorageRequestKey(connectionId, sidebarDatabaseNames(findConnectionNode(connectionId)?.children)))
@@ -5407,7 +5407,7 @@ export const useConnectionStore = defineStore("connection", () => {
watch(
sidebarDatabaseStorageScope,
() => {
- if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size") return;
+ if (settingsStore.editorSettings.sidebarObjectInfoMode !== "size" && settingsStore.editorSettings.sidebarObjectInfoMode !== "comment-and-size") return;
for (const connectionId of connectedIds.value) {
void loadSidebarDatabaseStorage(connectionId);
}
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index e5b0c8a878..6d9587edbb 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -927,7 +927,7 @@ export const DEFAULT_CUSTOM_THEMES: CustomTheme[] = [
},
];
-export type SidebarObjectInfoMode = "comment-inline" | "comment-aligned" | "comment-right" | "size" | "hidden";
+export type SidebarObjectInfoMode = "comment-inline" | "comment-aligned" | "comment-right" | "size" | "comment-and-size" | "hidden";
/**
* 删除连接时记住的「连接名 → 数据库」。带上 `dbType` 是为了只在新建同名**同类型**
@@ -1765,7 +1765,7 @@ function normalizeConnectionListSortMode(value: unknown): ConnectionListSortMode
}
function normalizeSidebarObjectInfoMode(value: unknown, legacyCommentLayout?: unknown, legacyHideTableComments?: unknown, legacyShowDatabaseSizes?: unknown): SidebarObjectInfoMode {
- if (value === "comment-inline" || value === "comment-aligned" || value === "comment-right" || value === "size" || value === "hidden") return value;
+ if (value === "comment-inline" || value === "comment-aligned" || value === "comment-right" || value === "size" || value === "comment-and-size" || value === "hidden") return value;
if (legacyCommentLayout === "hidden" || legacyHideTableComments === true) return "hidden";
if (legacyShowDatabaseSizes === true) return "size";
if (legacyCommentLayout === "aligned") return "comment-aligned";