feat(kafka): support Kafka MQ admin client

This commit is contained in:
miracle authored and GitHub committed 2026-06-30 17:01:24 +08:00
1 parent 3e7cf30ce5
commit 7cec4892bf
43 files changed
+4281 -186

No files matched your search

+30 -12
View File
@@ -1589,18 +1589,36 @@ export const useConnectionStore = defineStore("connection", () => {
await ensureConnected(connectionId);
if (useCachedChildren(node, options)) return;
const tenants = await withMetadataLoadTimeout(connectionId, api.mqListTenants(connectionId), "message queue tenants");
const tenantNames = sortSidebarNames(tenants.map((tenant) => tenant.name).filter((name) => !!name.trim()));
setChildren(
node,
tenantNames.map((tenant) => ({
id: schemaCacheKey(connectionId, "mq-tenant", tenant),
label: tenant,
type: "mq-tenant" as const,
connectionId,
mqTenant: tenant,
})),
);
const config = getConfig(connectionId);
const isKafka = config?.driver_profile === "kafka";
if (isKafka) {
// Kafka has no tenant/namespace concept. Create a synthetic child
// that opens the MQ admin console directly when clicked.
setChildren(node, [
{
id: schemaCacheKey(connectionId, "mq-tenant", "_kafka"),
label: "Topics",
type: "mq-tenant" as const,
connectionId,
mqTenant: "_kafka",
mqInitialTab: "topics",
},
]);
} else {
const tenants = await withMetadataLoadTimeout(connectionId, api.mqListTenants(connectionId), "message queue tenants");
const tenantNames = sortSidebarNames(tenants.map((tenant) => tenant.name).filter((name) => !!name.trim()));
setChildren(
node,
tenantNames.map((tenant) => ({
id: schemaCacheKey(connectionId, "mq-tenant", tenant),
label: tenant,
type: "mq-tenant" as const,
connectionId,
mqTenant: tenant,
})),
);
}
node.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e);