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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(tabs): hide database tooltip for unsupported plugin tabs
OOMEcho9e17d465a0cc
diff --git a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.tsindex 668c64be29..cfc0eccffc 100644--- a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts+++ b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts@@ -42,7 +42,9 @@ vi.mock("@/components/icons/DatabaseIcon.vue", () => ({}));import EditorGroupTabBar from "../EditorGroupTabBar.vue";+import { useConnectionStore } from "@/stores/connectionStore";import { useQueryStore } from "@/stores/queryStore";+import type { ConnectionConfig } from "@/types/database";function createHost(): HTMLDivElement {const host = document.createElement("div");@@ -84,6 +86,12 @@ function mountBar(en: {toolbar: { pluginCenter: "Plugin Center" },common: { close: "Close" },+ connectionGroup: { ungroupedLabel: "Ungrouped" },+ tabs: {+ tooltipConnection: "Connection:",+ tooltipGroup: "Group:",+ tooltipDatabase: "Database:",+ },contextMenu: {splitRight: "Split right",splitDown: "Split down",@@ -244,7 +252,10 @@ describe("EditorGroupTabBar behavior", () => {it("keeps the tooltip for a connection-bound plugin tab", async () => {const store = useQueryStore();- const tabId = store.openPluginWorkbench("com.example.toolbox", "toolbox", { connectionId: "pg-1" });+ const connectionStore = useConnectionStore();+ connectionStore.connections = [{ id: "plugin-1", name: "SSH server", db_type: "plugin" } as ConnectionConfig];+ connectionStore.sidebarLayout = { groups: [], order: [{ type: "connection", id: "plugin-1" }] };+ const tabId = store.openPluginWorkbench("com.example.toolbox", "toolbox", { connectionId: "plugin-1" });const mainGroup = store.groups[0];const { app, host } = mountBar(mainGroup.id, [tabId], tabId, pinia);await settle();@@ -255,6 +266,8 @@ describe("EditorGroupTabBar behavior", () => {expect(tooltip.dataset.open).toBe("true");expect(host.querySelector("[data-plugin-title-tooltip]")).toBeNull();+ expect(host.querySelector<HTMLElement>(".tooltip-content-stub")?.textContent).toContain("SSH server");+ expect(host.querySelector<HTMLElement>(".tooltip-content-stub")?.textContent).not.toContain("Database:");app.unmount();host.remove();diff --git a/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts b/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.tsindex b2dc6f5ccc..cdcd0de2af 100644--- a/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts+++ b/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts@@ -431,6 +431,25 @@ describe("tab group presentation", () => {}});+ it("shows a database row for plugin tabs only when the tab or connection has a database", () => {+ const store = useConnectionStore();+ store.sidebarLayout = {+ groups: [],+ order: [{ type: "connection", id: "conn-1" }],+ };+ store.connections = [{ id: "conn-1", name: "SSH server", db_type: "plugin" } as ConnectionConfig];++ const tab = queryTab({ mode: "plugin-workbench", database: "" });+ expect(tabTooltipLines(tab, translate)).toEqual([+ { label: "Connection:", value: "SSH server" },+ { label: "Group:", value: "Ungrouped" },+ ]);++ store.connections = [{ id: "conn-1", name: "Database plugin", db_type: "plugin", database: "analytics" } as ConnectionConfig];+ expect(tabTooltipLines(tab, translate)).toContainEqual({ label: "Database:", value: "analytics" });+ expect(tabTooltipLines(queryTab({ mode: "plugin-workbench", database: "reporting" }), translate)).toContainEqual({ label: "Database:", value: "reporting" });+ });+it("labels a top-level connection as ungrouped", () => {const store = useConnectionStore();store.connections = [{ id: "conn-1", name: "PostgreSQL", db_type: "postgres", database: "app" } as ConnectionConfig];diff --git a/apps/desktop/src/lib/tabs/tabPresentation.ts b/apps/desktop/src/lib/tabs/tabPresentation.tsindex d7c8d78ccd..4ecec64c66 100644--- a/apps/desktop/src/lib/tabs/tabPresentation.ts+++ b/apps/desktop/src/lib/tabs/tabPresentation.ts@@ -263,10 +263,13 @@ export function tabTooltipLines(tab: QueryTab, t: Translate): { label: string; vconst connName = connectionDisplayName(tab.connectionId);const groupName = connectionGroupDisplayName(tab.connectionId, t);const connection = useConnectionStore().getConfig(tab.connectionId);+ const isPluginTab = tab.mode === "plugin-workbench" || tab.mode === "plugin-filesystem";+ const database = isPluginTab ? tab.database || connection?.database || "" : tab.database;+ const showDatabase = (!connection || supportsConnectionDatabaseInfo(connection.db_type)) && (!isPluginTab || Boolean(database.trim()));const lines: { label: string; value: string }[] = [{ label: t("tabs.tooltipConnection"), value: connName },...(groupName ? [{ label: t("tabs.tooltipGroup"), value: groupName }] : []),- ...(!connection || supportsConnectionDatabaseInfo(connection.db_type) ? [{ label: t("tabs.tooltipDatabase"), value: databaseDisplayNameForTab(tab.connectionId, tab.database, t) }] : []),+ ...(showDatabase ? [{ label: t("tabs.tooltipDatabase"), value: databaseDisplayNameForTab(tab.connectionId, database, t) }] : []),];if (tab.mode === "query" && queryTitle(tab)) {lines.unshift({ label: t("tabs.tooltipTitle"), value: tab.title });