fix(mq): hide database browser for message queue connections

This commit is contained in:
onenewcode
2026-09-09 12:04:10 +08:00
committed by GitHub
parent 047cf96f8e
commit 08edb60772
2 changed files with 18 additions and 1 deletions
@@ -57,6 +57,17 @@ describe("connection database browser", () => {
expect(supportsConnectionDatabaseBrowser("redis")).toBe(false);
expect(supportsConnectionDatabaseBrowser("mongodb")).toBe(false);
});
it("hides the browse-databases entry for message brokers", () => {
// Kafka/Pulsar/RocketMQ/RabbitMQ/NATS all share db_type "mq" and differ only by
// driver_profile, so one exclusion covers every broker. They keep the
// objectBrowser capability for the tenant/topic tree, but have no database
// namespace, so the connection-level browser tab rendered an empty
// "no databases found" state (issue #8515). MQTT never had the entry.
expect(supportsObjectBrowser("mq")).toBe(true);
expect(supportsConnectionDatabaseBrowser("mq")).toBe(false);
expect(supportsConnectionDatabaseBrowser("mqtt")).toBe(false);
});
});
describe("object browser tree nodes", () => {
@@ -228,7 +228,13 @@ export function supportsObjectBrowser(dbType?: DatabaseType): boolean {
export function supportsConnectionDatabaseBrowser(dbType?: DatabaseType): boolean {
// MongoDB reuses the object browser for collections, not the SQL database list.
return supportsObjectBrowser(dbType) && dbType !== "mongodb";
//
// Message brokers (`mq` — Kafka/Pulsar/RocketMQ/RabbitMQ/NATS, separated only by
// driver_profile) keep the objectBrowser capability for their tenant/topic tree,
// but they expose no database namespace: the connection-level browser tab listed
// nothing and rendered "no databases found" (issue #8515). Their workbench is the
// MQ admin tab instead. MQTT is already excluded: it has no objectBrowser at all.
return supportsObjectBrowser(dbType) && dbType !== "mongodb" && dbType !== "mq";
}
export function supportsObjectBrowserTreeNode(dbType: DatabaseType | undefined, nodeType: TreeNodeType): boolean {