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:
@@ -119,6 +119,22 @@ const electronAPI = {
|
||||
ipcRenderer.invoke('redis:getCommandLog'),
|
||||
clearCommandLog: (): Promise<void> =>
|
||||
ipcRenderer.invoke('redis:clearCommandLog'),
|
||||
// Pub/Sub
|
||||
subscribe: (id: string, channels: string[], isPattern: boolean): Promise<any> =>
|
||||
ipcRenderer.invoke('redis:subscribe', id, channels, isPattern),
|
||||
unsubscribe: (id: string): Promise<void> =>
|
||||
ipcRenderer.invoke('redis:unsubscribe', id),
|
||||
onSubscribeMessage: (callback: (msg: any) => void) => {
|
||||
ipcRenderer.on('redis:subscribeMessage', (_e, msg) => callback(msg))
|
||||
},
|
||||
// Monitor
|
||||
monitor: (id: string): Promise<any> =>
|
||||
ipcRenderer.invoke('redis:monitor', id),
|
||||
monitorStop: (id: string): Promise<void> =>
|
||||
ipcRenderer.invoke('redis:monitorStop', id),
|
||||
onMonitorMessage: (callback: (msg: any) => void) => {
|
||||
ipcRenderer.on('redis:monitorMessage', (_e, msg) => callback(msg))
|
||||
},
|
||||
},
|
||||
updater: {
|
||||
check: (): Promise<any> => ipcRenderer.invoke('updater:check'),
|
||||
|
||||
Reference in New Issue
Block a user