From 749f42f4817f9124514f8822a4e2cb1c44e1a22a Mon Sep 17 00:00:00 2001 From: tajniak81 <13187254+tajniak81@users.noreply.github.com> Date: Tue, 1 Sep 2026 11:56:04 +0200 Subject: [PATCH] Remove asks in the page, not in a dialog the browser may refuse to show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing a charger was gated behind window.confirm(). A browser that suppresses native dialogs — an embedded webview, a blocked-dialogs setting — does not show it and hands back false, so the click answered "no" on the user's behalf: no request, no error, nothing. The button looked broken and the endpoint was never reached. It always had been fine; a delete with an unknown id still answers 404 and the ownership path still resolves. The prompt is part of the row now — the warning, Cancel, Remove — the way the charger reset in the same view already asks. Remove disables while the delete is in flight, and a failure lands in the error line the list already has. Fifteen other confirm() call sites share the flaw and are left for their own change. Co-Authored-By: Claude Opus 5 --- Web App/web/src/views/Charging.vue | 53 +++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/Web App/web/src/views/Charging.vue b/Web App/web/src/views/Charging.vue index 0f09aa0..90aba4c 100644 --- a/Web App/web/src/views/Charging.vue +++ b/Web App/web/src/views/Charging.vue @@ -232,14 +232,34 @@ function onChargerImported(charger) { loadChargerLive(true); } -async function removeHomeCharger(c) { - if (!confirm(t("charging.home.removeConfirm", { name: c.name }))) return; +// Removing asks first, inline. A window.confirm() would be shorter, but a +// browser that suppresses dialogs — an embedded webview, a blocked-popups +// setting — hands back false, and the button then does nothing at all with +// nothing said about why. The prompt is part of the page instead, the way the +// charger reset above already asks. +const pendingRemoval = ref(""); // charger id awaiting a yes +const removing = ref(""); + +function askRemoveHomeCharger(c) { homeChargersError.value = ""; + pendingRemoval.value = c.id; +} + +function cancelRemoveHomeCharger() { + pendingRemoval.value = ""; +} + +async function removeHomeCharger(c) { + homeChargersError.value = ""; + removing.value = c.id; try { await api.deleteHomeCharger(c.id); homeChargers.value = homeChargers.value.filter((x) => x.id !== c.id); + pendingRemoval.value = ""; } catch (e) { homeChargersError.value = e.message; + } finally { + removing.value = ""; } } @@ -654,9 +674,8 @@ onMounted(async () => { +
@@ -677,12 +696,36 @@ onMounted(async () => { type="button" class="shrink-0 text-xs font-medium text-muted hover:text-danger" :title="t('charging.home.remove')" - @click="removeHomeCharger(c)" + @click="askRemoveHomeCharger(c)" > {{ t("charging.home.remove") }}
+ +
+

+ {{ t("charging.home.removeConfirm", { name: c.name }) }} +

+
+ + +
+
+
+

{{ t("charging.home.empty") }}