From c328b3bf492b44cfe0794c24929319f1c33cb17e Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Mon, 4 May 2026 00:46:44 +0800 Subject: [PATCH] feat: add tooltip functionality and translations for tab information --- src/App.vue | 34 ++++++++++++++++++++++++++++++---- src/i18n/locales/en.ts | 4 ++++ src/i18n/locales/zh-CN.ts | 4 ++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index c4ae600cf5..0c116b066f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -465,7 +465,7 @@ function tabDisplayTitle(tab: typeof queryStore.tabs[number]): string { if (isPreviewTab(tab)) return tab.title; const database = databaseDisplayNameForTab(tab.connectionId, tab.database); if (tab.mode === "data" && tab.tableMeta?.tableName) { - return `${database} | ${tab.tableMeta.tableName}`; + return tab.tableMeta.tableName; } if (tab.mode === "query") { return `${connectionDisplayName(tab.connectionId)} | ${database}`; @@ -479,6 +479,22 @@ function tabDisplayTitle(tab: typeof queryStore.tabs[number]): string { return tab.title; } +function tabTooltipLines(tab: typeof queryStore.tabs[number]): { label: string; value: string }[] { + const connName = connectionDisplayName(tab.connectionId); + const database = databaseDisplayNameForTab(tab.connectionId, tab.database); + const lines: { label: string; value: string }[] = [ + { label: t("tabs.tooltipConnection"), value: connName }, + { label: t("tabs.tooltipDatabase"), value: database }, + ]; + if (tab.mode === "data" && tab.tableMeta?.tableName) { + lines.push({ label: t("tabs.tooltipTable"), value: tab.tableMeta.tableName }); + } + if (tab.mode === "mongo" && tab.sql) { + lines.push({ label: t("tabs.tooltipCollection"), value: tab.sql }); + } + return lines; +} + function tabModeLabel(tab: typeof queryStore.tabs[number]): string { if (tab.mode === "data") return t("tabs.table"); if (tab.mode === "query") return t("tabs.sql"); @@ -1091,8 +1107,10 @@ async function setupFileDrop() { :key="tab.id" > + +
@@ -1112,8 +1130,8 @@ async function setupFileDrop() {
+
+ + + +
diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 92da4f70ac..442ff0c298 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -90,6 +90,10 @@ export default { tableData: "Table Data", redis: "Redis", mongo: "Mongo", + tooltipConnection: "Connection:", + tooltipDatabase: "Database:", + tooltipTable: "Table:", + tooltipCollection: "Collection:", }, grid: { rows: "{count} rows", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 81a5a20dd0..4a405c8164 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -92,6 +92,10 @@ export default { tableData: "数据表", redis: "Redis", mongo: "Mongo", + tooltipConnection: "连接:", + tooltipDatabase: "数据库:", + tooltipTable: "表:", + tooltipCollection: "集合:", }, grid: { rows: "{count} 行",