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。

feat(connection): import RedisDesktopManager connection profiles

CSXFanMeng759189cd74ff
diff --git a/apps/desktop/src/components/layout/AppSidebar.vue b/apps/desktop/src/components/layout/AppSidebar.vue
index 0ce8de2ff2..9261329c0d 100644
--- a/apps/desktop/src/components/layout/AppSidebar.vue
+++ b/apps/desktop/src/components/layout/AppSidebar.vue
@@ -27,7 +27,7 @@ defineProps<{
}>();
const emit = defineEmits<{
- import: [source: "dbx" | "navicat" | "dbeaver" | "datagrip"];
+ import: [source: "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm"];
export: [];
startResize: [event: PointerEvent];
collapse: [];
@@ -37,7 +37,7 @@ const emit = defineEmits<{
"open-dependency-object": [context: ObjectDependencyTarget, target: SqlObjectNavigationTarget];
}>();
-type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip";
+type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm";
const { t } = useI18n();
const connectionStore = useConnectionStore();
@@ -54,6 +54,7 @@ const importSourceItems = computed(() => [
{ value: "navicat", label: t("sidebar.importNavicat") },
{ value: "dbeaver", label: t("sidebar.importDbeaver") },
{ value: "datagrip", label: t("sidebar.importDatagrip") },
+ { value: "rdm", label: t("sidebar.importRdm") },
]);
const connectionTransferItems = computed(() => [
...importSourceItems.value.map((item) => ({
diff --git a/apps/desktop/src/components/layout/WelcomeScreen.vue b/apps/desktop/src/components/layout/WelcomeScreen.vue
index b0374703d5..46065ab6c1 100644
--- a/apps/desktop/src/components/layout/WelcomeScreen.vue
+++ b/apps/desktop/src/components/layout/WelcomeScreen.vue
@@ -41,7 +41,7 @@ const emit = defineEmits<{
"open-settings": [];
}>();
-type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip";
+type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm";
const { t } = useI18n();
@@ -50,6 +50,7 @@ const importSourceItems = computed(() => [
{ value: "navicat", label: t("sidebar.importNavicat") },
{ value: "dbeaver", label: t("sidebar.importDbeaver") },
{ value: "datagrip", label: t("sidebar.importDatagrip") },
+ { value: "rdm", label: t("sidebar.importRdm") },
]);
function selectImportSource(source: string) {
diff --git a/apps/desktop/src/composables/__tests__/useDialogSources.spec.ts b/apps/desktop/src/composables/__tests__/useDialogSources.spec.ts
index e0319c61ff..26019ad6fe 100644
--- a/apps/desktop/src/composables/__tests__/useDialogSources.spec.ts
+++ b/apps/desktop/src/composables/__tests__/useDialogSources.spec.ts
@@ -72,7 +72,7 @@ async function mountDialogs() {
}
describe("useDialogSources", () => {
- it("runs the final import confirmation as a single flight", async () => {
+ it.each(["dbx", "rdm"] as const)("runs the final %s import confirmation as a single flight", async (source) => {
let resolveApply!: (value: { count: number }) => void;
const applyPromise = new Promise<{ count: number }>((resolve) => {
resolveApply = resolve;
@@ -82,7 +82,9 @@ describe("useDialogSources", () => {
mocks.store.applyConnectionsImport.mockReturnValue(applyPromise);
const dialogs = await mountDialogs();
- await dialogs.onImportClick("dbx");
+ await dialogs.onImportClick(source);
+ expect(mocks.store.readImportFile).toHaveBeenCalledWith(source);
+ expect(mocks.store.applyConnectionsImport).not.toHaveBeenCalled();
dialogs.onConfigConnectionSelectConfirm(["imported"]);
dialogs.onConfigConnectionSelectConfirm(["imported"]);
diff --git a/apps/desktop/src/composables/useDialogSources.ts b/apps/desktop/src/composables/useDialogSources.ts
index e1a8e3b690..6d1ca2e6ca 100644
--- a/apps/desktop/src/composables/useDialogSources.ts
+++ b/apps/desktop/src/composables/useDialogSources.ts
@@ -45,7 +45,7 @@ const configConnectionSelectList = ref<ConnectionConfig[]>([]);
const configConnectionSelectLayout = ref<SidebarLayout | null>(null);
const pendingExportConnectionIds = ref<string[]>([]);
const pendingImportPreview = ref<ConnectionConfigBundle | null>(null);
-const pendingImportSource = ref<"dbx" | "navicat" | "dbeaver" | "datagrip">("dbx");
+const pendingImportSource = ref<"dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm">("dbx");
const applyingImportSelection = ref(false);
const transferPrefillConnectionId = ref("");
@@ -433,7 +433,7 @@ export function useDialogSources() {
showConfigConnectionSelectDialog.value = true;
}
- function importSuccessMessage(source: "dbx" | "navicat" | "dbeaver" | "datagrip", count: number, keychainFilled = 0) {
+ function importSuccessMessage(source: "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm", count: number, keychainFilled = 0) {
if (count <= 0) return t("configExport.importNone");
if (source === "navicat") return t("configExport.importNavicatSuccess", { count });
if (source === "dbeaver") return t("configExport.importDbeaverSuccess", { count });
@@ -441,7 +441,7 @@ export function useDialogSources() {
return t("configExport.importSuccess", { count });
}
- async function finishImport(source: "dbx" | "navicat" | "dbeaver" | "datagrip", count: number, layout?: SidebarLayout) {
+ async function finishImport(source: "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm", count: number, layout?: SidebarLayout) {
let keychainFilled = 0;
if (source === "datagrip" && count > 0) {
keychainFilled = await connectionStore.applyDataGripKeychainPasswords();
@@ -525,7 +525,7 @@ export function useDialogSources() {
if (!open) showConfigPassphraseDialog.value = true;
}
- async function onImportClick(source: "dbx" | "navicat" | "dbeaver" | "datagrip" = "dbx") {
+ async function onImportClick(source: "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm" = "dbx") {
try {
const result = await connectionStore.readImportFile(source);
if (!result) return;
@@ -540,7 +540,7 @@ export function useDialogSources() {
}
const preview = await connectionStore.parseConnectionsImport(result.content, null);
pendingImportPreview.value = preview;
- if (source === "dbx") {
+ if (source === "dbx" || source === "rdm") {
openConnectionSelect("import", preview.connections, preview.layout);
return;
}
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index 80306e6b2a..9126ffd21e 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -475,6 +475,7 @@ export default withEnglishFallback({
importNavicat: "Navicat NCX-i idxal et",
importDbeaver: "DBeaver-i idxal et",
importDatagrip: "DataGrip-i idxal et",
+ importRdm: "RedisDesktopManager-i idxal et",
export: "Əlaqələri ixrac et",
collapseAll: "Hamısını yığ",
collapse: "Yan paneli yığ",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 9b80eb034b..7d0c20c932 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -1131,6 +1131,7 @@ export default {
importNavicat: "Import Navicat NCX",
importDbeaver: "Import DBeaver",
importDatagrip: "Import DataGrip",
+ importRdm: "Import RedisDesktopManager",
export: "Export Connections",
collapseAll: "Collapse all",
collapse: "Collapse sidebar",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index 409256cf5a..ed653a2b2f 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -981,6 +981,7 @@ export default withEnglishFallback({
importNavicat: "Importar Navicat NCX",
importDbeaver: "Importar DBeaver",
importDatagrip: "Importar DataGrip",
+ importRdm: "Importar RedisDesktopManager",
export: "Exportar conexiones",
collapseAll: "Contraer todo",
collapse: "Contraer barra lateral",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index 4316706a93..a04ea1c68b 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -680,6 +680,7 @@ export default withEnglishFallback({
importNavicat: "Impor Navicat NCX",
importDbeaver: "Impor DBeaver",
importDatagrip: "Impor DataGrip",
+ importRdm: "Impor RedisDesktopManager",
export: "Ekspor Koneksi",
collapseAll: "Ciutkan semua",
collapse: "Ciutkan bilah sisi",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 644f834104..314ea9254a 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -970,6 +970,7 @@ export default withEnglishFallback({
importNavicat: "Importa Navicat NCX",
importDbeaver: "Importa DBeaver",
importDatagrip: "Importa DataGrip",
+ importRdm: "Importa RedisDesktopManager",
export: "Esporta Connessioni",
collapseAll: "Riduci tutto",
collapse: "Riduci barra laterale",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 681d7d9ab0..6d25f0b87d 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -971,6 +971,7 @@ export default withEnglishFallback({
importNavicat: "Navicat NCXをインポート",
importDbeaver: "DBeaverをインポート",
importDatagrip: "DataGripをインポート",
+ importRdm: "RedisDesktopManager をインポート",
export: "接続をエクスポート",
collapseAll: "すべて折りたたむ",
collapse: "サイドバーを折りたたむ",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 27b87dd55e..3f489dc09d 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -977,6 +977,7 @@ export default withEnglishFallback({
importNavicat: "Navicat NCX 가져오기",
importDbeaver: "DBeaver 가져오기",
importDatagrip: "DataGrip 가져오기",
+ importRdm: "RedisDesktopManager 가져오기",
export: "연결 내보내기",
collapseAll: "모두 접기",
collapse: "사이드바 접기",
diff --git a/apps/desktop/src/i18n/locales/pl.ts b/apps/desktop/src/i18n/locales/pl.ts
index bf4e68ec87..172321ff5a 100644
--- a/apps/desktop/src/i18n/locales/pl.ts
+++ b/apps/desktop/src/i18n/locales/pl.ts
@@ -744,6 +744,7 @@ export default withEnglishFallback({
importNavicat: "Importuj Navicat NCX",
importDbeaver: "Importuj DBeaver",
importDatagrip: "Importuj DataGrip",
+ importRdm: "Importuj RedisDesktopManager",
export: "Eksportuj połączenia",
collapseAll: "Zwiń wszystko",
collapse: "Zwiń pasek boczny",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 4d98705182..882ba2fd0b 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -971,6 +971,7 @@ export default withEnglishFallback({
importNavicat: "Importar Navicat NCX",
importDbeaver: "Importar DBeaver",
importDatagrip: "Importar DataGrip",
+ importRdm: "Importar RedisDesktopManager",
export: "Exportar Conexões",
collapseAll: "Recolher tudo",
collapse: "Recolher barra lateral",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index 116c106af0..90dd0a80d1 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -951,6 +951,7 @@ export default withEnglishFallback({
importNavicat: "Импорт Navicat NCX",
importDbeaver: "Импорт DBeaver",
importDatagrip: "Импорт DataGrip",
+ importRdm: "Импорт RedisDesktopManager",
export: "Экспортировать подключения",
collapseAll: "Свернуть всё",
collapse: "Свернуть боковую панель",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index abef2030c9..ee2c9f2f3a 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -1061,6 +1061,7 @@ export default withEnglishFallback({
importNavicat: "นำเข้า Navicat NCX",
importDbeaver: "นำเข้า DBeaver",
importDatagrip: "นำเข้า DataGrip",
+ importRdm: "นำเข้า RedisDesktopManager",
export: "ส่งออกการเชื่อมต่อ",
collapseAll: "ยุบทั้งหมด",
collapse: "ยุบแถบด้านข้าง",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index 62360354a8..c78354ff58 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -475,6 +475,7 @@ export default withEnglishFallback({
importNavicat: "Navicat NCX İçe Aktar",
importDbeaver: "DBeaver İçe Aktar",
importDatagrip: "DataGrip İçe Aktar",
+ importRdm: "RedisDesktopManager içe aktar",
export: "Bağlantıları Dışa Aktar",
collapseAll: "Tümünü daralt",
collapse: "Kenar çubuğunu daralt",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index d50ed7bba2..ee04699804 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -1067,6 +1067,7 @@ export default withEnglishFallback({
importNavicat: "导入 Navicat NCX",
importDbeaver: "导入 DBeaver",
importDatagrip: "导入 DataGrip",
+ importRdm: "导入 RedisDesktopManager",
export: "导出连接",
collapseAll: "一键折叠",
collapse: "收起侧边栏",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 7b83b37656..28ecb318db 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -975,6 +975,7 @@ export default withEnglishFallback({
importNavicat: "匯入 Navicat NCX",
importDbeaver: "匯入 DBeaver",
importDatagrip: "匯入 DataGrip",
+ importRdm: "匯入 RedisDesktopManager",
export: "匯出連線",
collapseAll: "一鍵收合",
collapse: "收合側邊欄",
diff --git a/apps/desktop/src/lib/__tests__/imports/redisDesktopManagerImport.spec.ts b/apps/desktop/src/lib/__tests__/imports/redisDesktopManagerImport.spec.ts
new file mode 100644
index 0000000000..7053dbaabf
--- /dev/null
+++ b/apps/desktop/src/lib/__tests__/imports/redisDesktopManagerImport.spec.ts
@@ -0,0 +1,99 @@
+import { describe, expect, it } from "vitest";
+import { parseRedisDesktopManagerImport } from "@/lib/imports/redisDesktopManagerImport";
+
+const parse = (value: unknown) => parseRedisDesktopManagerImport(JSON.stringify(value));
+
+describe("RedisDesktopManager connection import", () => {
+ it("imports plain connections with fresh identities and preserves credentials verbatim", () => {
+ const data = [{ id: "rdm-id", host: " localhost ", name: "Development", username: " acl-user ", auth: " secret ", port: "6380" }];
+ const first = parse(data).connections[0]!;
+ expect(first).toMatchObject({ db_type: "redis", driver_profile: "redis", host: "localhost", name: "Development", port: 6380, username: " acl-user ", password: " secret ", ssl: false });
+ expect(first.id).not.toBe("rdm-id");
+ expect(parse(data).connections[0]!.id).not.toBe(first.id);
+ expect(data[0]!.id).toBe("rdm-id");
+ });
+
+ it("preserves nested and same-named groups, literal slashes and root ordering", () => {
+ const result = parse([{ host: "root" }, { type: "group", name: "Prod/EU", connections: [{ type: "group", name: "Cache", connections: [{ host: "first" }] }] }, { type: "group", name: "Prod/EU", connections: [{ host: "second" }] }]);
+ expect(result.layout!.groups.map((group) => group.name)).toEqual(["Prod/EU", "Cache", "Prod/EU"]);
+ expect(result.layout!.order[0]).toEqual({ type: "connection", id: result.connections[0]!.id });
+ expect(result.layout!.order[1]).toMatchObject({ type: "group", children: [{ type: "group", children: [{ type: "connection", id: result.connections[1]!.id }] }] });
+ expect(result.layout!.order[2]).toMatchObject({ type: "group", children: [{ type: "connection", id: result.connections[2]!.id }] });
+ });
+
+ it("maps TLS certificates, timeout units, key filters and SSH key/password authentication", () => {
+ const {
+ connections: [config],
+ } = parse([
+ {
+ host: "cache",
+ ssl: true,
+ ssl_ca_cert_path: "/ca.pem",
+ ssl_local_cert_path: "/client.pem",
+ ssl_private_key_path: "/client.key",
+ ssl_ignore_all_errors: true,
+ timeout_connect: 1500,
+ timeout_execute: 5000,
+ keys_pattern: "app:*",
+ namespace_separator: "::",
+ ssh_host: "bastion",
+ ssh_port: 2222,
+ ssh_user: "operator",
+ ssh_password: " ssh-secret ",
+ ssh_private_key_path: "/id_ed25519",
+ },
+ ]);
+ expect(config).toMatchObject({
+ ssl: true,
+ ca_cert_path: "/ca.pem",
+ client_cert_path: "/client.pem",
+ client_key_path: "/client.key",
+ connect_timeout_secs: 2,
+ connect_timeout_inherit: false,
+ query_timeout_secs: 5,
+ query_timeout_inherit: false,
+ redis_key_filter: "app:*",
+ redis_key_separator: "::",
+ transport_layers: [{ type: "ssh", enabled: true, host: "bastion", port: 2222, user: "operator", password: " ssh-secret ", key_path: "/id_ed25519", auth_method: "key+password" }],
+ });
+ expect(config).not.toHaveProperty("ssl_ignore_all_errors");
+ });
+
+ it("maps SSH agents and does not treat the string false as enabling TLS", () => {
+ const config = parse([{ host: "cache", ssl: "false", ssh_host: "jump", ssh_user: "user", ssh_agent: true, ssh_agent_path: "/agent.sock" }]).connections[0]!;
+ expect(config.ssl).toBe(false);
+ expect(config.transport_layers![0]).toMatchObject({ type: "ssh", port: 22, auth_method: "agent", use_ssh_agent: true, ssh_agent_sock_path: "/agent.sock" });
+ });
+
+ it.each([0, -1, 65536, 1.5, "invalid", true])("rejects invalid port %s before saving any connection", (value) => {
+ expect(() => parse([{ host: "valid" }, { host: "invalid", port: value, auth: "do-not-disclose" }])).toThrow("invalid port");
+ try {
+ parse([{ host: "invalid", port: value, auth: "do-not-disclose" }]);
+ } catch (error) {
+ expect(String(error)).not.toContain("do-not-disclose");
+ }
+ });
+
+ it.each([
+ null,
+ {},
+ [],
+ [null],
+ [{ name: "missing host" }],
+ [{ host: "cache", db_type: "redis" }],
+ [{ type: "group", name: "bad" }],
+ [{ host: "cache", ssl: "yes" }],
+ [{ host: "cache", ssl: true, ssl_local_cert_path: "/client.pem" }],
+ [{ host: "cache", ssh_host: "jump" }],
+ [{ host: "cache", timeout_connect: -1 }],
+ ])("rejects malformed or unsupported exports %#", (value) => {
+ expect(() => parse(value)).toThrow(/RedisDesktopManager/);
+ });
+
+ it("rejects invalid JSON and excessive nesting", () => {
+ expect(() => parseRedisDesktopManagerImport("not-json")).toThrow("invalid JSON");
+ let items: unknown[] = [{ host: "cache" }];
+ for (let index = 0; index < 34; index++) items = [{ type: "group", name: "nested", connections: items }];
+ expect(() => parse(items)).toThrow("nested groups");
+ });
+});
diff --git a/apps/desktop/src/lib/imports/redisDesktopManagerImport.ts b/apps/desktop/src/lib/imports/redisDesktopManagerImport.ts
new file mode 100644
index 0000000000..e92dadd7c3
--- /dev/null
+++ b/apps/desktop/src/lib/imports/redisDesktopManagerImport.ts
@@ -0,0 +1,129 @@
+import { uuid } from "@/lib/common/utils";
+import type { ConnectionConfigBundle } from "@/lib/connection/connectionConfigTransfer";
+import type { ConnectionConfig, ConnectionGroup, SidebarOrderEntry, TransportLayerConfig } from "@/types/database";
+
+type RdmEntry = Record<string, unknown>;
+
+function record(value: unknown): RdmEntry {
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("RedisDesktopManager: invalid connection or group.");
+ return value as RdmEntry;
+}
+
+function text(entry: RdmEntry, key: string, fallback = ""): string {
+ const value = entry[key];
+ if (value == null) return fallback;
+ if (typeof value !== "string") throw new Error(`RedisDesktopManager: invalid ${key}.`);
+ return value;
+}
+
+function flag(entry: RdmEntry, key: string): boolean {
+ const value = entry[key];
+ if (value == null || value === false || value === 0 || value === "false" || value === "0") return false;
+ if (value === true || value === 1 || value === "true" || value === "1") return true;
+ throw new Error(`RedisDesktopManager: invalid ${key}.`);
+}
+
+function port(entry: RdmEntry, key: string, fallback: number): number {
+ const value = entry[key];
+ if (value == null || value === "") return fallback;
+ const result = typeof value === "number" || typeof value === "string" ? Number(value) : NaN;
+ if (!Number.isInteger(result) || result < 1 || result > 65535) throw new Error(`RedisDesktopManager: invalid ${key}.`);
+ return result;
+}
+
+function timeout(entry: RdmEntry, key: string): number | undefined {
+ const value = entry[key];
+ if (value == null) return undefined;
+ const result = typeof value === "number" || typeof value === "string" ? Number(value) : NaN;
+ if (!Number.isFinite(result) || result <= 0) throw new Error(`RedisDesktopManager: invalid ${key}.`);
+ return Math.ceil(result / 1000);
+}
+
+function connection(entry: RdmEntry): ConnectionConfig {
+ const host = text(entry, "host").trim();
+ if (!host || "db_type" in entry) throw new Error("RedisDesktopManager: expected an RDM connection with a host.");
+ const redisPort = port(entry, "port", 6379);
+ const ssl = flag(entry, "ssl");
+ const clientCert = text(entry, "ssl_local_cert_path");
+ const clientKey = text(entry, "ssl_private_key_path");
+ if (ssl && !!clientCert !== !!clientKey) throw new Error("RedisDesktopManager: TLS client certificate and key must both be provided.");
+ const connectTimeout = timeout(entry, "timeout_connect");
+ const queryTimeout = timeout(entry, "timeout_execute");
+ const config: ConnectionConfig = {
+ id: uuid(),
+ name: text(entry, "name").trim() || `${host}:${redisPort}`,
+ db_type: "redis",
+ driver_profile: "redis",
+ driver_label: "Redis",
+ host,
+ port: redisPort,
+ username: text(entry, "username"),
+ password: text(entry, "auth"),
+ ssl,
+ ca_cert_path: text(entry, "ssl_ca_cert_path") || undefined,
+ client_cert_path: clientCert || undefined,
+ client_key_path: clientKey || undefined,
+ save_password: true,
+ redis_connection_mode: "standalone",
+ redis_key_separator: text(entry, "namespace_separator", ":"),
+ redis_key_filter: text(entry, "keys_pattern", "*"),
+ ...(connectTimeout !== undefined ? { connect_timeout_secs: connectTimeout, connect_timeout_inherit: false } : {}),
+ ...(queryTimeout !== undefined ? { query_timeout_secs: queryTimeout, query_timeout_inherit: false } : {}),
+ };
+ const sshHost = text(entry, "ssh_host").trim();
+ if (sshHost) {
+ const user = text(entry, "ssh_user").trim();
+ if (!user) throw new Error("RedisDesktopManager: SSH username is required.");
+ const password = text(entry, "ssh_password");
+ const key = text(entry, "ssh_private_key_path");
+ const agent = flag(entry, "ssh_agent");
+ const layer: TransportLayerConfig = {
+ id: uuid(),
+ type: "ssh",
+ enabled: true,
+ host: sshHost,
+ port: port(entry, "ssh_port", 22),
+ user,
+ password,
+ key_path: key || undefined,
+ use_ssh_agent: agent,
+ ssh_agent_sock_path: text(entry, "ssh_agent_path") || undefined,
+ auth_method: key ? (password ? "key+password" : "key") : agent ? "agent" : "password",
+ };
+ config.transport_layers = [layer];
+ }
+ return config;
+}
+
+export function parseRedisDesktopManagerImport(content: string): ConnectionConfigBundle {
+ let input: unknown;
+ try {
+ input = JSON.parse(content);
+ } catch {
+ throw new Error("RedisDesktopManager: invalid JSON file.");
+ }
+ if (!Array.isArray(input)) throw new Error("RedisDesktopManager: the export must be a JSON array.");
+ const connections: ConnectionConfig[] = [];
+ const groups: ConnectionGroup[] = [];
+ const walk = (items: unknown[], depth: number): SidebarOrderEntry[] => {
+ if (depth > 32) throw new Error("RedisDesktopManager: too many nested groups.");
+ return items.map((value) => {
+ const entry = record(value);
+ if (entry.type === "group") {
+ if (!Array.isArray(entry.connections)) throw new Error("RedisDesktopManager: a group must contain a connections array.");
+ const name = text(entry, "name").trim();
+ if (!name) throw new Error("RedisDesktopManager: group name is required.");
+ const id = uuid();
+ groups.push({ id, name, collapsed: false });
+ return { type: "group", id, children: walk(entry.connections, depth + 1) };
+ }
+ if (entry.type != null && entry.type !== "connection") throw new Error("RedisDesktopManager: unsupported entry type.");
+ const config = connection(entry);
+ connections.push(config);
+ return { type: "connection", id: config.id };
+ });
+ };
+ const order = walk(input, 0);
+ if (!connections.length) throw new Error("RedisDesktopManager: no connections found.");
+ return { connections, ...(groups.length ? { layout: { groups, order } } : {}) };
+}
diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts
index 0c40bd0a44..1eb47fb276 100644
--- a/apps/desktop/src/stores/connectionStore.ts
+++ b/apps/desktop/src/stores/connectionStore.ts
@@ -334,7 +334,7 @@ function isFlatMqConnection(config: ConnectionConfig | undefined): boolean {
return kind === "kafka" || kind === "rocketmq" || kind === "rabbitmq";
}
-type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip";
+type ImportSource = "dbx" | "navicat" | "dbeaver" | "datagrip" | "rdm";
interface LocateTableTarget {
catalog?: string;
@@ -11060,7 +11060,7 @@ export const useConnectionStore = defineStore("connection", () => {
const { readFile } = await import("@tauri-apps/plugin-fs");
const { decodeImportFileText } = await import("@/lib/common/decodeText");
const path = await open({
- filters: source === "navicat" ? [{ name: "Navicat Connection Export", extensions: ["ncx", "xml"] }] : [{ name: "DBX JSON", extensions: ["json"] }],
+ filters: source === "navicat" ? [{ name: "Navicat Connection Export", extensions: ["ncx", "xml"] }] : [{ name: source === "rdm" ? "RedisDesktopManager JSON" : "DBX JSON", extensions: ["json"] }],
multiple: false,
});
if (!path) return null;
@@ -11088,6 +11088,7 @@ export const useConnectionStore = defineStore("connection", () => {
});
}
+ if (source === "rdm") return { content: JSON.stringify({ format: "rdm-import", content }), encrypted: false };
if (content.trimStart().startsWith("<")) {
return { content, encrypted: false };
}
@@ -11104,6 +11105,12 @@ export const useConnectionStore = defineStore("connection", () => {
}
if (!passphrase) {
+ const payload: unknown = JSON.parse(content);
+ if (payload && typeof payload === "object" && "format" in payload && payload.format === "rdm-import") {
+ if (!("content" in payload) || typeof payload.content !== "string") throw new Error("RedisDesktopManager: invalid import payload.");
+ const { parseRedisDesktopManagerImport } = await import("@/lib/imports/redisDesktopManagerImport");
+ return parseRedisDesktopManagerImport(payload.content);
+ }
const { isDbeaverImportPayload, parseDbeaverImport } = await import("@/lib/imports/dbeaverImport");
const { isDataGripImportPayload, parseDataGripImport } = await import("@/lib/imports/datagripImport");
if (isDataGripImportPayload(content)) {
diff --git a/docs/content/docs/connection-import.cn.mdx b/docs/content/docs/connection-import.cn.mdx
index 76f77e102c..fcf87f03a5 100644
--- a/docs/content/docs/connection-import.cn.mdx
+++ b/docs/content/docs/connection-import.cn.mdx
@@ -1,6 +1,6 @@
---
title: 连接导入
-description: 从 Navicat、DBeaver 和 DataGrip 导入连接、分组和可识别的数据库类型。
+description: 从 Navicat、DBeaver、DataGrip 和 RedisDesktopManager 导入连接与分组。
---
DBX 可以从其他数据库工具导入连接,在切换工具时无需手动重新创建大量连接。
@@ -12,6 +12,7 @@ DBX 可以从其他数据库工具导入连接,在切换工具时无需手动
| Navicat | `.ncx` 导出文件 | 主机、端口、用户名、数据库类型、连接名称 |
| DBeaver | 连接配置文件 | 主机、端口、用户名、数据库类型、连接名称 |
| DataGrip | `dataSources.xml` 等项目/全局配置 | JDBC URL、驱动、连接名称、分组和可读取凭据 |
+| RedisDesktopManager | JSON 导出文件 | Redis 连接、嵌套分组、认证、TLS 和 SSH 配置 |
<Callout type="info">导入的连接保留原始连接名称和类型。其他工具以加密格式存储的密码无法解密——导入后需要重新输入密码。</Callout>
@@ -102,6 +103,14 @@ DBX 可以从其他数据库工具导入连接,在切换工具时无需手动
</Step>
</Steps>
+## 导入 RedisDesktopManager 连接
+
+从 RedisDesktopManager 导出 JSON,在侧边栏或欢迎页的导入菜单选择 **导入 RedisDesktopManager**。检查连接选择预览,再选择需要迁移的连接并确认导入。连接和嵌套分组会一起迁移,原有连接不会被覆盖。
+
+支持普通 Redis 连接的主机、端口、ACL 用户名、`auth` 密码、键分隔符和过滤模式,以及 SSH 密码、私钥或 agent 配置。连接和执行超时会从毫秒转换为秒。
+
+TLS 的 CA、客户端证书和私钥路径会保留,但不会读取或复制文件,跨机器迁移后需要检查路径。不会继承 RDM 的忽略证书错误设置。导出文件可能含有明文密码,请妥善保管;导入不会自动连接数据库。
+
## 导入后
导入的连接与手动创建的连接一同出现在侧边栏中。你应该:
diff --git a/docs/content/docs/connection-import.mdx b/docs/content/docs/connection-import.mdx
index 82e3146a29..ae66c2333e 100644
--- a/docs/content/docs/connection-import.mdx
+++ b/docs/content/docs/connection-import.mdx
@@ -1,6 +1,6 @@
---
title: Connection Import
-description: Import connections, groups, and recognized database profiles from Navicat, DBeaver, and DataGrip.
+description: Import connections and groups from Navicat, DBeaver, DataGrip, and RedisDesktopManager.
---
DBX can import connections from other database tools, saving you from manually re-creating dozens of connections when switching tools.
@@ -12,6 +12,7 @@ DBX can import connections from other database tools, saving you from manually r
| Navicat | `.ncx` export files | Host, port, username, database type, connection name |
| DBeaver | Connection configuration files | Host, port, username, database type, connection name |
| DataGrip | Project or global files such as `dataSources.xml` | JDBC URL, driver, connection name, groups, and readable credentials |
+| RedisDesktopManager | JSON export | Redis connections, nested groups, authentication, TLS, and SSH settings |
<Callout type="info">Imported connections preserve the original connection name and type. Passwords stored in encrypted format by other tools cannot be decrypted — you will need to re-enter passwords after import.</Callout>
@@ -102,6 +103,14 @@ DBX can import connections from other database tools, saving you from manually r
</Step>
</Steps>
+## Import RedisDesktopManager Connections
+
+Export a JSON file from RedisDesktopManager, then choose **Import RedisDesktopManager** from the sidebar or welcome-page import menu. Review the connection selector, select the connections to migrate, and confirm. Connections and nested groups are imported without overwriting existing connections.
+
+Standalone Redis host, port, ACL username, `auth` password, key separator and filter, and SSH password, private-key or agent settings are supported. Connection and execution timeouts are converted from milliseconds to seconds.
+
+TLS CA, client certificate and private-key paths are preserved, but files are not read or copied. Check paths after moving between machines. RDM's ignore-certificate-errors setting is not inherited. Export files may contain plaintext passwords; keep them secure. Importing does not automatically connect to Redis.
+
## After Import
Imported connections appear in the sidebar alongside manually created ones. You should:
diff --git a/docs/screenshots/issue-8807-rdm-import-menu.png b/docs/screenshots/issue-8807-rdm-import-menu.png
new file mode 100644
index 0000000000..9bc8e199e7
Binary files /dev/null and b/docs/screenshots/issue-8807-rdm-import-menu.png differ
diff --git a/docs/screenshots/issue-8807-rdm-import-mobile.png b/docs/screenshots/issue-8807-rdm-import-mobile.png
new file mode 100644
index 0000000000..7a0aadc202
Binary files /dev/null and b/docs/screenshots/issue-8807-rdm-import-mobile.png differ
diff --git a/docs/screenshots/issue-8807-rdm-import-preview.png b/docs/screenshots/issue-8807-rdm-import-preview.png
new file mode 100644
index 0000000000..d6e2f3d6f3
Binary files /dev/null and b/docs/screenshots/issue-8807-rdm-import-preview.png differ
diff --git a/packages/app-tests/connectionImportRoundTrip.test.ts b/packages/app-tests/connectionImportRoundTrip.test.ts
index 4ac145aad7..afa72b672d 100644
--- a/packages/app-tests/connectionImportRoundTrip.test.ts
+++ b/packages/app-tests/connectionImportRoundTrip.test.ts
@@ -76,7 +76,8 @@ function installBackend(initialConnections: ConnectionConfig[], initialLayout: S
return json(state.layout);
}
if (url === "/api/connection/save") {
- state.connections = JSON.parse(String(init?.body ?? "[]"));
+ const body = JSON.parse(String(init?.body ?? "{}"));
+ state.connections = Array.isArray(body) ? body : body.configs;
return json(null);
}
if (url === "/api/tunnel-profiles/list") return json(state.profiles);
@@ -468,6 +469,53 @@ test("encrypted export fails closed when Web Crypto is unavailable", async () =>
}
});
+test("RDM imports preserve credentials and selected groups without changing existing connections", async () => {
+ const existing = conn("existing", "Existing", 3306);
+ const backend = installBackend([existing], null);
+ const storage = installMemoryStorage();
+ try {
+ setActivePinia(createPinia());
+ const store = useConnectionStore();
+ await store.initFromDisk();
+ const existingSnapshot = JSON.parse(JSON.stringify(store.connections[0]));
+ const content = JSON.stringify({
+ format: "rdm-import",
+ content: JSON.stringify([
+ {
+ type: "group",
+ name: "Redis",
+ connections: [
+ { host: "cache.example.test", name: "Selected", auth: " password ", username: "acl-user", ssl: true, ssl_ca_cert_path: "/ca.pem", ssh_host: "jump.example.test", ssh_user: "operator", ssh_password: "ssh-password" },
+ { host: "unselected.example.test", name: "Unselected" },
+ ],
+ },
+ ]),
+ });
+ const preview = await store.parseConnectionsImport(content, null);
+ assert.equal(store.connections.length, 1);
+ assert.equal(preview.connections.length, 2);
+ const selected = preview.connections.find((item) => item.name === "Selected")!;
+ const result = await store.applyConnectionsImport(preview, [selected.id]);
+ assert.equal(result.count, 1);
+ if (result.layout) store.applySidebarLayout(result.layout);
+ assert.equal(store.connections.length, 2);
+ assert.deepEqual(JSON.parse(JSON.stringify(store.connections.find((item) => item.id === existing.id))), existingSnapshot);
+ const imported = store.connections.find((item) => item.name === "Selected")!;
+ assert.equal(imported.password, " password ");
+ assert.equal(imported.username, "acl-user");
+ assert.equal(imported.ca_cert_path, "/ca.pem");
+ assert.equal(imported.transport_layers?.[0]?.type, "ssh");
+ assert.equal(backend.state.connections.find((item) => item.id === imported.id)?.password, " password ");
+ assert.ok(!JSON.stringify(result.layout).includes(preview.connections.find((item) => item.name === "Unselected")!.id));
+ assert.ok(outline(store.treeNodes).includes("Redis/Selected"));
+ await assert.rejects(store.parseConnectionsImport(JSON.stringify({ format: "rdm-import", content: "[{}]" }), null), /RedisDesktopManager/);
+ assert.equal(store.connections.length, 2);
+ } finally {
+ storage.restore();
+ backend.restore();
+ }
+});
+
test("plain legacy dbx config still imports a selected subset", async () => {
const backend = installBackend([], null);
const storage = installMemoryStorage();