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:
@@ -633,7 +633,8 @@
|
|||||||
<div id="executions" class="tab-content">
|
<div id="executions" class="tab-content">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3>Execution History</h3>
|
<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 id="executionList"><div class="loading">Loading...</div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -834,6 +835,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
async function executeWorkflow(workflowId, name) {
|
||||||
if (!confirm(`Execute workflow: ${name}?`)) return;
|
if (!confirm(`Execute workflow: ${name}?`)) return;
|
||||||
|
|
||||||
|
|||||||
10
server.js
10
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)
|
// Health check (no auth required)
|
||||||
app.get('/health', async (req, res) => {
|
app.get('/health', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user