Add execution cleanup functionality

Changes:
- Added DELETE /api/executions/:id endpoint
- Added "Clear Completed" button to Executions tab
- Deletes all completed and failed executions
- Broadcasts execution_deleted event to update all clients
- Shows count of deleted executions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-07 22:36:51 -05:00
parent e13fe9d22f
commit 7656f4a151
2 changed files with 40 additions and 3 deletions

View File

@@ -633,7 +633,8 @@
<div id="executions" class="tab-content">
<div class="card">
<h3>Execution History</h3>
<button onclick="refreshData()">🔄 Refresh</button>
<button onclick="refreshData()">[ 🔄 Refresh ]</button>
<button onclick="clearCompletedExecutions()" style="margin-left: 10px;">[ 🗑️ Clear Completed ]</button>
<div id="executionList"><div class="loading">Loading...</div></div>
</div>
</div>
@@ -834,16 +835,42 @@
}
}
async function clearCompletedExecutions() {
if (!confirm('Delete all completed and failed executions?')) return;
try {
const response = await fetch('/api/executions');
const executions = await response.json();
const toDelete = executions.filter(e => e.status === 'completed' || e.status === 'failed');
if (toDelete.length === 0) {
alert('No completed or failed executions to delete');
return;
}
for (const execution of toDelete) {
await fetch(`/api/executions/${execution.id}`, { method: 'DELETE' });
}
alert(`Deleted ${toDelete.length} execution(s)`);
refreshData();
} catch (error) {
console.error('Error clearing executions:', error);
alert('Error clearing executions');
}
}
async function executeWorkflow(workflowId, name) {
if (!confirm(`Execute workflow: ${name}?`)) return;
try {
const response = await fetch('/api/executions', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ workflow_id: workflowId })
});
if (response.ok) {
const data = await response.json();
alert('Workflow execution started!');