From 70bc68fb619aef1310e9142d823355139058dac3 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 14 Sep 2021 12:40:19 +0100 Subject: [PATCH] Adding concept of internal and external actions. --- .../cypress/integration/createAutomation.spec.js | 2 +- .../automation/AutomationBuilder/BlockList.svelte | 14 ++++++++++---- packages/server/src/automations/steps/bash.js | 1 + packages/server/src/automations/steps/createRow.js | 1 + packages/server/src/automations/steps/delay.js | 1 + packages/server/src/automations/steps/deleteRow.js | 1 + packages/server/src/automations/steps/discord.js | 1 + .../server/src/automations/steps/executeQuery.js | 1 + .../server/src/automations/steps/executeScript.js | 1 + packages/server/src/automations/steps/filter.js | 1 + .../server/src/automations/steps/integromat.js | 1 + .../src/automations/steps/outgoingWebhook.js | 1 + .../server/src/automations/steps/sendSmtpEmail.js | 1 + packages/server/src/automations/steps/serverLog.js | 1 + packages/server/src/automations/steps/slack.js | 1 + packages/server/src/automations/steps/updateRow.js | 1 + packages/server/src/automations/steps/zapier.js | 1 + 17 files changed, 26 insertions(+), 5 deletions(-) diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js index e82eeff670..e5040c3c45 100644 --- a/packages/builder/cypress/integration/createAutomation.spec.js +++ b/packages/builder/cypress/integration/createAutomation.spec.js @@ -24,7 +24,7 @@ context("Create a automation", () => { }) // Create action - cy.contains("Action").click() + cy.contains("Internal").click() cy.contains("Create Row").click() cy.get(".setup").within(() => { cy.get(".spectrum-Picker-label").click() diff --git a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte index af5c9e449e..a04541cfad 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte @@ -14,15 +14,17 @@ disabled: hasTrigger, }, { - label: "Action", + label: "Internal", value: "ACTION", + internal: true, icon: "Actions", disabled: !hasTrigger, }, { - label: "Logic", - value: "LOGIC", - icon: "Filter", + label: "External", + value: "ACTION", + internal: false, + icon: "Extension", disabled: !hasTrigger, }, ] @@ -32,9 +34,13 @@ let popover let webhookModal $: selectedTab = selectedIndex == null ? null : tabs[selectedIndex].value + $: selectedInternal = + selectedIndex == null ? null : tabs[selectedIndex].internal $: anchor = selectedIndex === -1 ? null : anchors[selectedIndex] $: blocks = sortBy(entry => entry[1].name)( Object.entries($automationStore.blockDefinitions[selectedTab] ?? {}) + ).filter( + entry => selectedInternal == null || entry[1].internal === selectedInternal ) function onChangeTab(idx) { diff --git a/packages/server/src/automations/steps/bash.js b/packages/server/src/automations/steps/bash.js index d97f055e14..6c44c1bbbb 100644 --- a/packages/server/src/automations/steps/bash.js +++ b/packages/server/src/automations/steps/bash.js @@ -7,6 +7,7 @@ exports.definition = { icon: "ri-terminal-box-line", description: "Run a bash script", type: "ACTION", + internal: true, stepId: "EXECUTE_BASH", inputs: {}, schema: { diff --git a/packages/server/src/automations/steps/createRow.js b/packages/server/src/automations/steps/createRow.js index f98cbfe2cf..e3c90fb15b 100644 --- a/packages/server/src/automations/steps/createRow.js +++ b/packages/server/src/automations/steps/createRow.js @@ -9,6 +9,7 @@ exports.definition = { icon: "ri-save-3-line", description: "Add a row to your database", type: "ACTION", + internal: true, stepId: "CREATE_ROW", inputs: {}, schema: { diff --git a/packages/server/src/automations/steps/delay.js b/packages/server/src/automations/steps/delay.js index ee7ef018e3..899d8f8401 100644 --- a/packages/server/src/automations/steps/delay.js +++ b/packages/server/src/automations/steps/delay.js @@ -6,6 +6,7 @@ exports.definition = { tagline: "Delay for {{inputs.time}} milliseconds", description: "Delay the automation until an amount of time has passed", stepId: "DELAY", + internal: true, inputs: {}, schema: { inputs: { diff --git a/packages/server/src/automations/steps/deleteRow.js b/packages/server/src/automations/steps/deleteRow.js index 0c0315b1b0..10f39d2d0c 100644 --- a/packages/server/src/automations/steps/deleteRow.js +++ b/packages/server/src/automations/steps/deleteRow.js @@ -9,6 +9,7 @@ exports.definition = { tagline: "Delete a {{inputs.enriched.table.name}} row", type: "ACTION", stepId: "DELETE_ROW", + internal: true, inputs: {}, schema: { inputs: { diff --git a/packages/server/src/automations/steps/discord.js b/packages/server/src/automations/steps/discord.js index 066eb23a4e..5d225644b1 100644 --- a/packages/server/src/automations/steps/discord.js +++ b/packages/server/src/automations/steps/discord.js @@ -11,6 +11,7 @@ exports.definition = { icon: "ri-discord-line", stepId: "discord", type: "ACTION", + internal: false, inputs: {}, schema: { inputs: { diff --git a/packages/server/src/automations/steps/executeQuery.js b/packages/server/src/automations/steps/executeQuery.js index 1dcb75d0a3..d5799a8f7d 100644 --- a/packages/server/src/automations/steps/executeQuery.js +++ b/packages/server/src/automations/steps/executeQuery.js @@ -8,6 +8,7 @@ exports.definition = { description: "Execute a query in an external data connector", type: "ACTION", stepId: "EXECUTE_QUERY", + internal: true, inputs: {}, schema: { inputs: { diff --git a/packages/server/src/automations/steps/executeScript.js b/packages/server/src/automations/steps/executeScript.js index 68a1071fd1..70298b9f8f 100644 --- a/packages/server/src/automations/steps/executeScript.js +++ b/packages/server/src/automations/steps/executeScript.js @@ -7,6 +7,7 @@ exports.definition = { icon: "ri-terminal-box-line", description: "Run a piece of JavaScript code in your automation", type: "ACTION", + internal: true, stepId: "EXECUTE_SCRIPT", inputs: {}, schema: { diff --git a/packages/server/src/automations/steps/filter.js b/packages/server/src/automations/steps/filter.js index 05727895bf..84bdc10c1d 100644 --- a/packages/server/src/automations/steps/filter.js +++ b/packages/server/src/automations/steps/filter.js @@ -21,6 +21,7 @@ exports.definition = { icon: "ri-git-branch-line", description: "Filter any automations which do not meet certain conditions", type: "LOGIC", + internal: true, stepId: "FILTER", inputs: { condition: FilterConditions.EQUALS, diff --git a/packages/server/src/automations/steps/integromat.js b/packages/server/src/automations/steps/integromat.js index f8427b0dab..e7ea03efca 100644 --- a/packages/server/src/automations/steps/integromat.js +++ b/packages/server/src/automations/steps/integromat.js @@ -9,6 +9,7 @@ exports.definition = { icon: "ri-shut-down-line", stepId: "integromat", type: "ACTION", + internal: false, inputs: {}, schema: { inputs: { diff --git a/packages/server/src/automations/steps/outgoingWebhook.js b/packages/server/src/automations/steps/outgoingWebhook.js index fe93cb38d8..ea0f0ce6be 100644 --- a/packages/server/src/automations/steps/outgoingWebhook.js +++ b/packages/server/src/automations/steps/outgoingWebhook.js @@ -23,6 +23,7 @@ exports.definition = { icon: "ri-send-plane-line", description: "Send a request of specified method to a URL", type: "ACTION", + internal: true, stepId: "OUTGOING_WEBHOOK", inputs: { requestMethod: "POST", diff --git a/packages/server/src/automations/steps/sendSmtpEmail.js b/packages/server/src/automations/steps/sendSmtpEmail.js index fc2274a582..552c9b4d36 100644 --- a/packages/server/src/automations/steps/sendSmtpEmail.js +++ b/packages/server/src/automations/steps/sendSmtpEmail.js @@ -6,6 +6,7 @@ exports.definition = { icon: "ri-mail-open-line", name: "Send Email (SMTP)", type: "ACTION", + internal: true, stepId: "SEND_EMAIL_SMTP", inputs: {}, schema: { diff --git a/packages/server/src/automations/steps/serverLog.js b/packages/server/src/automations/steps/serverLog.js index 0cde7b22ab..82e7d073e3 100644 --- a/packages/server/src/automations/steps/serverLog.js +++ b/packages/server/src/automations/steps/serverLog.js @@ -10,6 +10,7 @@ exports.definition = { icon: "ri-server-line", description: "Logs the given text to the server (using console.log)", type: "ACTION", + internal: true, stepId: "SERVER_LOG", inputs: { text: "", diff --git a/packages/server/src/automations/steps/slack.js b/packages/server/src/automations/steps/slack.js index a87c614151..ec6341a26f 100644 --- a/packages/server/src/automations/steps/slack.js +++ b/packages/server/src/automations/steps/slack.js @@ -8,6 +8,7 @@ exports.definition = { icon: "ri-slack-line", stepId: "slack", type: "ACTION", + internal: false, inputs: {}, schema: { inputs: { diff --git a/packages/server/src/automations/steps/updateRow.js b/packages/server/src/automations/steps/updateRow.js index e58f1fe446..961f75dee7 100644 --- a/packages/server/src/automations/steps/updateRow.js +++ b/packages/server/src/automations/steps/updateRow.js @@ -7,6 +7,7 @@ exports.definition = { icon: "ri-refresh-line", description: "Update a row in your database", type: "ACTION", + internal: true, stepId: "UPDATE_ROW", inputs: {}, schema: { diff --git a/packages/server/src/automations/steps/zapier.js b/packages/server/src/automations/steps/zapier.js index 57703286e6..bec90497cd 100644 --- a/packages/server/src/automations/steps/zapier.js +++ b/packages/server/src/automations/steps/zapier.js @@ -5,6 +5,7 @@ exports.definition = { name: "Zapier Webhook", stepId: "zapier", type: "ACTION", + internal: false, description: "Trigger a Zapier Zap via webhooks", tagline: "Trigger a Zapier Zap", icon: "ri-flashlight-line",