feat: CLI SUBSCRIBE/MONITOR streaming mode
- New pubsub.ts: startSubscribe/stopSubscribe/startMonitor/stopMonitor - IPC: redis:subscribe, redis:unsubscribe, redis:monitor, redis:monitorStop - Streaming messages pushed via webContents.send - Preload: onSubscribeMessage/onMonitorMessage callbacks - CliView: detect SUBSCRIBE/PSUBSCRIBE/MONITOR, switch to streaming mode - Stop button with pulsing indicator (green=subscribe, yellow=monitor) - Real-time message display with timestamps - Auto-cleanup on unmount - i18n keys (zh-CN + en)
This commit is contained in:
@@ -239,4 +239,30 @@ export function registerIpcHandlers(): void {
|
||||
ipcMain.handle('redis:clearCommandLog', () => {
|
||||
redis.clearLog()
|
||||
})
|
||||
|
||||
// Pub/Sub
|
||||
ipcMain.handle('redis:subscribe', async (_e, id: string, channels: string[], isPattern: boolean) => {
|
||||
try {
|
||||
redis.startSubscribe(id, channels, isPattern, _e.sender)
|
||||
return { success: true }
|
||||
} catch (err: any) {
|
||||
return { success: false, error: err.message }
|
||||
}
|
||||
})
|
||||
ipcMain.handle('redis:unsubscribe', async (_e, id: string) => {
|
||||
redis.stopSubscribe(id)
|
||||
})
|
||||
|
||||
// Monitor
|
||||
ipcMain.handle('redis:monitor', async (_e, id: string) => {
|
||||
try {
|
||||
redis.startMonitor(id, _e.sender)
|
||||
return { success: true }
|
||||
} catch (err: any) {
|
||||
return { success: false, error: err.message }
|
||||
}
|
||||
})
|
||||
ipcMain.handle('redis:monitorStop', async (_e, id: string) => {
|
||||
redis.stopMonitor(id)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user