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(grid): let the large-table preview notice be dismissed for good (#12928)

弈秋831066139010
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index 754e69f5bc..c73d78297a 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -479,8 +479,20 @@ const largeValueResolutionVersion = ref(0);
const tableDataFullTextMode = ref(false);
const tableDataFullTextLoading = ref(false);
const tableDataPreviewNoticeDismissed = ref(false);
+// Dismissing the banner only silences it for the current result, so every new
+// table or page brought it back. The "don't show again" action persists here
+// and leaves a compact icon that still loads the full text on demand (#12906).
+const TABLE_DATA_PREVIEW_NOTICE_HIDDEN_KEY = "dbx-table-data-preview-notice-hidden";
+function readTableDataPreviewNoticeHidden(): boolean {
+ try {
+ return localStorage.getItem(TABLE_DATA_PREVIEW_NOTICE_HIDDEN_KEY) === "1";
+ } catch {
+ return false;
+ }
+}
+const tableDataPreviewNoticeHidden = ref(readTableDataPreviewNoticeHidden());
const tableDataPreviewTruncated = computed(() => !!props.tableMeta && (props.result.large_value_cells?.length ?? 0) > 0);
-const showTableDataPreviewNotice = computed(() => tableDataPreviewTruncated.value && !tableDataFullTextMode.value && !tableDataPreviewNoticeDismissed.value);
+const showTableDataPreviewNotice = computed(() => tableDataPreviewTruncated.value && !tableDataFullTextMode.value && !tableDataPreviewNoticeHidden.value && !tableDataPreviewNoticeDismissed.value);
const tableDataFullTextEnabled = computed(() => !!props.tableMeta && tableDataFullTextMode.value);
const multiRowTranspose = computed(() => settingsStore.editorSettings.dataGridMultiRowTranspose);
const hideNullColumns = computed(() => settingsStore.editorSettings.dataGridHideNullColumns);
@@ -5971,6 +5983,19 @@ function dismissTableDataPreviewNotice() {
tableDataPreviewNoticeDismissed.value = true;
}
+/// Persistently silences the banner across tables and pages. The toolbar action
+/// row keeps "load the full text for this page" reachable without leaving an
+/// empty banner line behind.
+function hideTableDataPreviewNoticeForGood() {
+ tableDataPreviewNoticeHidden.value = true;
+ try {
+ localStorage.setItem(TABLE_DATA_PREVIEW_NOTICE_HIDDEN_KEY, "1");
+ } catch {
+ // Storage can be unavailable (private mode, quota); the banner then simply
+ // comes back on the next start instead of failing the click.
+ }
+}
+
const exportContextCell = computed(() => {
if (!contextCell.value) return null;
const visibleCol = visibleColumnIndexes.value.indexOf(contextCell.value.col);
@@ -14679,6 +14704,21 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
@wheel="onDataGridTopbarFixedActionWheel"
>
<template #leading>
+ <!-- Once the banner is silenced for good, the full-text entry moves
+ into the existing action row rather than keeping an empty
+ banner line of its own. -->
+ <Tooltip v-if="tableDataPreviewTruncated && tableDataPreviewNoticeHidden && !tableDataFullTextMode">
+ <TooltipTrigger as-child>
+ <Button variant="ghost" size="sm" :disabled="tableDataFullTextLoading" class="data-grid-topbar-action-button h-5 shrink-0 text-xs px-1.5" @click="loadCurrentPageFullText">
+ <Info class="data-grid-topbar-action-icon w-3 h-3 text-amber-600 dark:text-amber-400" />
+ <span class="data-grid-topbar-action-label" :class="{ 'data-grid-topbar-action-label--compact': compactDataGridToolbarActions }">{{ t("grid.tableDataPreviewLoadPageShort") }}</span>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom" class="max-w-sm">
+ <p>{{ t("grid.tableDataPreviewNotice") }}</p>
+ <p class="mt-1 opacity-80">{{ t("grid.tableDataPreviewLoadPageHint") }}</p>
+ </TooltipContent>
+ </Tooltip>
<slot v-if="hasResultToolbarActionsSlot" name="result-toolbar-actions" :compact="compactDataGridToolbarActions" />
<DataGridVirtualRowIdentifier
v-if="showVirtualRowIdentifierControl"
@@ -14839,13 +14879,18 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
@copy-sql="copySortSqlPreview"
@apply="applyStructuredSortRules"
/>
- <!-- Large table preview notice: explicit opt-in instead of guessing from column width (#12289). -->
+ <!-- Large table preview notice: explicit opt-in instead of guessing from column width (#12289).
+ Once "don't show again" is used the banner disappears and the full-text entry moves into the
+ toolbar action row, so no extra line is kept just for an icon (#12906). -->
<div v-if="showTableDataPreviewNotice" data-grid-preview-notice class="shrink-0 px-3 py-1.5 bg-amber-500/10 border-b border-amber-500/20 text-xs text-amber-700 dark:text-amber-300 flex flex-wrap items-center gap-x-2 gap-y-1">
<Info class="h-3.5 w-3.5 shrink-0" />
<span>{{ t("grid.tableDataPreviewNotice") }}</span>
<button type="button" class="font-medium underline underline-offset-2 decoration-dotted hover:text-amber-900 disabled:opacity-50 dark:hover:text-amber-100" :disabled="tableDataFullTextLoading" @click="loadCurrentPageFullText">
{{ tableDataFullTextLoading ? t("grid.tableDataPreviewLoading") : t("grid.tableDataPreviewLoadPage") }}
</button>
+ <button type="button" class="font-medium underline underline-offset-2 decoration-dotted hover:text-amber-900 dark:hover:text-amber-100" @click="hideTableDataPreviewNoticeForGood">
+ {{ t("grid.tableDataPreviewDontShowAgain") }}
+ </button>
<button
type="button"
class="ml-auto shrink-0 rounded p-0.5 text-amber-600/70 hover:bg-amber-500/10 hover:text-amber-800 dark:text-amber-400/70 dark:hover:text-amber-200"
diff --git a/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts
index d106985398..5acd70e3bf 100644
--- a/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts
+++ b/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts
@@ -2699,3 +2699,68 @@ describe("EnumCellEditor boolean labels", () => {
expect(commit).toHaveBeenCalledWith("true");
});
});
+
+describe("DataGrid large-table preview notice", () => {
+ const HIDDEN_KEY = "dbx-table-data-preview-notice-hidden";
+
+ function mountGrid() {
+ setActivePinia(createPinia());
+ const host = document.createElement("div");
+ document.body.appendChild(host);
+ const result = {
+ columns: ["id", "content"],
+ column_types: ["int4", "text"],
+ rows: [[1, "preview"]],
+ affected_rows: 0,
+ execution_time_ms: 1,
+ large_value_cells: [{ row_index: 0, column_index: 1, original_bytes: 5000 }],
+ };
+ const tableMeta = { schema: "app", tableName: "t", columns: [], primaryKeys: [] };
+ const app = createApp(defineComponent({ setup: () => () => h(DataGrid, { result, tableMeta, context: "table-data" }) }));
+ app.mount(host);
+ return {
+ host,
+ notice: () => host.querySelector("[data-grid-preview-notice]"),
+ destroy() {
+ app.unmount();
+ host.remove();
+ },
+ };
+ }
+
+ beforeEach(() => {
+ localStorage.removeItem(HIDDEN_KEY);
+ });
+
+ function fullTextEntry(host: HTMLElement) {
+ return [...host.querySelectorAll("button")].find((button) => button.textContent?.trim() === "grid.tableDataPreviewLoadPageShort");
+ }
+
+ // #12906: the banner only stayed away for the current result, so every new
+ // table brought it back. "Don't show again" has to persist across tables and
+ // keep the full text one click away.
+ it("persists the don't-show-again choice without leaving an empty banner row", async () => {
+ const grid = mountGrid();
+ await nextTick();
+ expect(grid.notice()?.textContent).toContain("grid.tableDataPreviewNotice");
+ expect(fullTextEntry(grid.host)).toBeUndefined();
+
+ const dontShowAgain = [...grid.host.querySelectorAll("button")].find((button) => button.textContent?.trim() === "grid.tableDataPreviewDontShowAgain");
+ expect(dontShowAgain).toBeTruthy();
+ dontShowAgain!.click();
+ await nextTick();
+
+ expect(localStorage.getItem(HIDDEN_KEY)).toBe("1");
+ // The banner row is gone entirely; the full-text action moved into the
+ // existing toolbar action row so no empty strip is left behind.
+ expect(grid.notice()).toBeNull();
+ expect(fullTextEntry(grid.host)).toBeTruthy();
+ grid.destroy();
+
+ const reopened = mountGrid();
+ await nextTick();
+ expect(reopened.notice()).toBeNull();
+ expect(fullTextEntry(reopened.host)).toBeTruthy();
+ reopened.destroy();
+ });
+});
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index f5eebe01b4..f172c00e6f 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -3349,6 +3349,9 @@ export default {
tableDataPreviewLoadPage: "Load full text for this page",
tableDataPreviewLoading: "Loading full text for this page…",
tableDataPreviewDismiss: "Don't show again",
+ tableDataPreviewDontShowAgain: "Never show again",
+ tableDataPreviewLoadPageShort: "Full text",
+ tableDataPreviewLoadPageHint: "Click to load the full text for this page",
tableDataPreviewLoaded: "Loaded full text for {count} cells on this page",
tableDataPreviewLoadFailed: "Failed to load full text: {message}",
largeValueRowUnavailable: "The row could not be located in the database. The operation was canceled without using the preview value.",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index c5c08dd874..2780cc731a 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -3307,6 +3307,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "Cargar el texto completo de la página actual",
tableDataPreviewLoading: "Cargando el texto completo de la página actual…",
tableDataPreviewDismiss: "No volver a mostrar",
+ tableDataPreviewDontShowAgain: "No mostrar nunca",
+ tableDataPreviewLoadPageShort: "Texto completo",
+ tableDataPreviewLoadPageHint: "Haz clic para cargar el texto completo de esta página",
tableDataPreviewLoaded: "Se cargaron {count} celdas con texto completo de la página actual",
tableDataPreviewLoadFailed: "Error al cargar el texto completo: {message}",
searchValuesOrCountTooltip: "Buscar valores o filtrar por cantidad (p. ej., >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 471290f586..957f805cd9 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -3180,6 +3180,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "Carica il testo completo della pagina corrente",
tableDataPreviewLoading: "Caricamento del testo completo della pagina corrente…",
tableDataPreviewDismiss: "Non mostrare più",
+ tableDataPreviewDontShowAgain: "Non mostrare mai più",
+ tableDataPreviewLoadPageShort: "Testo completo",
+ tableDataPreviewLoadPageHint: "Fai clic per caricare il testo completo di questa pagina",
tableDataPreviewLoaded: "Caricate {count} celle con testo completo nella pagina corrente",
tableDataPreviewLoadFailed: "Impossibile caricare il testo completo: {message}",
searchValuesOrCountTooltip: "Cerca valori o filtra per conteggio (ad es. >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 4767a3ba0a..3fbd31e486 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -3204,6 +3204,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "現在のページの完全なテキストを読み込む",
tableDataPreviewLoading: "現在のページの完全なテキストを読み込み中…",
tableDataPreviewDismiss: "今後表示しない",
+ tableDataPreviewDontShowAgain: "次回から表示しない",
+ tableDataPreviewLoadPageShort: "全文",
+ tableDataPreviewLoadPageHint: "クリックでこのページの全文を読み込む",
tableDataPreviewLoaded: "現在のページの完全なテキストセルを {count} 個読み込みました",
tableDataPreviewLoadFailed: "完全なテキストの読み込みに失敗しました:{message}",
searchValuesOrCountTooltip: "値の検索または件数による絞り込み(例: >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 07100b4053..1d261917f6 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -3129,6 +3129,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "현재 페이지의 전체 텍스트 불러오기",
tableDataPreviewLoading: "현재 페이지의 전체 텍스트를 불러오는 중…",
tableDataPreviewDismiss: "다시 표시하지 않음",
+ tableDataPreviewDontShowAgain: "다시는 표시 안 함",
+ tableDataPreviewLoadPageShort: "전체 텍스트",
+ tableDataPreviewLoadPageHint: "클릭하여 이 페이지의 전체 텍스트 불러오기",
tableDataPreviewLoaded: "현재 페이지의 전체 텍스트 셀 {count}개를 불러왔습니다",
tableDataPreviewLoadFailed: "전체 텍스트를 불러오지 못했습니다: {message}",
searchValuesOrCountTooltip: "값 검색 또는 개수로 필터링(예: >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 46e25b7cbf..3653fa763c 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -3180,6 +3180,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "Carregar o texto completo da página atual",
tableDataPreviewLoading: "Carregando o texto completo da página atual…",
tableDataPreviewDismiss: "Não mostrar novamente",
+ tableDataPreviewDontShowAgain: "Nunca mais mostrar",
+ tableDataPreviewLoadPageShort: "Texto completo",
+ tableDataPreviewLoadPageHint: "Clique para carregar o texto completo desta página",
tableDataPreviewLoaded: "Carregadas {count} células de texto completo na página atual",
tableDataPreviewLoadFailed: "Falha ao carregar o texto completo: {message}",
searchValuesOrCountTooltip: "Pesquisar valores ou filtrar por quantidade (ex.: >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index d21837c405..feec70b85f 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -3264,6 +3264,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "Загрузить полный текст текущей страницы",
tableDataPreviewLoading: "Загрузка полного текста текущей страницы…",
tableDataPreviewDismiss: "Больше не показывать",
+ tableDataPreviewDontShowAgain: "Больше не показывать",
+ tableDataPreviewLoadPageShort: "Полный текст",
+ tableDataPreviewLoadPageHint: "Нажмите, чтобы загрузить полный текст этой страницы",
tableDataPreviewLoaded: "Загружено {count} ячеек с полным текстом на текущей странице",
tableDataPreviewLoadFailed: "Не удалось загрузить полный текст: {message}",
searchValuesOrCountTooltip: "Поиск значений или фильтрация по количеству (например, >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index d9e0f06ec0..a82d74a210 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -3487,6 +3487,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "โหลดข้อความฉบับเต็มของหน้าปัจจุบัน",
tableDataPreviewLoading: "กำลังโหลดข้อความฉบับเต็มของหน้าปัจจุบัน…",
tableDataPreviewDismiss: "ไม่แสดงอีก",
+ tableDataPreviewDontShowAgain: "ไม่ต้องแสดงอีกเลย",
+ tableDataPreviewLoadPageShort: "ข้อความเต็ม",
+ tableDataPreviewLoadPageHint: "คลิกเพื่อโหลดข้อความเต็มของหน้านี้",
tableDataPreviewLoaded: "โหลดเซลล์ข้อความฉบับเต็มในหน้าปัจจุบันแล้ว {count} เซลล์",
tableDataPreviewLoadFailed: "โหลดข้อความฉบับเต็มไม่สำเร็จ: {message}",
searchValuesOrCountTooltip: "ค้นหาค่าหรือกรองตามจำนวน (เช่น >1, >=2, =1, count>1)",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index e2cad0f468..239cfec3a6 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -3281,6 +3281,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "加载当前页完整文本",
tableDataPreviewLoading: "正在加载当前页完整文本…",
tableDataPreviewDismiss: "不再提示",
+ tableDataPreviewDontShowAgain: "不再提示",
+ tableDataPreviewLoadPageShort: "完整文本",
+ tableDataPreviewLoadPageHint: "点击加载当前页完整文本",
tableDataPreviewLoaded: "已加载当前页 {count} 个完整文本单元格",
tableDataPreviewLoadFailed: "加载完整文本失败:{message}",
largeValueRowUnavailable: "无法在数据库中定位该行,操作已取消,未使用预览值。",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 3809678ac4..d00c77ed02 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -3190,6 +3190,9 @@ export default withEnglishFallback({
tableDataPreviewLoadPage: "載入目前頁面的完整文字",
tableDataPreviewLoading: "正在載入目前頁面的完整文字…",
tableDataPreviewDismiss: "不再提示",
+ tableDataPreviewDontShowAgain: "不再提示",
+ tableDataPreviewLoadPageShort: "完整文字",
+ tableDataPreviewLoadPageHint: "點擊載入目前頁面的完整文字",
tableDataPreviewLoaded: "已載入目前頁面 {count} 個完整文字儲存格",
tableDataPreviewLoadFailed: "載入完整文字失敗:{message}",
},