fix(zookeeper): open new queries in key browser
This commit is contained in:
3 files changed
+51
-1
No files matched your search
@@ -28,6 +28,14 @@ describe("quickConnectionOpenTarget", () => {
|
||||
expect(quickConnectionOpenTarget(connection("nacos"))).toEqual({ kind: "nacos-admin" });
|
||||
});
|
||||
|
||||
it("opens Etcd connections in the key browser", () => {
|
||||
expect(quickConnectionOpenTarget(connection("etcd"))).toEqual({ kind: "etcd" });
|
||||
});
|
||||
|
||||
it("opens ZooKeeper connections in the key browser", () => {
|
||||
expect(quickConnectionOpenTarget(connection("zookeeper"))).toEqual({ kind: "zookeeper" });
|
||||
});
|
||||
|
||||
it("opens regular connections in a query tab", () => {
|
||||
expect(quickConnectionOpenTarget({ ...connection("postgresql"), database: "app" })).toEqual({
|
||||
kind: "query",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ConnectionConfig } from "@/types/database";
|
||||
import { resolveDefaultDatabase } from "@/lib/database/defaultDatabase";
|
||||
|
||||
export type QuickConnectionOpenTarget = { kind: "mq-admin" } | { kind: "nacos-admin" } | { kind: "query"; database: string };
|
||||
export type QuickConnectionOpenTarget = { kind: "mq-admin" } | { kind: "nacos-admin" } | { kind: "etcd" } | { kind: "zookeeper" } | { kind: "query"; database: string };
|
||||
|
||||
export function quickConnectionOpenTarget(connection: Pick<ConnectionConfig, "db_type" | "database">, databaseOptions: string[] = []): QuickConnectionOpenTarget {
|
||||
if (connection.db_type === "mq") {
|
||||
@@ -10,5 +10,11 @@ export function quickConnectionOpenTarget(connection: Pick<ConnectionConfig, "db
|
||||
if (connection.db_type === "nacos") {
|
||||
return { kind: "nacos-admin" };
|
||||
}
|
||||
if (connection.db_type === "etcd") {
|
||||
return { kind: "etcd" };
|
||||
}
|
||||
if (connection.db_type === "zookeeper") {
|
||||
return { kind: "zookeeper" };
|
||||
}
|
||||
return { kind: "query", database: resolveDefaultDatabase(connection, databaseOptions) };
|
||||
}
|
||||
Reference in new issue
Block a user