From 2b2d789c2cdcff70d3fea9bea2d84115ae77038d Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sun, 7 Jun 2026 10:02:34 +0800 Subject: [PATCH] fix: add keyboard shortcut hint on data-unavailable page and make Mod+R work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When app restarts, table data shows "data unavailable" but Mod+R didn't work because the DataGrid component wasn't mounted. Fixed by handling the reload emit directly in handleModRTarget. Also added kbd-styled shortcut hint (⌘R / Ctrl+R) on the data-unavailable placeholder. --- .../src/components/layout/ContentArea.vue | 21 +++++++++++++++++++ apps/desktop/src/i18n/locales/en.ts | 2 ++ apps/desktop/src/i18n/locales/zh-CN.ts | 2 ++ 3 files changed, 25 insertions(+) diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue index c0ac8fe656..439fa76195 100644 --- a/apps/desktop/src/components/layout/ContentArea.vue +++ b/apps/desktop/src/components/layout/ContentArea.vue @@ -54,6 +54,7 @@ import { canCancelQueryExecution, queryExecutionLabelKey } from "@/lib/queryExec import { databaseDisplayNameForTab } from "@/lib/tabPresentation"; import { isTableDataEditable } from "@/lib/tableEditing"; import { tableMetaForDataTab } from "@/lib/tableDataTabMeta"; +import { formatShortcut } from "@/lib/shortcutRegistry"; import { effectiveDatabaseTypeForConnection } from "@/lib/jdbcDialect"; import type { QueryTab, ConnectionConfig } from "@/types/database"; import type { SqlFormatDialect } from "@/lib/sqlFormatter"; @@ -177,6 +178,12 @@ const editorDialect = computed<"mysql" | "postgres" | "sqlserver">(() => { const shortcutModifier = computed(() => (navigator.platform.toLowerCase().includes("mac") ? "Cmd" : "Ctrl")); +const modRKeys = computed(() => + formatShortcut("Mod+R") + .split("+") + .map((key) => (key === "Cmd" ? "⌘" : key)), +); + const hasNumericData = computed(() => { const r = props.activeTab.result; if (!r || r.rows.length === 0) return false; @@ -352,6 +359,10 @@ function handleModRTarget(target: Element): boolean { if (target.closest("[data-query-editor-root]")) return queryEditorRef.value?.openReplace() ?? false; if (target.closest("[data-cell-detail-editor-root]")) return dataGridRef.value?.openCellDetailSearch() ?? false; if (target.closest("[data-grid-root]")) return refreshData(); + if (props.activeTab.mode === "data" && !props.activeTab.result && !props.activeTab.isExecuting) { + emit("reload"); + return true; + } return false; } @@ -860,6 +871,16 @@ defineExpose({ focusSearch, refreshData, handleModRTarget });
{{ t("grid.dataUnavailable") }}
+
+ {{ t("grid.dataUnavailableHintPrefix") }} + {{ key }} + {{ t("grid.dataUnavailableHintSuffix") }} +