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.
This commit is contained in:
@@ -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.",
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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 (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center justify-between gap-3 flex-wrap">
|
||||
@@ -117,7 +130,7 @@ export const WorkflowsListPage: React.FC = () => {
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => toggleMutation.mutate({ id: w.id, enabled: !isEnabled(w) })}
|
||||
onClick={() => toggle(w)}
|
||||
className={`text-xs px-2 py-1 rounded-full border ${isEnabled(w)
|
||||
? 'bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-300 border-green-300 dark:border-green-700'
|
||||
: 'bg-neutral-50 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400 border-neutral-300 dark:border-neutral-600'}`}
|
||||
|
||||
Reference in New Issue
Block a user