feat(kafka): support Kafka MQ admin client
This commit is contained in:
1 parent
3e7cf30ce5
commit
7cec4892bf
43 files changed
+4281
-186
No files matched your search
@@ -11,12 +11,14 @@ function agentDriverInstallKey(dbType: DatabaseType | undefined, driverProfile?:
|
||||
if (dbType === "oracle") return "oracle";
|
||||
if (dbType === "mongodb") return "mongodb";
|
||||
if (dbType === "dameng") return "dameng";
|
||||
if (dbType === "mq") return driverProfile === "kafka" ? "kafka" : undefined;
|
||||
return driverProfile && driverProfile !== dbType ? driverProfile : dbType;
|
||||
}
|
||||
|
||||
export function showAgentDriverInstallHint(dbType: DatabaseType | undefined, drivers: readonly AgentDriverInstallState[], driverProfile?: string): boolean {
|
||||
if (!supportsDriverManagement(dbType)) return false;
|
||||
const driverKey = agentDriverInstallKey(dbType, driverProfile);
|
||||
if (!driverKey) return false;
|
||||
return drivers.find((driver) => driver.db_type === driverKey)?.installed !== true;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,9 @@ export const mqListPermissions = forward("mqListPermissions");
|
||||
export const mqIssueToken = forward("mqIssueToken");
|
||||
export const mqListTokenRecords = forward("mqListTokenRecords");
|
||||
export const mqGetBacklog = forward("mqGetBacklog");
|
||||
export const mqGetClusterInfo = forward("mqGetClusterInfo");
|
||||
export const mqRawRequest = forward("mqRawRequest");
|
||||
export const mqSendMessage = forward("mqSendMessage");
|
||||
|
||||
// MongoDB
|
||||
export const mongoListDatabases = forward("mongoListDatabases");
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { apiUrl } from "@/lib/webPath";
|
||||
import type {
|
||||
MqClusterInfo,
|
||||
ClusterInfo,
|
||||
TenantInfo,
|
||||
TenantConfig,
|
||||
NamespaceRef,
|
||||
@@ -31,6 +32,8 @@ import type {
|
||||
PeekedMessage,
|
||||
MqRawRequest,
|
||||
MqRawResponse,
|
||||
SendMessageRequest,
|
||||
SendMessageResponse,
|
||||
} from "@/types/mq";
|
||||
|
||||
async function post<T>(path: string, body: unknown): Promise<T> {
|
||||
@@ -202,6 +205,14 @@ export async function mqGetBacklog(connectionId: string, topic: TopicRef, sub?:
|
||||
return post("/api/mq/monitoring/backlog", { connectionId, topic, sub });
|
||||
}
|
||||
|
||||
export async function mqGetClusterInfo(connectionId: string): Promise<ClusterInfo> {
|
||||
return post("/api/mq/monitoring/cluster-info", { connectionId });
|
||||
}
|
||||
|
||||
export async function mqRawRequest(connectionId: string, req: MqRawRequest): Promise<MqRawResponse> {
|
||||
return post("/api/mq/raw", { connectionId, req });
|
||||
}
|
||||
|
||||
export async function mqSendMessage(connectionId: string, req: SendMessageRequest): Promise<SendMessageResponse> {
|
||||
return post("/api/mq/send-message", { connectionId, req });
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import type {
|
||||
MqClusterInfo,
|
||||
ClusterInfo,
|
||||
TenantInfo,
|
||||
TenantConfig,
|
||||
NamespaceRef,
|
||||
@@ -31,6 +32,8 @@ import type {
|
||||
PeekedMessage,
|
||||
MqRawRequest,
|
||||
MqRawResponse,
|
||||
SendMessageRequest,
|
||||
SendMessageResponse,
|
||||
} from "@/types/mq";
|
||||
|
||||
// Connectivity
|
||||
@@ -198,7 +201,15 @@ export async function mqGetBacklog(connectionId: string, topic: TopicRef, sub?:
|
||||
return invoke("mq_get_backlog", { connectionId, topic, sub });
|
||||
}
|
||||
|
||||
export async function mqGetClusterInfo(connectionId: string): Promise<ClusterInfo> {
|
||||
return invoke("mq_get_cluster_info", { connectionId });
|
||||
}
|
||||
|
||||
// Raw request
|
||||
export async function mqRawRequest(connectionId: string, req: MqRawRequest): Promise<MqRawResponse> {
|
||||
return invoke("mq_raw_request", { connectionId, req });
|
||||
}
|
||||
|
||||
export async function mqSendMessage(connectionId: string, req: SendMessageRequest): Promise<SendMessageResponse> {
|
||||
return invoke("mq_send_message", { connectionId, req });
|
||||
}
|
||||
@@ -35,6 +35,7 @@ export interface SavedOpenTab {
|
||||
pinned?: boolean;
|
||||
mode?: QueryTab["mode"];
|
||||
mqTenant?: string;
|
||||
mqInitialTab?: QueryTab["mqInitialTab"];
|
||||
nacosNamespace?: string;
|
||||
nacosNamespaceName?: string;
|
||||
structureTableName?: string;
|
||||
@@ -84,6 +85,7 @@ export function serializeOpenTabs(tabs: QueryTab[]): SavedOpenTab[] {
|
||||
pinned: tab.pinned,
|
||||
mode: tab.mode,
|
||||
...(tab.mqTenant !== undefined ? { mqTenant: tab.mqTenant } : {}),
|
||||
...(tab.mqInitialTab !== undefined ? { mqInitialTab: tab.mqInitialTab } : {}),
|
||||
...(tab.nacosNamespace !== undefined ? { nacosNamespace: tab.nacosNamespace } : {}),
|
||||
...(tab.nacosNamespaceName !== undefined ? { nacosNamespaceName: tab.nacosNamespaceName } : {}),
|
||||
...(tab.structureTableName !== undefined ? { structureTableName: tab.structureTableName } : {}),
|
||||
|
||||
Reference in new issue
Block a user