Corrigir E2BIG em pipelines, adicionar diretório de projeto e retomada
This commit is contained in:
@@ -91,6 +91,7 @@ const API = {
|
||||
cancel(id) { return API.request('POST', `/pipelines/${id}/cancel`); },
|
||||
approve(id) { return API.request('POST', `/pipelines/${id}/approve`); },
|
||||
reject(id) { return API.request('POST', `/pipelines/${id}/reject`); },
|
||||
resume(executionId) { return API.request('POST', `/pipelines/resume/${executionId}`); },
|
||||
},
|
||||
|
||||
webhooks: {
|
||||
|
||||
@@ -276,6 +276,7 @@ const App = {
|
||||
|
||||
case 'pipeline_step_start':
|
||||
Terminal.stopProcessing();
|
||||
if (data.resumed) Terminal.addLine('(retomando execução anterior)', 'system');
|
||||
Terminal.addLine(`Pipeline passo ${data.stepIndex + 1}/${data.totalSteps}: Executando agente "${data.agentName}"...`, 'system');
|
||||
Terminal.startProcessing(data.agentName);
|
||||
break;
|
||||
@@ -732,6 +733,7 @@ const App = {
|
||||
case 'view-execution': HistoryUI.viewDetail(id); break;
|
||||
case 'delete-execution': HistoryUI.deleteExecution(id); break;
|
||||
case 'retry': HistoryUI.retryExecution(id); break;
|
||||
case 'resume-pipeline': HistoryUI.resumePipeline(id); break;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -102,6 +102,11 @@ const HistoryUI = {
|
||||
<i data-lucide="eye"></i>
|
||||
Ver detalhes
|
||||
</button>
|
||||
${(exec.status === 'error' && exec.type === 'pipeline' && exec.failedAtStep !== undefined) ? `
|
||||
<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
|
||||
</button>` : ''}
|
||||
${(exec.status === 'error' || exec.status === 'canceled') ? `
|
||||
<button class="btn btn-ghost btn-sm" data-action="retry" data-id="${exec.id}" type="button" title="Reexecutar">
|
||||
<i data-lucide="refresh-cw"></i>
|
||||
@@ -421,6 +426,16 @@ const HistoryUI = {
|
||||
Toast.success('Download iniciado');
|
||||
},
|
||||
|
||||
async resumePipeline(executionId) {
|
||||
try {
|
||||
await API.pipelines.resume(executionId);
|
||||
Toast.info('Pipeline retomado');
|
||||
App.navigateTo('terminal');
|
||||
} catch (err) {
|
||||
Toast.error(`Erro ao retomar pipeline: ${err.message}`);
|
||||
}
|
||||
},
|
||||
|
||||
async retryExecution(id) {
|
||||
try {
|
||||
await API.executions.retry(id);
|
||||
|
||||
@@ -107,6 +107,8 @@ const PipelinesUI = {
|
||||
|
||||
${pipeline.description ? `<p class="agent-description">${Utils.escapeHtml(pipeline.description)}</p>` : ''}
|
||||
|
||||
${pipeline.workingDirectory ? `<div class="pipeline-workdir-badge"><i data-lucide="folder" style="width:12px;height:12px"></i> <code>${Utils.escapeHtml(pipeline.workingDirectory)}</code></div>` : ''}
|
||||
|
||||
<div class="pipeline-flow">
|
||||
${flowHtml || '<span class="agent-description">Nenhum passo configurado</span>'}
|
||||
</div>
|
||||
@@ -133,6 +135,8 @@ const PipelinesUI = {
|
||||
`;
|
||||
},
|
||||
|
||||
_basePath: '/home/projetos/',
|
||||
|
||||
openCreateModal() {
|
||||
PipelinesUI._editingId = null;
|
||||
PipelinesUI._steps = [
|
||||
@@ -152,6 +156,9 @@ const PipelinesUI = {
|
||||
const descEl = document.getElementById('pipeline-description');
|
||||
if (descEl) descEl.value = '';
|
||||
|
||||
const workdirEl = document.getElementById('pipeline-workdir');
|
||||
if (workdirEl) workdirEl.value = PipelinesUI._basePath;
|
||||
|
||||
PipelinesUI.renderSteps();
|
||||
Modal.open('pipeline-modal-overlay');
|
||||
},
|
||||
@@ -183,6 +190,9 @@ const PipelinesUI = {
|
||||
const descEl = document.getElementById('pipeline-description');
|
||||
if (descEl) descEl.value = pipeline.description || '';
|
||||
|
||||
const workdirEl = document.getElementById('pipeline-workdir');
|
||||
if (workdirEl) workdirEl.value = pipeline.workingDirectory || PipelinesUI._basePath;
|
||||
|
||||
PipelinesUI.renderSteps();
|
||||
Modal.open('pipeline-modal-overlay');
|
||||
} catch (err) {
|
||||
@@ -391,9 +401,16 @@ const PipelinesUI = {
|
||||
return;
|
||||
}
|
||||
|
||||
const workingDirectory = document.getElementById('pipeline-workdir')?.value.trim() || '';
|
||||
if (workingDirectory && !workingDirectory.startsWith('/')) {
|
||||
Toast.warning('O diretório do projeto deve ser um caminho absoluto (começar com /)');
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
name,
|
||||
description: document.getElementById('pipeline-description')?.value.trim() || '',
|
||||
workingDirectory,
|
||||
steps: PipelinesUI._steps.map((s, index) => {
|
||||
const isSimple = s.promptMode !== 'advanced';
|
||||
const inputTemplate = isSimple
|
||||
@@ -455,7 +472,7 @@ const PipelinesUI = {
|
||||
if (inputEl) inputEl.value = '';
|
||||
|
||||
const workdirEl = document.getElementById('pipeline-execute-workdir');
|
||||
if (workdirEl) workdirEl.value = '';
|
||||
if (workdirEl) workdirEl.value = (pipeline && pipeline.workingDirectory) || PipelinesUI._basePath;
|
||||
|
||||
if (App._pipelineDropzone) App._pipelineDropzone.reset();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user