Fix clearCompletedExecutions for new pagination API format
Changes: - Handle new pagination response format (data.executions vs data) - Request up to 1000 executions to ensure all are checked - Track successful deletions count - Use terminal notification instead of alert - Better error handling for individual delete failures Fixes regression from Phase 5 pagination changes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1094,8 +1094,9 @@
|
|||||||
if (!confirm('Delete all completed and failed executions?')) return;
|
if (!confirm('Delete all completed and failed executions?')) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/executions');
|
const response = await fetch('/api/executions?limit=1000'); // Get all executions
|
||||||
const executions = await response.json();
|
const data = await response.json();
|
||||||
|
const executions = data.executions || data; // Handle new pagination format
|
||||||
|
|
||||||
const toDelete = executions.filter(e => e.status === 'completed' || e.status === 'failed');
|
const toDelete = executions.filter(e => e.status === 'completed' || e.status === 'failed');
|
||||||
|
|
||||||
@@ -1104,15 +1105,17 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let deleted = 0;
|
||||||
for (const execution of toDelete) {
|
for (const execution of toDelete) {
|
||||||
await fetch(`/api/executions/${execution.id}`, { method: 'DELETE' });
|
const deleteResponse = await fetch(`/api/executions/${execution.id}`, { method: 'DELETE' });
|
||||||
|
if (deleteResponse.ok) deleted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert(`Deleted ${toDelete.length} execution(s)`);
|
showTerminalNotification(`Deleted ${deleted} execution(s)`, 'success');
|
||||||
refreshData();
|
refreshData();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error clearing executions:', error);
|
console.error('Error clearing executions:', error);
|
||||||
alert('Error clearing executions');
|
showTerminalNotification('Error clearing executions', 'error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user