diff --git a/src/routes/(app)/automations/+page.svelte b/src/routes/(app)/automations/+page.svelte index 406510e68f..575ee15520 100644 --- a/src/routes/(app)/automations/+page.svelte +++ b/src/routes/(app)/automations/+page.svelte @@ -26,8 +26,11 @@ import XMark from '$lib/components/icons/XMark.svelte'; import EllipsisHorizontal from '$lib/components/icons/EllipsisHorizontal.svelte'; import Select from '$lib/components/common/Select.svelte'; + import Dropdown from '$lib/components/common/Dropdown.svelte'; import ChevronDown from '$lib/components/icons/ChevronDown.svelte'; import Check from '$lib/components/icons/Check.svelte'; + import CheckCircle from '$lib/components/icons/CheckCircle.svelte'; + import Minus from '$lib/components/icons/Minus.svelte'; const i18n = getContext('i18n'); @@ -95,6 +98,26 @@ } }; + const bulkToggleHandler = async (enable: boolean) => { + const targets = (automations ?? []).filter((a) => a.is_active !== enable); + if (targets.length === 0) return; + + // Optimistic UI update via map for proper Svelte reactivity + automations = (automations ?? []).map((a) => + targets.some((t) => t.id === a.id) ? { ...a, is_active: enable } : a + ); + + try { + await Promise.all( + targets.map((a) => toggleAutomationById(localStorage.token, a.id)) + ); + } catch (err) { + toast.error(`${err}`); + // Refresh from server to restore consistent state + await getAutomationList(); + } + }; + const runNowHandler = async (automation: AutomationResponse) => { const res = await runAutomationById(localStorage.token, automation.id).catch((err) => { toast.error(`${err}`); @@ -329,6 +352,43 @@ + +
+ +