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(connection): preserve Redis aliases and default schema when editing
Acd-kk995e7f45094e
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vueindex 8fb6043065..1bd0b163ef 100644--- a/apps/desktop/src/components/connection/ConnectionDialog.vue+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue@@ -3216,6 +3216,7 @@ watch(// Show the index the backend actually connects with; legacy dirty values// (e.g. redis-cli flags in the field) are healed when the form is saved.database: config.db_type === "redis" ? normalizeRedisDatabaseValue(config.database) || "" : config.database,+ default_schema: config.default_schema,color: config.color || "",transport_layers: transportLayersForConfig(legacyConfig),connect_timeout_secs: config.connect_timeout_inherit === true ? settingsStore.editorSettings.globalConnectTimeoutSecs : config.connect_timeout_secs || 10,@@ -3242,6 +3243,7 @@ watch(redis_cluster_nodes: config.redis_cluster_nodes || "",redis_key_separator: config.redis_key_separator ?? ":",redis_scan_page_size: config.redis_scan_page_size ?? REDIS_SCAN_PAGE_SIZE_DEFAULT,+ redis_database_aliases: config.redis_database_aliases ? { ...config.redis_database_aliases } : undefined,redis_key_templates: normalizeRedisKeyTemplates(config.redis_key_templates),redis_key_filter: config.redis_key_filter ?? "",redis_key_grouping: config.redis_key_grouping,diff --git a/apps/desktop/src/components/connection/__tests__/ConnectionDialog.deepLinkEdit.spec.ts b/apps/desktop/src/components/connection/__tests__/ConnectionDialog.deepLinkEdit.spec.tsindex f27683c3b9..4a4d626f90 100644--- a/apps/desktop/src/components/connection/__tests__/ConnectionDialog.deepLinkEdit.spec.ts+++ b/apps/desktop/src/components/connection/__tests__/ConnectionDialog.deepLinkEdit.spec.ts@@ -187,7 +187,7 @@ async function settle() {for (let i = 0; i < 8; i++) await nextTick();}-async function mountDialog(config: ConnectionConfig, url: string, initiallyOpen = true) {+async function mountDialog(config: ConnectionConfig, url = "", initiallyOpen = true) {const props = reactive({ open: initiallyOpen, editConfig: config, updatePrefill: url ? parseConnectionDeepLinkUpdate(url) : null });store.getConfig.mockReturnValue(config);const container = document.createElement("div");@@ -251,6 +251,50 @@ afterEach(() => {actualStoreHolder.value = null;});+describe.each([+ { mode: "without edits", rename: false },+ { mode: "after renaming", rename: true },+])("ConnectionDialog saved connection settings $mode", ({ rename }) => {+ it.each([+ {+ setting: "Redis database aliases",+ config: savedConnection({ db_type: "redis", driver_profile: "redis", driver_label: "Redis", port: 6379, database: "0", redis_database_aliases: { "3": "orders", "7": "cache" } }),+ expected: { redis_database_aliases: { "3": "orders", "7": "cache" } },+ },+ {+ setting: "the default schema",+ config: savedConnection({ db_type: "postgres", driver_profile: "postgres", driver_label: "PostgreSQL", port: 5432, default_schema: "archive" }),+ expected: { default_schema: "archive" },+ },+ ])("preserves $setting when saving", async ({ config, expected }) => {+ const originalName = config.name;+ await mountDialog(config);+ if (rename) {+ const nameInput = [...document.querySelectorAll("input")].find((input) => input.value === originalName);+ expect(nameInput).toBeTruthy();+ nameInput!.value = "Renamed connection";+ nameInput!.dispatchEvent(new Event("input", { bubbles: true }));+ await settle();+ }++ const save = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Save");+ expect(save).toBeTruthy();+ save!.click();+ await vi.waitFor(() => expect(store.updateConnection).toHaveBeenCalledOnce());++ expect(store.updateConnection).toHaveBeenCalledWith(+ expect.objectContaining({+ ...expected,+ id: config.id,+ name: rename ? "Renamed connection" : originalName,+ password: config.password,+ }),+ );+ expect(config).toEqual(expect.objectContaining({ ...expected, name: originalName }));+ expect(store.addConnection).not.toHaveBeenCalled();+ });+});+describe("ConnectionDialog deep-link edit confirmation", () => {it("saves a new OceanBase connection with its explicitly entered port after switching mode", async () => {backend.listInstalledAgentsLocal.mockResolvedValue([{ db_type: "oceanbase-oracle", installed: true }]);@@ -774,7 +818,7 @@ describe("ConnectionDialog deep-link edit confirmation", () => {});it("hydrates a later-opened update without clearing omitted database or schema filters", async () => {- const saved = savedConnection({ db_type: "postgres", driver_profile: "postgres", driver_label: "PostgreSQL", url_params: "sslmode=require", visible_schemas: ["approved_schema"] });+ const saved = savedConnection({ db_type: "postgres", driver_profile: "postgres", driver_label: "PostgreSQL", url_params: "sslmode=require", visible_schemas: ["approved_schema"], default_schema: "archive" });const props = await mountDialog(saved, "dbx://connection/new?id=saved-production&user=new-user&password=new-password", false);props.open = true;await settle();@@ -797,6 +841,7 @@ describe("ConnectionDialog deep-link edit confirmation", () => {password: "new-password",visible_databases: ["orders"],visible_schemas: ["approved_schema"],+ default_schema: "archive",}),);expect(store.addConnection).not.toHaveBeenCalled();