From c9ffb9c6980a63ba75540e385cd87ef92e823867 Mon Sep 17 00:00:00 2001 From: tajniak81 <13187254+tajniak81@users.noreply.github.com> Date: Tue, 1 Sep 2026 12:02:38 +0200 Subject: [PATCH] One prompt for the whole app, asked where the browser cannot refuse it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fifteen destructive actions were still gated behind window.confirm(), the same call that made removing a home charger look broken: a browser that suppresses native dialogs never shows it and returns false, so deleting a service, a part, a user or an organization would quietly not happen and say nothing about why. askConfirm() puts the question in the page and resolves to what was actually pressed, so each call site changed by one line and reads the way it did before. ConfirmDialog is mounted once in App.vue and draws over everything, including a modal — removing a server is asked from inside one, which is what Modal's new zIndex is for. The home charger keeps its own inline prompt: that one belongs to its row rather than to the middle of the screen. Co-Authored-By: Claude Opus 5 --- Web App/web/src/App.vue | 4 ++ Web App/web/src/components/AdminUsers.vue | 3 +- Web App/web/src/components/ConfirmDialog.vue | 28 ++++++++++++ Web App/web/src/components/Modal.vue | 13 +++++- Web App/web/src/components/OrgManager.vue | 3 +- Web App/web/src/components/ProviderPanel.vue | 3 +- .../web/src/components/ServerConnectModal.vue | 5 ++- Web App/web/src/lib/confirm.js | 43 +++++++++++++++++++ Web App/web/src/views/CarDetail.vue | 17 ++++---- Web App/web/src/views/Settings.vue | 7 +-- 10 files changed, 108 insertions(+), 18 deletions(-) create mode 100644 Web App/web/src/components/ConfirmDialog.vue create mode 100644 Web App/web/src/lib/confirm.js diff --git a/Web App/web/src/App.vue b/Web App/web/src/App.vue index 75015de..87ce59b 100644 --- a/Web App/web/src/App.vue +++ b/Web App/web/src/App.vue @@ -7,6 +7,7 @@ import { servers } from "./servers"; import { api } from "./api"; import { t } from "./i18n"; import Logo from "./components/Logo.vue"; +import ConfirmDialog from "./components/ConfirmDialog.vue"; import ServerSwitcher from "./components/ServerSwitcher.vue"; const router = useRouter(); @@ -161,4 +162,7 @@ onBeforeUnmount(() => themeObserver?.disconnect()); + + + diff --git a/Web App/web/src/components/AdminUsers.vue b/Web App/web/src/components/AdminUsers.vue index 4a24b87..7caf67d 100644 --- a/Web App/web/src/components/AdminUsers.vue +++ b/Web App/web/src/components/AdminUsers.vue @@ -6,6 +6,7 @@ import { api } from "../api"; import { state } from "../auth"; import { formatDate } from "../lib/format.js"; import { t } from "../i18n"; +import { askConfirm } from "../lib/confirm.js"; import Modal from "./Modal.vue"; const users = ref([]); @@ -121,7 +122,7 @@ async function submitResetPassword() { } async function removeUser(u) { - if (!confirm(t("admin.confirmDelete", { name: u.name || u.email }))) return; + if (!(await askConfirm(t("admin.confirmDelete", { name: u.name || u.email })))) return; error.value = ""; try { await api.deleteUser(u.id); diff --git a/Web App/web/src/components/ConfirmDialog.vue b/Web App/web/src/components/ConfirmDialog.vue new file mode 100644 index 0000000..82789d3 --- /dev/null +++ b/Web App/web/src/components/ConfirmDialog.vue @@ -0,0 +1,28 @@ + + + diff --git a/Web App/web/src/components/Modal.vue b/Web App/web/src/components/Modal.vue index f524f68..5e0fef7 100644 --- a/Web App/web/src/components/Modal.vue +++ b/Web App/web/src/components/Modal.vue @@ -1,10 +1,19 @@