1
0
Fork 0
mirror of synced 2024-10-03 02:27:06 +13:00

further work for triggering automations from other automations

This commit is contained in:
Peter Clement 2024-01-03 11:59:15 +00:00
parent 49676f2cae
commit 734ad2c1ae
9 changed files with 27 additions and 7 deletions

View file

@ -155,6 +155,7 @@ const automationActions = store => ({
await store.actions.save(newAutomation)
},
test: async (automation, testData) => {
console.log(testData)
const result = await API.testAutomation({
automationId: automation?._id,
testData,

View file

@ -19,6 +19,7 @@
export let lastStep
let syncAutomationsEnabled = $licensing.syncAutomationsEnabled
let triggerAutomationsEnabled = $licensing.triggerAutomationsEnabled
let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK]
let selectedAction
let actionVal
@ -35,6 +36,10 @@
disabled: !lastStep || !syncAutomationsEnabled || collectBlockExists,
message: collectDisabledMessage(),
},
TRIGGER: {
disabled: !triggerAutomationsEnabled,
message: collectDisabledMessage(),
},
}
}
@ -98,6 +103,9 @@
notifications.error("Error saving automation")
}
}
let lockedFeatures = [ActionStepID.COLLECT, ActionStepID.TRIGGER]
$: console.log
</script>
<ModalContent
@ -148,7 +156,7 @@
<div class="item-body">
<Icon name={action.icon} />
<Body size="XS">{action.name}</Body>
{#if isDisabled && !syncAutomationsEnabled && action.stepId === ActionStepID.COLLECT}
{#if isDisabled && !syncAutomationsEnabled && !triggerAutomationsEnabled && lockedFeatures.includes(action.stepId)}
<div class="tag-color">
<Tags>
<Tag icon="LockClosed">Business</Tag>

View file

@ -46,6 +46,8 @@
}
const testAutomation = async () => {
console.log(testData)
console.log($selectedAutomation)
try {
await automationStore.actions.test($selectedAutomation, testData)
$automationStore.showTestPanel = true

View file

@ -21,6 +21,7 @@ export const ActionStepID = {
QUERY_ROWS: "QUERY_ROWS",
LOOP: "LOOP",
COLLECT: "COLLECT",
TRIGGER: "TRIGGER",
// these used to be lowercase step IDs, maintain for backwards compat
discord: "discord",
slack: "slack",

View file

@ -125,6 +125,10 @@ export const createLicensingStore = () => {
const syncAutomationsEnabled = license.features.includes(
Constants.Features.SYNC_AUTOMATIONS
)
const triggerAutomationsEnabled = license.features.includes(
Constants.Features.SYNC_AUTOMATIONS
)
const perAppBuildersEnabled = license.features.includes(
Constants.Features.APP_BUILDERS
)
@ -147,6 +151,7 @@ export const createLicensingStore = () => {
auditLogsEnabled,
enforceableSSO,
syncAutomationsEnabled,
triggerAutomationsEnabled,
isViewPermissionsEnabled,
perAppBuildersEnabled,
}

@ -1 +1 @@
Subproject commit 992486c10044a7495496b97bdf5f454d4020bfba
Subproject commit 82de3443fd03b272555d23c42ead3a611302277d

View file

@ -42,7 +42,7 @@ const ACTION_IMPLS: Record<
FILTER: filter.run,
QUERY_ROWS: queryRow.run,
COLLECT: collect.run,
TRIGGER_AUTOMATION: trigger.run,
TRIGGER: trigger.run,
// these used to be lowercase step IDs, maintain for backwards compat
discord: discord.run,
slack: slack.run,

View file

@ -26,7 +26,11 @@ export const definition: AutomationStepSchema = {
properties: {
automationId: {
type: AutomationIOType.STRING,
title: "Automation ID to trigger",
title: "Automation ID",
},
timeout: {
type: AutomationIOType.NUMBER,
title: "Timeout (ms)",
},
},
required: ["automationId"],
@ -48,8 +52,6 @@ export const definition: AutomationStepSchema = {
}
export async function run({ inputs }: AutomationStepInput) {
console.log("??: " + inputs.automationId)
console.log("???DSAASDFAFSDFDSFDS")
if (!inputs.automationId) {
return {
success: false,
@ -62,7 +64,7 @@ export async function run({ inputs }: AutomationStepInput) {
automation,
{
fields: {},
timeout: 120000,
timeout: inputs.timeout * 1000 || 120000,
},
{ getResponses: true }
)

View file

@ -9,6 +9,7 @@ export enum Feature {
BRANDING = "branding",
SCIM = "scim",
SYNC_AUTOMATIONS = "syncAutomations",
TRIGGER_AUTOMATION = "triggerAutomation",
APP_BUILDERS = "appBuilders",
OFFLINE = "offline",
EXPANDED_PUBLIC_API = "expandedPublicApi",