diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte
index 73266b85b2..175160ba64 100644
--- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte
+++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte
@@ -10,6 +10,7 @@
import CodeEditorModal from "./CodeEditorModal.svelte"
import QuerySelector from "./QuerySelector.svelte"
import QueryParamSelector from "./QueryParamSelector.svelte"
+ import CronBuilder from "./CronBuilder.svelte"
import Editor from "components/integration/QueryEditor.svelte"
export let block
@@ -76,6 +77,8 @@
/>
{:else if value.customType === "query"}
+ {:else if value.customType === "cron"}
+
{:else if value.customType === "queryParams"}
{:else if value.customType === "table"}
diff --git a/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte b/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte
new file mode 100644
index 0000000000..8b934ab967
--- /dev/null
+++ b/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+ {#if presets}
+
+ {/if}
+
+
+
+
diff --git a/packages/server/src/api/controllers/automation.js b/packages/server/src/api/controllers/automation.js
index 4d0dd9023e..8e9e23be40 100644
--- a/packages/server/src/api/controllers/automation.js
+++ b/packages/server/src/api/controllers/automation.js
@@ -55,13 +55,15 @@ async function checkForCronTriggers({ appId, oldAuto, newAuto }) {
const cronTriggerRemoved =
isCronTrigger(oldAuto) && !isCronTrigger(newAuto) && oldTrigger.cronJobId
- const cronTriggerAdded = !isCronTrigger(oldAuto) && isCronTrigger(newAuto)
+ const cronTriggerDeactivated = !newAuto.live && oldAuto.live
- if (cronTriggerRemoved) {
+ const cronTriggerActivated = newAuto.live && !oldAuto.live
+
+ if (cronTriggerRemoved || cronTriggerDeactivated) {
await triggers.automationQueue.removeRepeatableByKey(oldTrigger.cronJobId)
}
// need to create cron job
- else if (cronTriggerAdded) {
+ else if (isCronTrigger(newAuto) && cronTriggerActivated) {
const job = await triggers.automationQueue.add(
{ automation: newAuto, event: { appId } },
{ repeat: { cron: newTrigger.inputs.cron } }
diff --git a/packages/server/src/automations/triggers.js b/packages/server/src/automations/triggers.js
index 65a095890d..5f99eb3901 100644
--- a/packages/server/src/automations/triggers.js
+++ b/packages/server/src/automations/triggers.js
@@ -201,7 +201,7 @@ const BUILTIN_DEFINITIONS = {
name: "Cron Trigger",
event: "cron:trigger",
icon: "ri-timer-line",
- tagline: "Cron Trigger - {{inputs.cron}}",
+ tagline: "Cron Trigger ({{inputs.cron}})",
description: "Triggers automation on a cron schedule.",
stepId: "CRON",
inputs: {},
@@ -211,7 +211,7 @@ const BUILTIN_DEFINITIONS = {
cron: {
type: "string",
customType: "cron",
- title: "Cron Expression",
+ title: "Expression",
},
},
required: ["cron"],