0ece2ba85c
Claude-Session: https://claude.ai/code/session_01GzammAMzsJTgpQHqxwM2bC
228 lines
9.7 KiB
HTML
228 lines
9.7 KiB
HTML
{{define "backups_restore"}}
|
|
{{template "layout_start" .}}
|
|
|
|
<div class="page-header">
|
|
<h2>Biztonsági mentés — Visszaállítás</h2>
|
|
<span class="domain-badge">{{.Domain}}</span>
|
|
</div>
|
|
|
|
{{template "backups_flash" .}}
|
|
{{template "restore_banner" .}}
|
|
|
|
{{if not .Backup}}
|
|
{{template "backups_empty" .}}
|
|
{{else}}
|
|
|
|
<!-- Section 7: Restore -->
|
|
{{if .Backup.AppDataInfo}}
|
|
<div class="backup-section-card">
|
|
<h3>Visszaállítás</h3>
|
|
<div class="restore-section">
|
|
<div class="restore-form-row">
|
|
<label class="restore-label">Alkalmazás:</label>
|
|
<select id="restore-app" class="restore-select" onchange="onRestoreAppChange()">
|
|
<option value="">— Válasszon —</option>
|
|
{{range .Backup.AppDataInfo}}
|
|
<option value="{{.StackName}}" data-has-hdd="{{.HasHDDData}}" data-has-db="{{.HasDBDump}}" data-has-volumes="{{.HasVolumeData}}">{{.DisplayName}}</option>
|
|
{{end}}
|
|
</select>
|
|
</div>
|
|
<div class="restore-form-row">
|
|
<label class="restore-label">Pillanatkép:</label>
|
|
<select id="restore-snapshot" class="restore-select" onchange="onRestoreConfirmChange()">
|
|
<option value="">— Válasszon alkalmazást —</option>
|
|
</select>
|
|
</div>
|
|
<div id="restore-type-info" class="restore-info" style="display:none;margin-bottom:0.5rem">
|
|
</div>
|
|
<div id="restore-no-snapshots" class="restore-warning" style="display:none;">
|
|
Még nincs mentés felhasználói adattal.
|
|
</div>
|
|
<div class="restore-warning">
|
|
<svg class="ico ico-sm"><use href="#i-triangle-alert"/></svg> A visszaállítás felülírja az alkalmazás jelenlegi adatait a kiválasztott mentés állapotával.
|
|
Az alkalmazás a folyamat során automatikusan leáll és újraindul.
|
|
</div>
|
|
<div class="restore-confirm">
|
|
<label>
|
|
<input type="checkbox" id="restore-confirm-cb" onchange="onRestoreConfirmChange()">
|
|
Megértettem, visszaállítás indítása.
|
|
</label>
|
|
</div>
|
|
<div class="restore-actions">
|
|
<button type="button" class="btn btn-sm btn-danger" id="restore-btn" disabled onclick="submitRestore()">Visszaállítás indítása</button>
|
|
</div>
|
|
<div style="margin-top: 1rem; text-align: center; border-top: 1px solid var(--line); padding-top: 1rem;">
|
|
<a href="/import" class="btn btn-sm btn-outline">Importálás mentett csomagból (.fab)</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
<!-- Ellenőrző visszaállítás a távoli (3. mentés) tárolóból — the per-app restore-to-verify
|
|
forms moved here from the Távoli mentés toggle list (v0.124.0 IA split). Display list =
|
|
the offbox-toggled apps; the action itself is unchanged. -->
|
|
{{if .OffboxConfigured}}
|
|
<div class="backup-section-card">
|
|
<h3>Ellenőrző visszaállítás a távoli tárolóból</h3>
|
|
<p class="form-hint" style="margin:-0.25rem 0 1rem">A távoli mentésre kijelölt alkalmazások legutóbbi pillanatképe egy külön ellenőrző mappába állítható vissza — a meglévő adatok nem változnak.</p>
|
|
{{if .OffboxToggledCount}}
|
|
<div class="storage-paths-list">
|
|
{{range .OffboxApps}}
|
|
{{if .Enabled}}
|
|
<div class="storage-path-item">
|
|
<div class="storage-path-header">
|
|
<div class="storage-path-info"><span class="storage-path-label">{{.DisplayName}}</span></div>
|
|
<div class="storage-path-actions">
|
|
<form method="POST" action="/backup/offbox/restore" style="display:inline">{{$.CSRFField}}
|
|
<input type="hidden" name="app" value="{{.Name}}">
|
|
<button type="submit" class="btn btn-xs btn-outline" data-confirm="Visszaállítja a(z) {{.DisplayName}} adatait a távoli tárolóról egy ellenőrző mappába? A meglévő adatok NEM íródnak felül.">Visszaállítás (ellenőrzéshez)</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
<p class="form-hint">Nincs távoli mentésre jelölt alkalmazás — a kijelölés a <a href="/backups/remote">Távoli mentés</a> oldalon történik.</p>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
<script>
|
|
{{template "restore_banner_js"}}
|
|
// Restore section
|
|
var huDays = ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'];
|
|
function formatSnapshot(s) {
|
|
var t = new Date(s.time);
|
|
var pad = function(n) { return n < 10 ? '0' + n : '' + n; };
|
|
var label = t.getFullYear() + '-' + pad(t.getMonth()+1) + '-' + pad(t.getDate()) +
|
|
' ' + huDays[t.getDay()] + ' ' + pad(t.getHours()) + ':' + pad(t.getMinutes()) +
|
|
' (' + s.short_id + ')';
|
|
var tierLabel = s.tier === 2 ? '2. szint' : '1. szint';
|
|
if (s.drive_label) {
|
|
label += ' — ' + tierLabel + ', ' + s.drive_label;
|
|
} else {
|
|
label += ' — ' + tierLabel;
|
|
}
|
|
return label;
|
|
}
|
|
|
|
function onRestoreAppChange() {
|
|
var sel = document.getElementById('restore-app');
|
|
var appName = sel.value;
|
|
var snapSel = document.getElementById('restore-snapshot');
|
|
var noSnaps = document.getElementById('restore-no-snapshots');
|
|
var typeInfo = document.getElementById('restore-type-info');
|
|
|
|
document.getElementById('restore-confirm-cb').checked = false;
|
|
document.getElementById('restore-btn').disabled = true;
|
|
noSnaps.style.display = 'none';
|
|
typeInfo.style.display = 'none';
|
|
|
|
if (!appName) {
|
|
snapSel.innerHTML = '<option value="">— Válasszon alkalmazást —</option>';
|
|
return;
|
|
}
|
|
|
|
// Determine restore type from data attributes
|
|
var opt = sel.options[sel.selectedIndex];
|
|
var hasHDD = opt.getAttribute('data-has-hdd') === 'true';
|
|
var hasDB = opt.getAttribute('data-has-db') === 'true';
|
|
var hasVolumes = opt.getAttribute('data-has-volumes') === 'true';
|
|
|
|
if (hasHDD || hasVolumes) {
|
|
typeInfo.innerHTML = 'Teljes visszaállítás: adatbázis + konfiguráció + felhasználói adatok a kiválasztott pillanatképből.';
|
|
typeInfo.className = 'restore-info';
|
|
} else if (hasDB) {
|
|
typeInfo.innerHTML = 'Adatbázis és konfiguráció visszaállítása — az alkalmazásnak nincs külön felhasználói adata.';
|
|
typeInfo.className = 'restore-info restore-info-partial';
|
|
} else {
|
|
typeInfo.innerHTML = 'Csak konfiguráció visszaállítása (compose fájlok, beállítások).';
|
|
typeInfo.className = 'restore-info restore-info-partial';
|
|
}
|
|
typeInfo.style.display = 'block';
|
|
|
|
snapSel.innerHTML = '<option value="">— Betöltés... —</option>';
|
|
|
|
fetch('/api/backup/snapshots?stack=' + encodeURIComponent(appName))
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
snapSel.innerHTML = '<option value="">— Válasszon —</option>';
|
|
if (data.ok && data.data && data.data.length > 0) {
|
|
// Group by tier
|
|
var tier1 = data.data.filter(function(s) { return s.tier !== 2; });
|
|
var tier2 = data.data.filter(function(s) { return s.tier === 2; });
|
|
|
|
if (tier1.length > 0) {
|
|
var grp1 = document.createElement('optgroup');
|
|
grp1.label = '1. szint — Helyi mentés (ajánlott)';
|
|
tier1.forEach(function(s) {
|
|
var o = document.createElement('option');
|
|
o.value = s.short_id;
|
|
o.textContent = formatSnapshot(s);
|
|
grp1.appendChild(o);
|
|
});
|
|
snapSel.appendChild(grp1);
|
|
}
|
|
if (tier2.length > 0) {
|
|
var grp2 = document.createElement('optgroup');
|
|
grp2.label = '2. szint — Másodlagos másolat';
|
|
tier2.forEach(function(s) {
|
|
var o = document.createElement('option');
|
|
o.value = s.short_id;
|
|
o.textContent = formatSnapshot(s);
|
|
grp2.appendChild(o);
|
|
});
|
|
snapSel.appendChild(grp2);
|
|
}
|
|
} else {
|
|
snapSel.innerHTML = '<option value="">— Nincs elérhető mentés —</option>';
|
|
noSnaps.style.display = 'block';
|
|
}
|
|
});
|
|
}
|
|
|
|
function onRestoreConfirmChange() {
|
|
var cb = document.getElementById('restore-confirm-cb');
|
|
var app = document.getElementById('restore-app').value;
|
|
var snap = document.getElementById('restore-snapshot').value;
|
|
document.getElementById('restore-btn').disabled = !(cb.checked && app && snap);
|
|
}
|
|
|
|
function submitRestore() {
|
|
var app = document.getElementById('restore-app').value;
|
|
var snap = document.getElementById('restore-snapshot').value;
|
|
if (!app || !snap) return;
|
|
|
|
var btn = document.getElementById('restore-btn');
|
|
btn.disabled = true;
|
|
btn.textContent = 'Visszaállítás folyamatban...';
|
|
|
|
var form = document.createElement('form');
|
|
form.method = 'POST';
|
|
form.action = '/backup/restore';
|
|
|
|
var fc = document.createElement('input');
|
|
fc.type = 'hidden'; fc.name = '_csrf';
|
|
fc.value = (document.querySelector('meta[name="csrf-token"]') || {}).content || '';
|
|
form.appendChild(fc);
|
|
|
|
var f1 = document.createElement('input');
|
|
f1.type = 'hidden'; f1.name = 'stack_name'; f1.value = app;
|
|
form.appendChild(f1);
|
|
|
|
var f2 = document.createElement('input');
|
|
f2.type = 'hidden'; f2.name = 'snapshot_id'; f2.value = snap;
|
|
form.appendChild(f2);
|
|
|
|
document.body.appendChild(form);
|
|
form.submit();
|
|
}
|
|
</script>
|
|
|
|
{{template "layout_end" .}}
|
|
{{end}}
|