mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: implement CodexLens watcher status handling and UI updates
This commit is contained in:
@@ -455,6 +455,23 @@ function handleNotification(data) {
|
||||
console.log('[CodexLens] Index progress:', payload.stage, payload.percent + '%');
|
||||
break;
|
||||
|
||||
case 'CODEXLENS_WATCHER_STATUS':
|
||||
// Handle CodexLens file watcher status updates
|
||||
if (typeof handleWatcherStatusUpdate === 'function') {
|
||||
handleWatcherStatusUpdate(payload);
|
||||
}
|
||||
if (payload.error) {
|
||||
console.error('[CodexLens] Watcher error:', payload.error);
|
||||
if (typeof showRefreshToast === 'function') {
|
||||
showRefreshToast('Watcher error: ' + payload.error, 'error');
|
||||
}
|
||||
} else if (payload.running) {
|
||||
console.log('[CodexLens] Watcher running:', payload.path);
|
||||
} else {
|
||||
console.log('[CodexLens] Watcher stopped');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('[WS] Unknown notification type:', type);
|
||||
}
|
||||
|
||||
@@ -4783,3 +4783,33 @@ function closeWatcherModal() {
|
||||
var modal = document.getElementById('watcherControlModal');
|
||||
if (modal) modal.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle watcher status update from WebSocket
|
||||
* @param {Object} payload - { running: boolean, path?: string, error?: string }
|
||||
*/
|
||||
function handleWatcherStatusUpdate(payload) {
|
||||
var toggle = document.getElementById('watcherToggle');
|
||||
var statsDiv = document.getElementById('watcherStats');
|
||||
var configDiv = document.getElementById('watcherStartConfig');
|
||||
|
||||
if (payload.error) {
|
||||
// Watcher failed - update UI to show stopped state
|
||||
if (toggle) toggle.checked = false;
|
||||
if (statsDiv) statsDiv.style.display = 'none';
|
||||
if (configDiv) configDiv.style.display = 'block';
|
||||
stopWatcherStatusPolling();
|
||||
} else if (payload.running) {
|
||||
// Watcher started
|
||||
if (toggle) toggle.checked = true;
|
||||
if (statsDiv) statsDiv.style.display = 'block';
|
||||
if (configDiv) configDiv.style.display = 'none';
|
||||
startWatcherStatusPolling();
|
||||
} else {
|
||||
// Watcher stopped normally
|
||||
if (toggle) toggle.checked = false;
|
||||
if (statsDiv) statsDiv.style.display = 'none';
|
||||
if (configDiv) configDiv.style.display = 'block';
|
||||
stopWatcherStatusPolling();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user