Files
felhom-controller/controller/internal/web/templates/backups_shared.html
T
admin 11b790e314
gates / gates (push) Successful in 20s
v0.249.0: i18n slice 1 release B — backup pages in English, Hungarian byte-identical (R-556)
Seven backup pages + the restore-progress JS converted against fixtures captured unconverted
(f8ebc47); recovery renders through executeTemplateLang; English retrieval claims registered;
the Fut comparison left unconverted (R-563).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-09-17 18:01:09 +02:00

67 lines
3.0 KiB
HTML

{{define "backups_flash"}}
{{if .Backup}}{{if .Backup.FlashSuccess}}
<div class="flash flash-success">{{.Backup.FlashSuccess}}</div>
{{end}}{{end}}
{{if .Backup}}{{if .Backup.FlashError}}
<div class="flash flash-error">{{.Backup.FlashError}}</div>
{{end}}{{end}}
{{end}}
{{define "backups_empty"}}
<div class="backup-empty-state">
<div class="backup-empty-icon">&#128737;</div>
<h3>{{T "backups_shared.empty_title"}}</h3>
<p>{{T "backups_shared.empty_body"}}</p>
</div>
{{end}}
{{define "restore_banner"}}
<!-- Part B: async restore progress banner — polls /api/backup/restore-status; neutral while running,
red only on failure (exception-color principle). Hidden until a restore op is seen. -->
<div id="restore-banner" class="flash" style="display:none"></div>
{{end}}
{{define "restore_banner_js"}}
// Part B: restore-progress banner. Polls the async restore op-status every 3s. Shows a neutral
// "in progress" while running (including on a fresh page load mid-op), success on completion, and the
// error state ONLY on failure. Stops polling when idle after a terminal result was shown.
(function(){
var banner = document.getElementById('restore-banner');
if (!banner) return;
var sawRunning = false;
function opLabel(op){ return op === 'tier2-restore' ? '{{T "backups_shared.fajl_visszaallitas"}}'
: op === 'offbox-restore' ? '{{T "backups_shared.tavoli_visszaallitas"}}' : '{{T "backups_shared.visszaallitas"}}'; }
function render(st){
if (st.running) {
sawRunning = true;
banner.className = 'flash';
banner.style.display = 'block';
banner.textContent = opLabel(st.op) + ' {{T "backups_shared.folyamatban"}}' + (st.stack ? ': ' + st.stack : '') + '…';
return;
}
// R-351: `sawRunning` alone showed a terminal result ONLY to a page that watched the op
// happen. A restore that finished before this page was opened — or inside one poll interval
// — was shown to nobody, which is how a completed restore became unknowable from any screen.
// `last_recent` is the server's verdict, using the one window in internal/backup.
if (st.last && (sawRunning || st.last_recent)) {
banner.style.display = 'block';
if (st.last.ok) {
banner.className = 'flash flash-success';
banner.textContent = st.last.message || (opLabel(st.last.op) + ' {{T "backups_shared.kesz"}}');
} else {
banner.className = 'flash flash-error';
banner.textContent = st.last.message || (opLabel(st.last.op) + ' {{T "backups_shared.sikertelen"}}');
}
}
}
function poll(){
fetch('/api/backup/restore-status', {headers: {'Accept':'application/json'}})
.then(function(r){ return r.json(); })
.then(function(j){ if (j && j.data) render(j.data); })
.catch(function(){});
}
poll();
setInterval(poll, 3000);
})();
{{end}}