🚀 Auto-deploy: BrainKP atualizado em 24/07/2026 23:45:56

This commit is contained in:
2026-07-24 23:45:56 +00:00
parent 1f586ef441
commit 57fc5249e4
2 changed files with 102 additions and 1 deletions
+29 -1
View File
@@ -319,7 +319,8 @@ async function loadStatus() {
</div>
${c.running
? `<div style="margin-top:12px;text-align:center;font-size:11px;color:var(--accent);font-weight:bold"><span class="loading"></span> Sincronizando...</div>`
: `<button class="run-btn" onclick="event.stopPropagation();runBackup('${c.id}')">▶ Executar Backup</button>`
: `<button class="run-btn" onclick="event.stopPropagation();runBackup('${c.id}')">▶ Executar Backup</button>
<button class="run-btn" style="margin-top:5px; background:var(--danger)" onclick="event.stopPropagation();cleanupBackups('${c.id}')">🗑️ Limpar Antigos</button>`
}
</div>
`).join('');
@@ -448,6 +449,33 @@ async function runBackup(type) {
btn.innerHTML = '▶ Executar Backup';
}
async function cleanupBackups(type) {
if (!confirm(`Tem certeza que deseja apagar backups antigos de ${getTypeLabel(type)} (mantendo apenas os 2 mais recentes de cada)?`)) return;
const btn = event.target;
const originalText = btn.innerHTML;
btn.disabled = true;
btn.innerHTML = '<span class="loading"></span> Limpando...';
try {
const res = await fetch(`${API}/cleanup/${type}`, { method: 'POST' });
const d = await res.json();
if (d.ok) {
if (d.errors && d.errors.length > 0) {
showToast(`Concluído com alertas: ${d.deleted_count} apagados. ${d.errors.length} erros.`, 'warning');
} else {
showToast(`Limpeza concluída! ${d.deleted_count} backups antigos apagados.`, 'ok');
}
loadStatus();
loadBackups();
} else {
showToast(d.error || 'Erro na limpeza', 'error');
}
} catch(e) {
showToast('Erro ao realizar limpeza', 'error');
}
btn.disabled = false;
btn.innerHTML = originalText;
}
let restoreTarget = null;
function openRestoreModal(type, filename, size) {