From 095bfb65ab3dd6e420d6f17c3eecddd09c53e4a7 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 7 Jan 2026 22:55:13 -0500 Subject: [PATCH] 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 --- public/index.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index bcc6a74..5783a07 100644 --- a/public/index.html +++ b/public/index.html @@ -1094,8 +1094,9 @@ if (!confirm('Delete all completed and failed executions?')) return; try { - const response = await fetch('/api/executions'); - const executions = await response.json(); + const response = await fetch('/api/executions?limit=1000'); // Get all executions + 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'); @@ -1104,15 +1105,17 @@ return; } + let deleted = 0; 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(); } catch (error) { console.error('Error clearing executions:', error); - alert('Error clearing executions'); + showTerminalNotification('Error clearing executions', 'error'); } }