From 215f52ff531ef559ea8606349266c98f84917330 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Thu, 30 Jul 2026 17:36:00 -0400 Subject: [PATCH] Confirm modals --- app.js | 23 +++- index.html | 1 + ui/confirm-modal.js | 178 +++++++++++++++++++++++++++++ ui/custom-dashboard.js | 13 ++- ui/data-manager.js | 19 ++-- ui/qvac/index.js | 23 +++- ui/styles.css | 252 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 491 insertions(+), 18 deletions(-) create mode 100644 ui/confirm-modal.js diff --git a/app.js b/app.js index 5ddc802..ac39536 100644 --- a/app.js +++ b/app.js @@ -41,6 +41,9 @@ import { createProcessesView } from './ui/processes.js' import { createDataManager } from './ui/data-manager.js' import { formatMib, formatKilobitsPerSec } from './shared/format.js' import { chartOptionLabel } from './shared/container-names.js' +import { initConfirmModal, appConfirm } from './ui/confirm-modal.js' + +initConfirmModal() const $ = (id) => document.getElementById(id) @@ -924,7 +927,15 @@ function loadFleetView() { }, onForget: async (peer) => { const label = peer.alias || peer.id.slice(0, 12) - if (!confirm(`Forget ${label}?`)) return + const ok = await appConfirm({ + title: 'Forget agent', + message: `Remove “${label}” from saved agents?`, + detail: 'You can reconnect later with an invite or public key.', + confirmLabel: 'Forget', + danger: true, + icon: '⊘', + }) + if (!ok) return removeBookmark(peer.publicKeyHex) await manager.disconnect(peer.publicKeyHex).catch(() => {}) log(`Forgot ${label}`) @@ -1601,7 +1612,15 @@ els.settingQvacIdle?.addEventListener('change', () => { els.btnQvacOpen?.addEventListener('click', () => showView('qvac')) els.btnResetPeers?.addEventListener('click', async () => { - if (!confirm('Forget all saved agents and disconnect?')) return + const ok = await appConfirm({ + title: 'Forget all agents', + message: 'Disconnect and clear every saved agent from this device?', + detail: 'Bookmarks, peer cache, and active sessions will be removed. Invites will be required to reconnect.', + confirmLabel: 'Forget all', + danger: true, + icon: '⊘', + }) + if (!ok) return await manager.disconnectAll({ forget: true }) const { savePeers } = await import('./client/peerCache.js') savePeers({}, { activePeerId: null, force: true }) diff --git a/index.html b/index.html index 75eb815..c0d0262 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ +