Adicionar botão Interromper no terminal e corrigir botão Retomar
- Botão Interromper na toolbar do terminal para matar execuções ativas - Endpoint POST /executions/cancel-all para cancelar agentes e pipelines - Botão aparece/esconde automaticamente conforme execuções ativas - Corrigir condição do botão Retomar para pipelines antigas sem failedAtStep
This commit is contained in:
@@ -8,7 +8,7 @@ import * as manager from '../agents/manager.js';
|
||||
import { tasksStore, settingsStore, executionsStore, webhooksStore, notificationsStore, secretsStore, agentVersionsStore } from '../store/db.js';
|
||||
import * as scheduler from '../agents/scheduler.js';
|
||||
import * as pipeline from '../agents/pipeline.js';
|
||||
import { getBinPath, updateMaxConcurrent } from '../agents/executor.js';
|
||||
import { getBinPath, updateMaxConcurrent, cancelAllExecutions, getActiveExecutions } from '../agents/executor.js';
|
||||
import { invalidateAgentMapCache } from '../agents/pipeline.js';
|
||||
import { cached } from '../cache/index.js';
|
||||
import { readdirSync, readFileSync, unlinkSync, existsSync, mkdirSync } from 'fs';
|
||||
@@ -838,6 +838,23 @@ router.get('/executions/active', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/executions/cancel-all', (req, res) => {
|
||||
try {
|
||||
const activePipelines = pipeline.getActivePipelines();
|
||||
for (const p of activePipelines) {
|
||||
pipeline.cancelPipeline(p.pipelineId);
|
||||
}
|
||||
cancelAllExecutions();
|
||||
const running = executionsStore.getAll().filter(e => e.status === 'running' || e.status === 'awaiting_approval');
|
||||
for (const e of running) {
|
||||
executionsStore.update(e.id, { status: 'canceled', endedAt: new Date().toISOString() });
|
||||
}
|
||||
res.json({ cancelled: true });
|
||||
} catch (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/executions/recent', (req, res) => {
|
||||
try {
|
||||
const limit = parseInt(req.query.limit) || 20;
|
||||
|
||||
Reference in New Issue
Block a user