Remove unused legacy monitor helpers
This commit is contained in:
@@ -39,46 +39,6 @@ export namespace WebSocketApi {
|
||||
heartbeatInterval?: number;
|
||||
}
|
||||
|
||||
/** 监控数据类型 */
|
||||
export interface MonitorMessage {
|
||||
type:
|
||||
| 'get_overview'
|
||||
| 'get_realtime'
|
||||
| 'set_interval'
|
||||
| 'start_monitor'
|
||||
| 'stop_monitor'
|
||||
| 'test_connection';
|
||||
interval?: number;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
/** 服务器监控数据 */
|
||||
export interface ServerMonitorData {
|
||||
basic_info?: any;
|
||||
cpu_info?: any;
|
||||
memory_info?: any;
|
||||
disk_info?: any;
|
||||
network_info?: any;
|
||||
process_info?: any;
|
||||
system_load?: any;
|
||||
boot_time?: any;
|
||||
users_info?: any;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
/** Redis监控数据 */
|
||||
export interface RedisMonitorData {
|
||||
connection_id?: string;
|
||||
connection_name?: string;
|
||||
status?: string;
|
||||
info?: any;
|
||||
memory?: any;
|
||||
stats?: any;
|
||||
keyspace?: any[];
|
||||
clients?: any[];
|
||||
slow_log?: any[];
|
||||
timestamp?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,7 +390,7 @@ export function createWebSocket(
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建测试WebSocket连接
|
||||
* Create test WebSocket connection
|
||||
*/
|
||||
export function createTestWebSocket(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
@@ -439,7 +399,7 @@ export function createTestWebSocket(
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建通知WebSocket连接
|
||||
* Create notification WebSocket connection
|
||||
*/
|
||||
export function createNotificationWebSocket(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
@@ -448,197 +408,10 @@ export function createNotificationWebSocket(
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建服务器监控WebSocket连接
|
||||
*/
|
||||
export function createServerMonitorWebSocket(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): WebSocketManager {
|
||||
return createWebSocket('/ws/server-monitor/', callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建Redis监控WebSocket连接
|
||||
*/
|
||||
export function createRedisMonitorWebSocket(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): WebSocketManager {
|
||||
return createWebSocket('/ws/redis-monitor/', callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据库监控WebSocket连接
|
||||
*/
|
||||
export function createDatabaseMonitorWebSocket(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): WebSocketManager {
|
||||
return createWebSocket('/ws/database-monitor/', callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 监控WebSocket管理器类
|
||||
*/
|
||||
export class MonitorWebSocketManager extends WebSocketManager {
|
||||
/**
|
||||
* 获取概览信息
|
||||
*/
|
||||
getOverview(): boolean {
|
||||
return this.send({
|
||||
type: 'get_overview',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实时统计
|
||||
*/
|
||||
getRealtime(): boolean {
|
||||
return this.send({
|
||||
type: 'get_realtime',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始监控
|
||||
*/
|
||||
startMonitoring(): boolean {
|
||||
return this.send({
|
||||
type: 'start_monitor',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止监控
|
||||
*/
|
||||
stopMonitoring(): boolean {
|
||||
return this.send({
|
||||
type: 'stop_monitor',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接(适用于Redis监控)
|
||||
*/
|
||||
testConnection(): boolean {
|
||||
return this.send({
|
||||
type: 'test_connection',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建服务器监控WebSocket管理器
|
||||
*/
|
||||
export function createServerMonitorManager(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): MonitorWebSocketManager {
|
||||
const wsManager = createServerMonitorWebSocket(callbacks);
|
||||
// 创建增强版管理器
|
||||
return Object.setPrototypeOf(wsManager, MonitorWebSocketManager.prototype);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建Redis监控WebSocket管理器
|
||||
*/
|
||||
export function createRedisMonitorManager(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): MonitorWebSocketManager {
|
||||
const wsManager = createRedisMonitorWebSocket(callbacks);
|
||||
// 创建增强版管理器
|
||||
return Object.setPrototypeOf(wsManager, MonitorWebSocketManager.prototype);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库监控WebSocket管理器类
|
||||
*/
|
||||
export class DatabaseMonitorWebSocketManager extends WebSocketManager {
|
||||
/**
|
||||
* 获取数据库配置列表
|
||||
*/
|
||||
getConfigs(): boolean {
|
||||
return this.send({
|
||||
type: 'get_configs',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取概览信息
|
||||
*/
|
||||
getOverview(dbName: string): boolean {
|
||||
return this.send({
|
||||
type: 'get_overview',
|
||||
db_name: dbName,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实时统计
|
||||
*/
|
||||
getRealtime(dbName: string): boolean {
|
||||
return this.send({
|
||||
type: 'get_realtime',
|
||||
db_name: dbName,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始监控
|
||||
*/
|
||||
startMonitoring(dbName: string): boolean {
|
||||
return this.send({
|
||||
type: 'start_monitor',
|
||||
db_name: dbName,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止监控
|
||||
*/
|
||||
stopMonitoring(): boolean {
|
||||
return this.send({
|
||||
type: 'stop_monitor',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
testConnection(dbName: string): boolean {
|
||||
return this.send({
|
||||
type: 'test_connection',
|
||||
db_name: dbName,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建聊天WebSocket连接
|
||||
* Create chat WebSocket connection
|
||||
*/
|
||||
export function createChatWebSocket(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): WebSocketManager {
|
||||
return createWebSocket('/ws/chat/', callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据库监控WebSocket管理器
|
||||
*/
|
||||
export function createDatabaseMonitorManager(
|
||||
callbacks?: WebSocketApi.WebSocketCallbacks,
|
||||
): DatabaseMonitorWebSocketManager {
|
||||
const wsManager = createDatabaseMonitorWebSocket(callbacks);
|
||||
// 创建增强版管理器
|
||||
return Object.setPrototypeOf(
|
||||
wsManager,
|
||||
DatabaseMonitorWebSocketManager.prototype,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user