diff --git a/containers/libreportal/frontend/html/backup-content.html b/containers/libreportal/frontend/html/backup-content.html index b8d2796..9149243 100644 --- a/containers/libreportal/frontend/html/backup-content.html +++ b/containers/libreportal/frontend/html/backup-content.html @@ -216,6 +216,20 @@ +
+
+
+

Delete backup location

+ +
+
+ +
+
+
diff --git a/containers/libreportal/frontend/js/components/backup/backup-page.js b/containers/libreportal/frontend/js/components/backup/backup-page.js index fa86c66..e77dd56 100644 --- a/containers/libreportal/frontend/js/components/backup/backup-page.js +++ b/containers/libreportal/frontend/js/components/backup/backup-page.js @@ -293,6 +293,7 @@ class BackupPage { if (e.target.closest('#backup-migrate-confirm')) { this.confirmMigrate(); return; } if (e.target.closest('#backup-restore-confirm')) { this.confirmRestore(); return; } if (e.target.closest('#backup-delete-confirm')) { this.confirmDelete(); return; } + if (e.target.closest('#backup-delete-location-confirm')) { this.confirmDeleteLocation(); return; } if (e.target.closest('#backup-add-location-confirm')) { this.confirmAddLocation(); return; } const engineBtn = e.target.closest('[data-action="open-engine-details"]'); if (engineBtn) { this.openEngineDetailsModal(engineBtn); return; } @@ -965,10 +966,25 @@ class BackupPage { await this.saveSection(`location-${idx}`); } - async deleteInlineLocation(idx) { + deleteInlineLocation(idx) { const loc = (this.locations?.locations || []).find(l => l.idx === idx); const name = loc?.name || `Location ${idx}`; - if (!confirm(`Delete location "${name}"?\n\nBackup data already stored at this location is not deleted — only LibrePortal's reference to it. The password file on disk also stays in place.`)) return; + const modal = document.getElementById('backup-delete-location-modal'); + const body = document.getElementById('backup-delete-location-modal-body'); + if (!modal || !body) return; + body.innerHTML = ` +

Delete location ${this.escape(name)}?

+

Backup data already stored at this location is not deleted — only LibrePortal's reference to it. The password file on disk also stays in place.

+ `; + modal.dataset.locIdx = String(idx); + modal.classList.add('open'); + } + + async confirmDeleteLocation() { + const modal = document.getElementById('backup-delete-location-modal'); + if (!modal) return; + const idx = parseInt(modal.dataset.locIdx, 10); + this.closeAllModals(); this.expandedLocs.delete(idx); await this.runTask(`libreportal backup location remove ${idx}`, 'backup', null); setTimeout(() => this.reloadAfterSave(), 2000);