diff --git a/packages/builder/src/builderStore/store/automation/Automation.js b/packages/builder/src/builderStore/store/automation/Automation.js
index dcbb747e38..49928c69a9 100644
--- a/packages/builder/src/builderStore/store/automation/Automation.js
+++ b/packages/builder/src/builderStore/store/automation/Automation.js
@@ -17,7 +17,7 @@ export default class Automation {
this.automation.testData = data
}
- addBlock(block) {
+ addBlock(block, idx) {
// Make sure to add trigger if doesn't exist
if (!this.hasTrigger() && block.type === "TRIGGER") {
const trigger = { id: generate(), ...block }
@@ -26,10 +26,7 @@ export default class Automation {
}
const newBlock = { id: generate(), ...block }
- this.automation.definition.steps = [
- ...this.automation.definition.steps,
- newBlock,
- ]
+ this.automation.definition.steps.splice(idx, 0, newBlock)
return newBlock
}
diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js
index 0a47970d28..16cc490bb2 100644
--- a/packages/builder/src/builderStore/store/automation/index.js
+++ b/packages/builder/src/builderStore/store/automation/index.js
@@ -104,9 +104,12 @@ const automationActions = store => ({
return state
})
},
- addBlockToAutomation: block => {
+ addBlockToAutomation: (block, blockIdx) => {
store.update(state => {
- const newBlock = state.selectedAutomation.addBlock(cloneDeep(block))
+ const newBlock = state.selectedAutomation.addBlock(
+ cloneDeep(block),
+ blockIdx
+ )
state.selectedBlock = newBlock
return state
})
diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
index b822973b62..acb945a96a 100644
--- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
+++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
@@ -1,10 +1,9 @@
diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte
index c05a103fac..fee8afd711 100644
--- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte
+++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte
@@ -4,9 +4,9 @@
import FlowItem from "./FlowItem.svelte"
import TestDataModal from "./TestDataModal.svelte"
import { flip } from "svelte/animate"
- import { fade, fly } from "svelte/transition"
+ import { fly } from "svelte/transition"
import {
- Detail,
+ Heading,
Icon,
ActionButton,
notifications,
@@ -57,26 +57,24 @@
-
{automation.name}
-
-
+ {automation.name}
+
+
{
testDataModal.show()
}}
icon="MultipleCheck"
- size="S">Run testRun test
@@ -84,16 +82,11 @@
{#each blocks as block, idx (block.id)}
- {#if idx !== blocks.length - 1}
-
-
-
- {/if}
{/each}
@@ -114,14 +107,6 @@
diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte
index f077ac35d7..0c0b79c3de 100644
--- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte
+++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte
@@ -14,7 +14,6 @@
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
import ResultsModal from "./ResultsModal.svelte"
import ActionModal from "./ActionModal.svelte"
- import { database } from "stores/backend"
import { externalActions } from "./ExternalActions"
export let onSelect
@@ -29,7 +28,6 @@
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter(
step => step.stepId === block.stepId
)
- $: instanceId = $database._id
$: isTrigger = block.type === "TRIGGER"
@@ -40,6 +38,10 @@
$: blockIdx = steps.findIndex(step => step.id === block.id)
$: lastStep = !isTrigger && blockIdx + 1 === steps.length
+ $: totalBlocks =
+ $automationStore.selectedAutomation?.automation?.definition?.steps.length +
+ 1
+
// Logic for hiding / showing the add button.first we check if it has a child
// then we check to see whether its inputs have been commpleted
$: disableAddButton = isTrigger
@@ -167,13 +169,24 @@
-
+
+
+ actionModal.show()}
+ disabled={!hasCompletedInputs}
+ hoverable
+ name="AddCircle"
+ size="S"
+/>
+{#if isTrigger ? totalBlocks > 1 : blockIdx !== totalBlocks - 2}
+
+{/if}
diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte
index 56fa26ee0a..23dc63a060 100644
--- a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte
+++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte
@@ -5,24 +5,29 @@
import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte"
import { datasources } from "stores/backend"
import { IntegrationNames } from "constants"
+ import cloneDeep from "lodash/cloneDeepWith"
export let integration
+ export let modal
+
+ // kill the reference so the input isn't saved
+ let config = cloneDeep(integration)
function prepareData() {
let datasource = {}
let existingTypeCount = $datasources.list.filter(
- ds => ds.source == integration.type
+ ds => ds.source == config.type
).length
- let baseName = IntegrationNames[integration.type]
+ let baseName = IntegrationNames[config.type]
let name =
existingTypeCount == 0 ? baseName : `${baseName}-${existingTypeCount + 1}`
datasource.type = "datasource"
- datasource.source = integration.type
- datasource.config = integration.config
+ datasource.source = config.type
+ datasource.config = config.config
datasource.name = name
- datasource.plus = integration.plus
+ datasource.plus = config.plus
return datasource
}
@@ -48,9 +53,10 @@
saveDatasource()}
- confirmText={integration.plus
+ onCancel={() => modal.show()}
+ confirmText={config.plus
? "Fetch tables from database"
: "Save and continue to query"}
cancelText="Back"
@@ -62,10 +68,7 @@