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:
Frederico Castro
2026-02-28 00:03:44 -03:00
parent 275d74b18c
commit d662860c61
5 changed files with 39 additions and 2 deletions

View File

@@ -481,6 +481,10 @@
<span class="ws-indicator ws-indicator--disconnected" id="terminal-ws-dot"></span>
<span id="terminal-ws-label">Desconectado</span>
</div>
<button class="btn btn--danger btn--sm btn--icon-text" type="button" id="terminal-stop-btn" aria-label="Interromper execução" hidden>
<i data-lucide="square"></i>
<span>Interromper</span>
</button>
<button class="btn btn--ghost btn--sm btn--icon-text" type="button" id="terminal-clear-btn" aria-label="Limpar terminal">
<i data-lucide="trash-2"></i>
<span>Limpar</span>

View File

@@ -118,6 +118,7 @@ const API = {
status() { return API.request('GET', '/system/status'); },
info() { return API.request('GET', '/system/info'); },
activeExecutions() { return API.request('GET', '/executions/active'); },
cancelAll() { return API.request('POST', '/executions/cancel-all'); },
},
settings: {

View File

@@ -555,6 +555,18 @@ const App = {
on('pipeline-execute-submit', 'click', () => PipelinesUI._executeFromModal());
on('terminal-stop-btn', 'click', async () => {
try {
await API.system.cancelAll();
Terminal.stopProcessing();
Terminal.addLine('Todas as execuções foram interrompidas.', 'error');
Toast.warning('Execuções interrompidas');
App._updateActiveBadge();
} catch (err) {
Toast.error(`Erro ao interromper: ${err.message}`);
}
});
on('terminal-clear-btn', 'click', () => {
Terminal.clear();
Terminal.disableChat();
@@ -960,6 +972,9 @@ const App = {
if (countEl) countEl.textContent = count;
if (badge) badge.style.display = count > 0 ? 'flex' : 'none';
const stopBtn = document.getElementById('terminal-stop-btn');
if (stopBtn) stopBtn.hidden = count === 0;
const terminalSelect = document.getElementById('terminal-execution-select');
if (terminalSelect && Array.isArray(active)) {
const existing = new Set(

View File

@@ -102,7 +102,7 @@ const HistoryUI = {
<i data-lucide="eye"></i>
Ver detalhes
</button>
${(exec.status === 'error' && exec.type === 'pipeline' && exec.failedAtStep !== undefined) ? `
${(exec.status === 'error' && exec.type === 'pipeline') ? `
<button class="btn btn-ghost btn-sm" data-action="resume-pipeline" data-id="${exec.id}" type="button" title="Retomar do passo ${(exec.failedAtStep || 0) + 1}">
<i data-lucide="play"></i>
Retomar