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(tabs): show Redis SQL file titles instead of database name

t8y227f5800ad6a4
diff --git a/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts b/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts
index 1f3230e2bf..be7e5dd10a 100644
--- a/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts
+++ b/apps/desktop/src/lib/__tests__/tabs/tabPresentation.spec.ts
@@ -1025,6 +1025,8 @@ describe("shared tab presentation helpers", () => {
connectionStore.connections = [{ id: "redis-1", name: "Redis", db_type: "redis", driver_profile: "redis", color: "" } as ConnectionConfig];
expect(tabDisplayTitle(queryTab({ connectionId: "redis-1", database: "0", mode: "redis", sql: "" }), translate)).toBe("db0");
expect(tabDisplayTitle(queryTab({ connectionId: "redis-1", database: "1", mode: "redis", sql: "" }), translate)).toBe("db1");
+ expect(tabDisplayTitle(queryTab({ connectionId: "redis-1", database: "0", customTitle: true, savedSqlId: "sql-1", title: "Redis查询.sql" }), translate)).toBe("Redis查询.sql");
+ expect(tabDisplayTitle(queryTab({ connectionId: "redis-1", database: "0", customTitle: true, externalSqlPath: "/tmp/redis.sql", title: "redis.sql" }), translate)).toBe("redis.sql");
});
it("keeps source tab colors aligned with the sidebar object palette", () => {
diff --git a/apps/desktop/src/lib/tabs/tabPresentation.ts b/apps/desktop/src/lib/tabs/tabPresentation.ts
index 2726c2ba54..811bcdfdbe 100644
--- a/apps/desktop/src/lib/tabs/tabPresentation.ts
+++ b/apps/desktop/src/lib/tabs/tabPresentation.ts
@@ -273,6 +273,10 @@ export function tabDisplayTitle(tab: QueryTab, t: Translate): string {
const compact = settingsStore.editorSettings.compactTabTitle;
if (isPreviewTab(tab)) return tab.title;
if (useConnectionStore().getConfig(tab.connectionId)?.db_type === "redis") {
+ // Redis query tabs normally identify their logical database (db0/db1), but a
+ // saved SQL file or external SQL file is a document: show its file title
+ // instead, otherwise every Redis file tab looks like the same database.
+ if (!tab.isDefaultQuery && (tab.savedSqlId || tab.externalSqlPath) && tab.title.trim()) return tab.title;
return tab.database ? database : connectionDisplayName(tab.connectionId);
}
if (tab.mode === "data" && tab.tableMeta?.tableName) {