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。

fix(settings): allow column comments in header and info area

t8y25b13f5f530ad
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index dab920594a..fa18f2b8ce 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -10032,7 +10032,7 @@ onUnmounted(() => {
{{ t("settings.showColumnCommentsInHeaderDescription") }}
</p>
</div>
- <Switch id="show-column-comments-in-header" v-model="editShowColumnCommentsInHeader" :disabled="editDataGridColumnCommentsInInfoArea" />
+ <Switch id="show-column-comments-in-header" v-model="editShowColumnCommentsInHeader" />
</div>
<div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
<div class="min-w-0 space-y-1">
diff --git a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.externalClose.integration.spec.ts b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.externalClose.integration.spec.ts
index 524f6df39c..343e97703f 100644
--- a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.externalClose.integration.spec.ts
+++ b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.externalClose.integration.spec.ts
@@ -123,6 +123,32 @@ describe("settings page external close request", () => {
expect(host.querySelector<HTMLButtonElement>("#column-comments-in-info-area")!.getAttribute("aria-checked")).toBe("false");
});
+ it("keeps the header and info-area comment switches independent (#13171)", async () => {
+ const { page, open, store } = await mountPage("data");
+ const headerSwitch = () => host.querySelector<HTMLButtonElement>("#show-column-comments-in-header")!;
+ const infoSwitch = () => host.querySelector<HTMLButtonElement>("#column-comments-in-info-area")!;
+ expect(headerSwitch().getAttribute("aria-checked")).toBe("true");
+ expect(infoSwitch().getAttribute("aria-checked")).toBe("false");
+
+ infoSwitch().click();
+ await settle();
+ // The header switch stays enabled and keeps its own value.
+ expect(headerSwitch().disabled).toBe(false);
+ expect(headerSwitch().getAttribute("aria-checked")).toBe("true");
+ expect(infoSwitch().getAttribute("aria-checked")).toBe("true");
+
+ clickText("settings.apply");
+ await settle();
+ expect(store.editorSettings).toMatchObject({ showColumnCommentsInHeader: true, dataGridColumnCommentsInInfoArea: true });
+
+ page.value!.requestClose();
+ await settle();
+ open.value = true;
+ await settle();
+ expect(headerSwitch().getAttribute("aria-checked")).toBe("true");
+ expect(infoSwitch().getAttribute("aria-checked")).toBe("true");
+ });
+
it("keeps a dirty draft when continuing, and closes without saving only after discarding", async () => {
const { page, open, store, changeFontSize } = await mountPage();
const originalFontSize = store.editorSettings.fontSize;
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index d3b0684359..4a695b23ec 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -909,7 +909,9 @@ const dataGridTopbarOverflowActionCount = ref(0);
const dataGridTopbarExpandedRequiredWidth = ref(0);
const dataGridFilterExpandedRequiredWidth = ref(0);
const columnCommentsInInfoArea = computed(() => settingsStore.editorSettings.dataGridColumnCommentsInInfoArea);
-const showColumnCommentsInHeader = computed(() => settingsStore.editorSettings.showColumnCommentsInHeader && !columnCommentsInInfoArea.value);
+// #13171: header comments and the selected column's info-area comment are
+// independent surfaces; enabling the info area no longer hides the header line.
+const showColumnCommentsInHeader = computed(() => settingsStore.editorSettings.showColumnCommentsInHeader);
const showColumnTypesInHeader = computed(() => settingsStore.editorSettings.showColumnTypesInHeader);
const showColumnHeaderTooltips = computed(() => settingsStore.editorSettings.showColumnHeaderTooltips !== false);
const transposeMetadataInInfoColumn = computed(() => settingsStore.editorSettings.dataGridTransposeMetadataInInfoColumn);
diff --git a/apps/desktop/src/components/grid/__tests__/DataGridTransposeSort.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridTransposeSort.spec.ts
index 4226a22c24..1802d6d35a 100644
--- a/apps/desktop/src/components/grid/__tests__/DataGridTransposeSort.spec.ts
+++ b/apps/desktop/src/components/grid/__tests__/DataGridTransposeSort.spec.ts
@@ -164,7 +164,8 @@ describe("DataGrid transpose sorting", () => {
const { host, settingsStore } = mountGrid("results");
settingsStore.updateEditorSettings({ dataGridColumnCommentsInInfoArea: true, dataGridShowTransposeFieldMetadata: true });
await settle();
- expect(host.querySelectorAll("[data-grid-header-comment-line]")).toHaveLength(0);
+ // #13171: the info-area comment is additive; the header line stays visible.
+ expect(host.querySelectorAll("[data-grid-header-comment-line]")).toHaveLength(2);
await openTranspose(host);
expect(host.querySelectorAll("[data-grid-transpose-column-info]")).toHaveLength(0);
expect(host.querySelectorAll("[data-grid-transpose-comment-line]")).toHaveLength(2);
@@ -194,13 +195,14 @@ describe("DataGrid transpose sorting", () => {
expect(host.querySelector("[data-grid-column-info]")?.textContent).not.toContain("undefined");
});
- it("shows selected column metadata in the status area and restores header comments when disabled", async () => {
+ it("shows selected column metadata in the status area while keeping header comments", async () => {
const { host, settingsStore } = mountGrid();
await settle();
expect(host.querySelectorAll("[data-grid-header-comment-line]")).toHaveLength(2);
settingsStore.updateEditorSettings({ dataGridColumnCommentsInInfoArea: true });
await settle();
- expect(host.querySelector("[data-grid-header-comment-line]")).toBeNull();
+ // #13171: both surfaces show at once.
+ expect(host.querySelectorAll("[data-grid-header-comment-line]")).toHaveLength(2);
host.querySelector<HTMLElement>('[data-grid-column-index="0"]')!.click();
await settle();
expect(host.querySelector("[data-grid-column-info]")?.textContent).toContain("Display name with a long comment");
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index a0f25441dd..351b9c4359 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -9748,7 +9748,7 @@ export default {
sqlFileUploadMaxMbSaved: "Web SQL file upload size saved.",
showColumnCommentsInHeader: "Show column comments under names",
dataGridColumnCommentsInInfoArea: "Show column comments in the information area",
- dataGridColumnCommentsInInfoAreaDescription: "Show the selected column's comment in the bottom status bar instead of the grid header.",
+ dataGridColumnCommentsInInfoAreaDescription: "Additionally show the selected column's comment in the bottom status bar.",
showColumnCommentsInHeaderDescription: "Display table column comments directly below grid column names.",
showColumnTypesInHeader: "Show column types under names",
showColumnTypesInHeaderDescription: "Display each column's data type directly below grid column names.",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index f299c8cb42..995126c3af 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -9715,7 +9715,7 @@ export default withEnglishFallback({
sqlFileUploadMaxMbSaved: "Web SQL 文件上传大小已保存。",
showColumnCommentsInHeader: "在字段名下方显示注释",
dataGridColumnCommentsInInfoArea: "在信息区显示字段注释",
- dataGridColumnCommentsInInfoAreaDescription: "将选中字段的注释移至底部状态栏,不再显示在表头中。",
+ dataGridColumnCommentsInInfoAreaDescription: "同时将选中字段的注释显示在底部状态栏。",
showColumnCommentsInHeaderDescription: "把表字段注释直接显示在结果表头字段名下方。",
showColumnTypesInHeader: "在字段名下方显示数据类型",
showColumnTypesInHeaderDescription: "把每个字段的数据类型直接显示在结果表头字段名下方。",