diff --git a/public/index.html b/public/index.html
index debb6a9..e07db63 100644
--- a/public/index.html
+++ b/public/index.html
@@ -633,7 +633,8 @@
Execution History
-
+
+
@@ -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!');
diff --git a/server.js b/server.js
index 61b4a19..bd0bce4 100644
--- a/server.js
+++ b/server.js
@@ -418,6 +418,16 @@ app.get('/api/executions', authenticateSSO, async (req, res) => {
}
});
+app.delete('/api/executions/:id', authenticateSSO, async (req, res) => {
+ try {
+ await pool.query('DELETE FROM executions WHERE id = ?', [req.params.id]);
+ broadcast({ type: 'execution_deleted', execution_id: req.params.id });
+ res.json({ success: true });
+ } catch (error) {
+ res.status(500).json({ error: error.message });
+ }
+});
+
// Health check (no auth required)
app.get('/health', async (req, res) => {
try {