Fix bugs from BUGHUNT.md: restore race conditions, infra backup, DR wiring, docker-setup.sh, restore.html
This commit is contained in:
@@ -255,10 +255,15 @@
|
||||
pollStatus();
|
||||
}
|
||||
|
||||
var pollErrors = 0;
|
||||
function pollStatus() {
|
||||
fetch('/api/restore/status')
|
||||
.then(function(resp) { return resp.json(); })
|
||||
.then(function(resp) {
|
||||
if (!resp.ok) throw new Error('HTTP ' + resp.status);
|
||||
return resp.json();
|
||||
})
|
||||
.then(function(data) {
|
||||
pollErrors = 0;
|
||||
if (!data.ok) return;
|
||||
updateTable(data.apps || []);
|
||||
updateProgress(data.apps || []);
|
||||
@@ -270,23 +275,41 @@
|
||||
updateActions();
|
||||
}
|
||||
})
|
||||
.catch(function() {});
|
||||
.catch(function(err) {
|
||||
pollErrors++;
|
||||
console.error('Poll error:', err);
|
||||
if (pollErrors >= 10) {
|
||||
clearInterval(polling);
|
||||
polling = null;
|
||||
var actions = document.getElementById('dr-actions');
|
||||
if (actions) {
|
||||
actions.innerHTML = '<p style="color:var(--danger)">Kapcsolat megszakadt. <a href="/restore">Oldal frissítése</a></p>';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateTable(apps) {
|
||||
apps.forEach(function(app) {
|
||||
var cells = document.querySelectorAll('.app-status[data-app="' + app.name + '"]');
|
||||
cells.forEach(function(cell) {
|
||||
var html = '<span class="status-' + app.status + '">';
|
||||
var span = document.createElement('span');
|
||||
span.className = 'status-' + app.status;
|
||||
if (app.status === 'restoring') {
|
||||
html += '<span class="spinner"></span> ';
|
||||
var spinner = document.createElement('span');
|
||||
spinner.className = 'spinner';
|
||||
span.appendChild(spinner);
|
||||
span.appendChild(document.createTextNode(' '));
|
||||
}
|
||||
html += statusText(app.status);
|
||||
span.appendChild(document.createTextNode(statusText(app.status)));
|
||||
if (app.error) {
|
||||
html += ' <span style="font-size:.8rem;color:var(--danger)">(' + app.error.substring(0, 60) + ')</span>';
|
||||
var errSpan = document.createElement('span');
|
||||
errSpan.style.cssText = 'font-size:.8rem;color:var(--danger)';
|
||||
errSpan.textContent = ' (' + app.error.substring(0, 60) + ')';
|
||||
span.appendChild(errSpan);
|
||||
}
|
||||
html += '</span>';
|
||||
cell.innerHTML = html;
|
||||
cell.innerHTML = '';
|
||||
cell.appendChild(span);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user