mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-02 02:34:42 +08:00
fix(mq): hide database browser for message queue connections
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user