This commit is contained in:
JiriUhlir
2026-05-27 13:09:34 +02:00
parent dcc1a2f3ad
commit 3e1d1f5360
4 changed files with 79 additions and 79 deletions
+20 -20
View File
@@ -35,52 +35,52 @@ def backups_page():
<td>
<div class="copy-row">
<input readonly value="{backup_path}">
<button type="button" class="copy-button" data-copy-value="{backup_path}" onclick="copyText(this)">Copy</button>
<button type="button" class="copy-button" data-copy-value="{backup_path}" onclick="copyText(this)">Kopírovat</button>
</div>
</td>
<td>
<div class="copy-row">
<input readonly value="{restore_cmd}">
<button type="button" class="copy-button" data-copy-value="{restore_cmd}" onclick="copyText(this)">Copy</button>
<button type="button" class="copy-button" data-copy-value="{restore_cmd}" onclick="copyText(this)">Kopírovat</button>
</div>
<div class="muted">Restore is dangerous and must be run manually over SSH.</div>
<div class="muted">Obnova je nebezpečná a musí se spustit ručně přes SSH.</div>
</td>
<td class="actions-cell">
<form method="post" action="/portal/backups/delete" onsubmit="return confirm('Delete backup {backup_name}?');">
<form method="post" action="/portal/backups/delete" onsubmit="return confirm('Smazat zálohu {backup_name}?');">
<input type="hidden" name="backup_path" value="{backup_path}">
<button type="submit" class="danger">Delete</button>
<button type="submit" class="danger">Smazat</button>
</form>
</td>
</tr>
"""
if not rows:
rows = '<tr><td colspan="4">No backups found.</td></tr>'
rows = '<tr><td colspan="4">Nebyly nalezeny žádné zálohy.</td></tr>'
return page(
"Backups",
"Zálohy",
f"""
<div class="card">
<h2>Backup Management</h2>
<h2>Správa záloh</h2>
<p class="muted">
Backups do not include the backup directory itself.
Restoring an older backup should not delete newer .tar.gz files.
Restore remains manual to avoid accidental overwrite.
Zálohy neobsahují samotný adresář se zálohami.
Obnova starší zálohy by neměla smazat novější soubory .tar.gz.
Obnova zůstává ruční, aby nedošlo k nechtěnému přepsání dat.
</p>
<form method="post" action="/portal/backups/create">
<button type="submit">Create Backup</button>
<button type="submit">Vytvořit zálohu</button>
</form>
</div>
<div class="card">
<h2>Available Backups</h2>
<h2>Dostupné zálohy</h2>
<table>
<tr>
<th>Backup</th>
<th>Path</th>
<th>Restore Command</th>
<th>Actions</th>
<th>Záloha</th>
<th>Cesta</th>
<th>Příkaz pro obnovu</th>
<th>Akce</th>
</tr>
{rows}
</table>
@@ -95,9 +95,9 @@ def create_backup():
status = "OK" if result.returncode == 0 else "FAILED"
return render_result(
title=f"Create Backup: {status}",
title=f"Vytvoření zálohy: {status}",
back_url="/portal/backups",
sections=[("Output", result.stdout), ("Error", result.stderr)],
sections=[("Výstup", result.stdout), ("Chyba", result.stderr)],
)
@@ -106,7 +106,7 @@ def delete_backup(backup_path: str = Form(...)):
target = Path(backup_path)
if not is_backup_path(target):
return HTMLResponse("Invalid backup path", status_code=400)
return HTMLResponse("Neplatná cesta k záloze", status_code=400)
target = target.resolve()
if target.exists():