diff --git a/public/index.html b/public/index.html index 3144c26..debb6a9 100644 --- a/public/index.html +++ b/public/index.html @@ -810,18 +810,18 @@ executions.slice(0, 5).map(e => `
${e.status} - ${e.workflow_name || 'Unknown Workflow'} + ${e.workflow_name || '[Quick Command]'}
by ${e.started_by} at ${new Date(e.started_at).toLocaleString()}
`).join(''); document.getElementById('dashExecutions').innerHTML = dashHtml; - + const fullHtml = executions.length === 0 ? '
No executions yet
' : executions.map(e => `
${e.status} - ${e.workflow_name || 'Unknown Workflow'} + ${e.workflow_name || '[Quick Command]'}
Started by ${e.started_by} at ${new Date(e.started_at).toLocaleString()} ${e.completed_at ? ` • Completed at ${new Date(e.completed_at).toLocaleString()}` : ''} diff --git a/server.js b/server.js index 0a07443..a416bf6 100644 --- a/server.js +++ b/server.js @@ -765,13 +765,26 @@ app.post('/api/workers/:id/command', authenticateSSO, async (req, res) => { try { const { command } = req.body; const executionId = generateUUID(); - + const workerId = req.params.id; + + // Create execution record in database + await pool.query( + 'INSERT INTO executions (id, workflow_id, status, started_by, started_at, logs) VALUES (?, ?, ?, ?, NOW(), ?)', + [executionId, null, 'running', req.user.username, JSON.stringify([{ + step: 'quick_command', + action: 'command_sent', + worker_id: workerId, + command: command, + timestamp: new Date().toISOString() + }])] + ); + // Send command via WebSocket const commandMessage = { type: 'execute_command', execution_id: executionId, command: command, - worker_id: req.params.id, + worker_id: workerId, timeout: 60000 }; @@ -781,6 +794,7 @@ app.post('/api/workers/:id/command', authenticateSSO, async (req, res) => { } }); + broadcast({ type: 'execution_started', execution_id: executionId, workflow_id: null }); res.json({ success: true, execution_id: executionId }); } catch (error) { res.status(500).json({ error: error.message });