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(connection): restore New Connection dialog after RabbitMQ

Freedom80bd53b4c2d0
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index 180cbcc5e2..a0b12bb994 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -2202,7 +2202,7 @@ const dbCategoryDefinitions: Array<{
{
key: "mq",
titleKey: "connection.databaseCategoryMq",
- optionValues: ["mq", "kafka", "rocketmq"],
+ optionValues: ["mq", "kafka", "rocketmq", "rabbitmq"],
},
{
key: "registry_config",
diff --git a/packages/app-tests/databaseCategoryOptions.test.ts b/packages/app-tests/databaseCategoryOptions.test.ts
index 4ef5c18d54..53bae10f0d 100644
--- a/packages/app-tests/databaseCategoryOptions.test.ts
+++ b/packages/app-tests/databaseCategoryOptions.test.ts
@@ -1,4 +1,7 @@
import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import { dirname, join } from "node:path";
import { test } from "vitest";
import { assertCompleteDatabaseCategories, databaseSelectionForCategory } from "../../apps/desktop/src/lib/connection/databaseCategoryOptions.ts";
@@ -14,3 +17,21 @@ test("database category changes keep only visible selections", () => {
assert.equal(databaseSelectionForCategory("mysql", ["questdb", "tdengine"]), "questdb");
assert.equal(databaseSelectionForCategory("mysql", []), undefined);
});
+
+test("ConnectionDialog database categories stay exhaustive", () => {
+ const dialogPath = join(dirname(fileURLToPath(import.meta.url)), "../../apps/desktop/src/components/connection/ConnectionDialog.vue");
+ const source = readFileSync(dialogPath, "utf8");
+ const optionsMatch = source.match(/const dbOptions: DbOption\[] = \[([\s\S]*?)\];/);
+ const categoriesMatch = source.match(/const dbCategoryDefinitions: Array<\{[\s\S]*?\}> = \[([\s\S]*?)\];/);
+ assert.ok(optionsMatch, "dbOptions not found");
+ assert.ok(categoriesMatch, "dbCategoryDefinitions not found");
+
+ const optionValues = [...optionsMatch[1].matchAll(/value:\s*"([^"]+)"/g)].map((match) => match[1]);
+ const categoryBlocks = [...categoriesMatch[1].matchAll(/optionValues:\s*\[([^\]]*)\]/g)].map((match) =>
+ [...match[1].matchAll(/"([^"]+)"/g)].map((valueMatch) => valueMatch[1]),
+ );
+
+ assert.doesNotThrow(() => assertCompleteDatabaseCategories(optionValues, categoryBlocks));
+ assert.ok(optionValues.includes("rabbitmq"), "rabbitmq must remain in dbOptions");
+ assert.ok(categoryBlocks.some((values) => values.includes("rabbitmq")), "rabbitmq must remain categorized");
+});