fix(zookeeper): open new queries in key browser

This commit is contained in:
zipg authored and GitHub committed 2026-07-16 17:30:19 +08:00
1 parent badb3b61b9
commit efe883f0d8
3 files changed
+51 -1

No files matched your search

+36
View File
@@ -1131,6 +1131,28 @@ async function newQuery() {
const conn = connectionStore.getConfig(target.connectionId);
if (!conn) return;
connectionStore.activeConnectionId = target.connectionId;
const connectionTarget = quickConnectionOpenTarget(conn);
if (connectionTarget.kind !== "query") {
try {
await connectionStore.ensureConnected(target.connectionId);
if (connectionTarget.kind === "mq-admin") {
queryStore.openMqAdmin(target.connectionId);
} else if (connectionTarget.kind === "nacos-admin") {
await connectionStore.loadNacosNamespaces(target.connectionId);
queryStore.openNacosAdmin(target.connectionId);
} else {
queryStore.createTab(target.connectionId, "", `${conn.name}:keys`, connectionTarget.kind);
}
} catch (e: any) {
toast(
t("connection.connectFailed", {
message: translateBackendError(t, e?.message || String(e)),
}),
5000,
);
}
return;
}
// Prefill the editor with `SELECT * FROM <focused table>` when enabled and a
// table context (active data/structure tab or selected table node) is available.
// Built before createTab so the tab opens with the content directly (no flash).
@@ -1183,6 +1205,20 @@ async function openConnectionQuery(connectionId: string) {
}
return;
}
if (initialTarget.kind === "etcd" || initialTarget.kind === "zookeeper") {
try {
await connectionStore.ensureConnected(connectionId);
queryStore.createTab(connectionId, "", `${connection.name}:keys`, initialTarget.kind);
} catch (e: any) {
toast(
t("connection.connectFailed", {
message: translateBackendError(t, e?.message || String(e)),
}),
5000,
);
}
return;
}
const tabId = queryStore.createTab(connectionId, initialTarget.database);
try {
await connectionStore.ensureConnected(connectionId);