From c5f131cec32826331722ef3705c5f5422e31726d Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Tue, 23 Jun 2026 23:36:17 +0200 Subject: [PATCH] feat(workflows): warn when disabling a built-in (reverts to legacy, not off) Confirm dialog on the list page when toggling a built-in OFF, clarifying it reverts to the previous built-in/legacy behaviour rather than turning the automation off (review concern #4). The enable-refusal for unimplemented flows surfaces via the existing toggle error toast (backend 409). EN + DE strings. --- frontend/src/i18n/locales/de.json | 3 +++ frontend/src/i18n/locales/en.json | 3 +++ .../pages/admin/workflows/WorkflowsListPage.tsx | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json index ac5bb6d2..e3b683ed 100644 --- a/frontend/src/i18n/locales/de.json +++ b/frontend/src/i18n/locales/de.json @@ -212,6 +212,9 @@ "enabled": "Aktiv", "disabled": "Inaktiv", "confirmDelete": "Diesen Workflow löschen?", + "toggle": { + "confirmDisableBuiltin": "Das Deaktivieren dieses eingebauten Ablaufs stellt das vorherige Standardverhalten wieder her – die Automatisierung wird dadurch nicht abgeschaltet. Fortfahren?" + }, "test": { "title": "Testlauf", "hint": "Probelauf: durchläuft den ganzen Ablauf sofort (Wartezeiten übersprungen, Gates automatisch bestätigt), Nebeneffekte werden nur simuliert – keine echten E-Mails. Optional eine Entitäts-ID (z. B. eine Rechnung) angeben, damit Bedingungen sie lesen können.", diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index 57ba8414..e0327ace 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -212,6 +212,9 @@ "enabled": "Enabled", "disabled": "Disabled", "confirmDelete": "Delete this workflow?", + "toggle": { + "confirmDisableBuiltin": "Disabling this built-in reverts to the previous built-in behaviour — it does not turn the automation off. Continue?" + }, "test": { "title": "Test run", "hint": "Dry run: walks the whole flow now (waits skipped, gates auto-confirmed) with side effects mocked — no real emails. Optionally give an entity id (e.g. an invoice) so conditions can read it.", diff --git a/frontend/src/pages/admin/workflows/WorkflowsListPage.tsx b/frontend/src/pages/admin/workflows/WorkflowsListPage.tsx index 8b31753e..06078501 100644 --- a/frontend/src/pages/admin/workflows/WorkflowsListPage.tsx +++ b/frontend/src/pages/admin/workflows/WorkflowsListPage.tsx @@ -73,6 +73,19 @@ export const WorkflowsListPage: React.FC = () => { const isEnabled = (w: WorkflowSummary) => w.enabled === true || w.enabled === 1; const isBuiltin = (w: WorkflowSummary) => w.is_builtin === true || w.is_builtin === 1; + // Disabling a built-in reverts to the legacy hardcoded behaviour (it does NOT + // stop the automation) — warn so the admin isn't surprised. Enabling is guarded + // server-side (a flow using unimplemented actions is refused with a clear error). + const toggle = (w: WorkflowSummary) => { + const next = !isEnabled(w); + if (!next && isBuiltin(w)) { + const msg = t('workflows.toggle.confirmDisableBuiltin', + 'Disabling this built-in reverts to the previous built-in behaviour — it does not turn the automation off. Continue?') as string; + if (!window.confirm(msg)) return; + } + toggleMutation.mutate({ id: w.id, enabled: next }); + }; + return (
@@ -117,7 +130,7 @@ export const WorkflowsListPage: React.FC = () => {