Matthias Nott
2026-02-26 5d0247159b125bf035285d56c2b9bb58d6bb3029
static/js/app.js
....@@ -1,5 +1,5 @@
11 'use strict';
2
-const APP_VERSION = 'v14-20260222';
2
+const APP_VERSION = 'v15-20260226';
33
44 // ============================================================
55 // OPS Dashboard — Vanilla JS Application (v6)
....@@ -827,6 +827,9 @@
827827 const downloadBtn = (!b.hasLocal && b.hasOffsite)
828828 ? `<button class="btn btn-ghost btn-xs" style="color:#34d399;border-color:rgba(52,211,153,0.25);" onclick="downloadOffsiteBackup('${esc(b.project)}','${esc(b.env)}','${esc(b.name)}')">Download</button>`
829829 : '';
830
+ const saveBtn = b.hasLocal
831
+ ? `<button class="btn btn-ghost btn-xs" style="color:#60a5fa;border-color:rgba(96,165,250,0.25);" onclick="downloadBackupFile('${esc(b.project)}','${esc(b.env)}','${esc(b.name)}')">Save</button>`
832
+ : '';
830833 h += `<tr>
831834 <td style="padding-left:0.75rem;"><input type="checkbox" class="backup-cb" value="${esc(b.name)}"${checked} onclick="toggleBackupSelect('${esc(b.name)}')" style="accent-color:#3b82f6;cursor:pointer;"></td>
832835 <td>${locationBadge}</td>
....@@ -834,6 +837,7 @@
834837 <td>${esc(b.size_human || '\u2014')}</td>
835838 <td style="white-space:nowrap;">
836839 <button class="btn btn-danger btn-xs" onclick="openRestoreModal('${esc(b.project)}','${esc(b.env)}','${restoreSource}','${esc(b.name)}',${b.hasLocal},${b.hasOffsite})">Restore</button>
840
+ ${saveBtn}
837841 ${uploadBtn}
838842 ${downloadBtn}
839843 ${deleteBtn}
....@@ -927,6 +931,10 @@
927931 cachedBackups = null;
928932 toast(`Deleted ${ok}${fail > 0 ? ', ' + fail + ' failed' : ''}`, fail > 0 ? 'warning' : 'success');
929933 if (currentPage === 'backups') renderBackups();
934
+}
935
+
936
+function downloadBackupFile(project, env, name) {
937
+ window.open(`/api/backups/download/${encodeURIComponent(project)}/${encodeURIComponent(env)}/${encodeURIComponent(name)}?token=${encodeURIComponent(getToken())}`, '_blank');
930938 }
931939
932940 async function uploadOffsiteBackup(project, env, name) {
....@@ -1702,6 +1710,10 @@
17021710 ih += '<span style="font-size:0.75rem;color:#6b7280;margin-left:auto;">content flows up</span>';
17031711 ih += '</label>';
17041712 ih += '</div>';
1713
+ ih += '<label style="display:flex;align-items:center;gap:0.5rem;font-size:0.875rem;color:#d1d5db;cursor:pointer;margin-top:0.875rem;">';
1714
+ ih += '<input type="checkbox" id="ops-sync-skip-backup" style="width:1rem;height:1rem;accent-color:#f59e0b;">';
1715
+ ih += 'Skip safety backup <span style="font-size:0.75rem;color:#f59e0b;margin-left:0.25rem;">(faster, no pre-sync snapshot)</span>';
1716
+ ih += '</label>';
17051717
17061718 info.innerHTML = ih;
17071719 startBtn.className = 'btn btn-primary btn-sm';
....@@ -1871,7 +1883,9 @@
18711883 if (type === 'promote') {
18721884 url = '/api/promote/' + encodeURIComponent(project) + '/' + encodeURIComponent(fromEnv) + '/' + encodeURIComponent(toEnv) + '?dry_run=' + dryRun + '&token=' + encodeURIComponent(getToken());
18731885 } else if (type === 'sync') {
1874
- url = '/api/sync/' + encodeURIComponent(project) + '?from=' + encodeURIComponent(fromEnv) + '&to=' + encodeURIComponent(toEnv) + '&dry_run=' + dryRun + '&token=' + encodeURIComponent(getToken());
1886
+ const skipBackupEl = document.getElementById('ops-sync-skip-backup');
1887
+ const skipBackup = skipBackupEl ? skipBackupEl.checked : false;
1888
+ url = '/api/sync/' + encodeURIComponent(project) + '?from=' + encodeURIComponent(fromEnv) + '&to=' + encodeURIComponent(toEnv) + '&dry_run=' + dryRun + (skipBackup ? '&skip_backup=true' : '') + '&token=' + encodeURIComponent(getToken());
18751889 } else if (type === 'restart' || type === 'rebuild') {
18761890 url = '/api/rebuild/' + encodeURIComponent(project) + '/' + encodeURIComponent(fromEnv)
18771891 + '?action=' + encodeURIComponent(type) + '&token=' + encodeURIComponent(getToken());