One prompt for the whole app, asked where the browser cannot refuse it

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 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5 committed 2026-09-01 12:02:38 +02:00
1 parent 749f42f481
commit c9ffb9c698
10 files changed
+108 -18

No files matched your search

+9 -8
View File
@@ -20,6 +20,7 @@ import {
} from "../lib/format.js";
import { SERVICE_PARTS, changedParts, visibleParts } from "../lib/serviceParts.js";
import { t, tSplit } from "../i18n";
import { askConfirm } from "../lib/confirm.js";
import CarFormModal from "../components/CarFormModal.vue";
import ServiceFormModal from "../components/ServiceFormModal.vue";
import TechnicalCheckFormModal from "../components/TechnicalCheckFormModal.vue";
@@ -704,7 +705,7 @@ async function onServiceSaved() {
await load();
}
async function deleteService(id) {
if (!confirm(t("car.services.confirmDelete"))) return;
if (!(await askConfirm(t("car.services.confirmDelete")))) return;
try {
await api.deleteService(id);
await load();
@@ -728,7 +729,7 @@ async function onTechnicalCheckSaved() {
await load();
}
async function deleteTechnicalCheck(id) {
if (!confirm(t("car.technical.confirmDelete"))) return;
if (!(await askConfirm(t("car.technical.confirmDelete")))) return;
try {
await api.deleteTechnicalCheck(id);
await load();
@@ -751,7 +752,7 @@ async function onPartSaved() {
parts.value = await api.listCarParts(props.id);
}
async function deletePart(id) {
if (!confirm(t("car.parts.confirmDelete"))) return;
if (!(await askConfirm(t("car.parts.confirmDelete")))) return;
try {
await api.deletePart(id);
parts.value = await api.listCarParts(props.id);
@@ -786,7 +787,7 @@ async function onFuelSaved() {
await reloadFuel();
}
async function deleteFuel(id) {
if (!confirm(t("car.fuel.confirmDelete"))) return;
if (!(await askConfirm(t("car.fuel.confirmDelete")))) return;
try {
await api.deleteFuel(id);
await reloadFuel();
@@ -822,7 +823,7 @@ async function onChargingSaved() {
await reloadCharging();
}
async function deleteCharging(id) {
if (!confirm(t("car.charging.confirmDelete"))) return;
if (!(await askConfirm(t("car.charging.confirmDelete")))) return;
try {
await api.deleteCharging(id);
await reloadCharging();
@@ -851,7 +852,7 @@ async function onMaintenanceSaved() {
]);
}
async function deleteMaintenance(id) {
if (!confirm(t("car.maintenance.confirmDelete"))) return;
if (!(await askConfirm(t("car.maintenance.confirmDelete")))) return;
try {
await api.deleteMaintenance(id);
maintenance.value = await api.listCarMaintenance(props.id);
@@ -879,7 +880,7 @@ async function onDocumentSaved() {
]);
}
async function deleteDocument(id) {
if (!confirm(t("car.documents.confirmDelete"))) return;
if (!(await askConfirm(t("car.documents.confirmDelete")))) return;
try {
await api.deleteDocument(id);
[documents.value, reminders.value] = await Promise.all([
@@ -948,7 +949,7 @@ async function reopenReminder(r) {
}
}
async function deleteReminder(id) {
if (!confirm(t("car.reminders.confirmDelete"))) return;
if (!(await askConfirm(t("car.reminders.confirmDelete")))) return;
try {
await api.deleteReminder(id);
reminders.value = await api.listCarReminders(props.id);
+4 -3
View File
@@ -6,6 +6,7 @@ import { state, isAdmin, logout, refreshProfile } from "../auth";
import { prefs, applyProfilePrefs } from "../prefs";
import { formatDate, formatMoney } from "../lib/format.js";
import { t, tSplit, TRANSLATED_LANGUAGES } from "../i18n";
import { askConfirm } from "../lib/confirm.js";
import OrgManager from "../components/OrgManager.vue";
import AdminUsers from "../components/AdminUsers.vue";
@@ -546,7 +547,7 @@ async function generateAnkerToken() {
async function revokeAnkerToken() {
const sn = ankerCtlSerial.value.trim();
if (!sn) return;
if (!confirm(t("settings.integrations.controlRevokeConfirm"))) return;
if (!(await askConfirm(t("settings.integrations.controlRevokeConfirm")))) return;
ankerCtlError.value = "";
ankerNewToken.value = "";
try {
@@ -873,7 +874,7 @@ async function onImportFileChosen(e) {
importError.value = t("settings.advanced.notExport");
return;
}
if (!confirm(t("settings.advanced.confirmImport", { count: payload.cars.length }))) {
if (!(await askConfirm(t("settings.advanced.confirmImport", { count: payload.cars.length })))) {
return;
}
@@ -934,7 +935,7 @@ async function cancelDeletion() {
}
async function finalizeDeletion() {
if (!confirm(t("settings.danger.confirmFinalize"))) return;
if (!(await askConfirm(t("settings.danger.confirmFinalize")))) return;
deleteError.value = "";
try {
await api.finalizeAccountDeletion();