From 58fedd10f540d1a3c2700e8a83a9eb95ff25155e Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 26 Jan 2024 09:21:13 +0000 Subject: [PATCH 1/4] fix issue with automation not triggering when no fields existed --- packages/client/src/utils/buttonActions.js | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index 9b4640dbb4..12fc66270a 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -160,29 +160,27 @@ const deleteRowHandler = async action => { const triggerAutomationHandler = async action => { const { fields, notificationOverride, timeout } = action.parameters - if (fields) { - try { - const result = await API.triggerAutomation({ - automationId: action.parameters.automationId, - fields, - timeout, - }) - - // Value will exist if automation is synchronous, so return it. - if (result.value) { - if (!notificationOverride) { - notificationStore.actions.success("Automation ran successfully") - } - return { result } - } + try { + const result = await API.triggerAutomation({ + automationId: action.parameters.automationId, + fields, + timeout, + }) + // Value will exist if automation is synchronous, so return it. + if (result.value) { if (!notificationOverride) { - notificationStore.actions.success("Automation triggered") + notificationStore.actions.success("Automation ran successfully") } - } catch (error) { - // Abort next actions - return false + return { result } } + + if (!notificationOverride) { + notificationStore.actions.success("Automation triggered") + } + } catch (error) { + // Abort next actions + return false } } const navigationHandler = action => { From 84b2a36fda1d00bdba3381ee6d4446092613aa4c Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 26 Jan 2024 12:10:46 +0000 Subject: [PATCH 2/4] fix case where trigger fields could be undefined --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index af54e4d2da..5950747237 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -157,6 +157,7 @@ let bindings = [] let loopBlockCount = 0 const addBinding = (name, value, icon, idx, isLoopBlock, bindingName) => { + if (!name) return const runtimeBinding = determineRuntimeBinding(name, idx, isLoopBlock) const categoryName = determineCategoryName(idx, isLoopBlock, bindingName) @@ -291,7 +292,7 @@ loopBlockCount++ continue } - + console.log(schema) Object.entries(schema).forEach(([name, value]) => addBinding(name, value, icon, idx, isLoopBlock, bindingName) ) From 9c47671032f7d0fa16ad856853886e4a7fb1a24b Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 30 Jan 2024 15:39:12 +0000 Subject: [PATCH 3/4] fix issue with automation setting sync --- packages/builder/src/builderStore/store/frontend.js | 1 + .../automation/SetupPanel/AutomationBlockSetup.svelte | 1 - .../app/[application]/settings/automations/index.svelte | 5 +---- packages/server/src/api/controllers/application.ts | 3 +++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index ff7c0d74b8..c649a58504 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -158,6 +158,7 @@ export const getFrontendStore = () => { ...INITIAL_FRONTEND_STATE.features, ...application.features, }, + automations: application.automations || {}, icon: application.icon || {}, initialised: true, })) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 5950747237..a9e7ab0d39 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -292,7 +292,6 @@ loopBlockCount++ continue } - console.log(schema) Object.entries(schema).forEach(([name, value]) => addBinding(name, value, icon, idx, isLoopBlock, bindingName) ) diff --git a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte index fde392e31d..9c45eb7eb1 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte @@ -36,15 +36,12 @@ let status = null let timeRange = null let loaded = false - - $: app = $apps.find(app => app.devId === $store.appId?.includes(app.appId)) + $: app = $apps.find(app => $store.appId?.includes(app.appId)) $: licensePlan = $auth.user?.license?.plan $: page = $pageInfo.page $: fetchLogs(automationId, status, page, timeRange) $: isCloud = $admin.cloud - $: chainAutomations = app?.automations?.chainAutomations ?? !isCloud - const timeOptions = [ { value: "90-d", label: "Past 90 days" }, { value: "30-d", label: "Past 30 days" }, diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index 70298c7172..33582cf656 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -445,6 +445,9 @@ export async function update(ctx: UserCtx) { name: app.name, url: app.url, icon: app.icon, + automations: { + chainAutomations: app.automations?.chainAutomations, + }, }) } From 6fdbeb125868f7cd4d303dbe613340ba69bd9d29 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 1 Feb 2024 09:42:38 +0000 Subject: [PATCH 4/4] submodule --- packages/account-portal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-portal b/packages/account-portal index 485ec16a9e..52f51dcfb9 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit 485ec16a9eed48c548a5f1239772139f3319f028 +Subproject commit 52f51dcfb96d3fe58c8cc7a905e7d733f7cd84c2