From d30a0531d4add045c21a2368d6321a9b1906865f Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 1 Apr 2026 03:23:01 -0500 Subject: [PATCH] refac --- src/lib/components/AutomationModal.svelte | 8 +- .../automations/AutomationEditor.svelte | 907 ++++++++++++++++++ src/routes/(app)/automations/+page.svelte | 34 +- .../(app)/automations/[id]/+page.svelte | 57 ++ 4 files changed, 982 insertions(+), 24 deletions(-) create mode 100644 src/lib/components/automations/AutomationEditor.svelte create mode 100644 src/routes/(app)/automations/[id]/+page.svelte diff --git a/src/lib/components/AutomationModal.svelte b/src/lib/components/AutomationModal.svelte index 606d13271..35991c4dc 100644 --- a/src/lib/components/AutomationModal.svelte +++ b/src/lib/components/AutomationModal.svelte @@ -225,12 +225,14 @@ if (automation) { await updateAutomationById(localStorage.token, automation.id, form); toast.success($i18n.t('Automation updated')); + show = false; + dispatch('save', { id: automation.id }); } else { - await createAutomation(localStorage.token, form); + const created = await createAutomation(localStorage.token, form); toast.success($i18n.t('Automation created')); + show = false; + dispatch('save', { id: created?.id }); } - show = false; - dispatch('save'); } catch (e: any) { toast.error(e?.detail ?? `${e}` ?? 'Failed to save'); } finally { diff --git a/src/lib/components/automations/AutomationEditor.svelte b/src/lib/components/automations/AutomationEditor.svelte new file mode 100644 index 000000000..62e0ce3be --- /dev/null +++ b/src/lib/components/automations/AutomationEditor.svelte @@ -0,0 +1,907 @@ + + + + {name || $i18n.t('Automation')} • {$WEBUI_NAME} + + + +
+ {$i18n.t('This will delete')} {automation.name}. +
+
+ +
+
+ +
+
+
+ + + + +
+
+ +
+ + + + + {#if isDirty} + + {/if} + + +
+
+ + +
+ +
+
+
{$i18n.t('Instructions')}
+
+
+
+