From 2d76c530f781cfa2f52a459a70ac9b6d9f5e691e Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 17 Nov 2021 13:49:34 +0000 Subject: [PATCH 1/9] save inputted test data --- .../builderStore/store/automation/index.js | 2 +- .../FlowChart/FlowItem.svelte | 7 +-- .../SetupPanel/AutomationBlockSetup.svelte | 44 +++++++++---------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 16cc490bb..50a1f476e 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -87,7 +87,7 @@ const automationActions = store => ({ const response = await api.post(`/api/automations/${_id}/test`, testData) const json = await response.json() store.update(state => { - state.selectedAutomation.testResults = json + state.selectedAutomation.automation.testResults = json return state }) }, diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 7ddc5c3e4..5ce55437b 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -25,9 +25,10 @@ let resultsModal let setupToggled let blockComplete - $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( - step => step.stepId === block.stepId - ) + $: testResult = + $automationStore.selectedAutomation.automation.testResults?.steps.filter( + step => step.stepId === block.stepId + ) $: isTrigger = block.type === "TRIGGER" diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 874a0e68e..e7208518d 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -51,31 +51,31 @@ : { schema: {} } $: schemaFields = table ? Object.values(table.schema) : [] - const onChange = debounce( - async function (e, key) { - if (isTestModal) { - // Special case for webhook, as it requires a body, but the schema already brings back the body's contents - if (stepId === "WEBHOOK") { - automationStore.actions.addTestDataToAutomation({ - body: { - [key]: e.detail, - ...$automationStore.selectedAutomation.automation.testData.body, - }, - }) - } + const onChange = debounce(async function (e, key) { + if (isTestModal) { + // Special case for webhook, as it requires a body, but the schema already brings back the body's contents + if (stepId === "WEBHOOK") { automationStore.actions.addTestDataToAutomation({ - [key]: e.detail, + body: { + [key]: e.detail, + ...$automationStore.selectedAutomation.automation.testData.body, + }, }) - testData[key] = e.detail - } else { - block.inputs[key] = e.detail - await automationStore.actions.save( - $automationStore.selectedAutomation?.automation - ) } - }, - isTestModal ? 0 : 800 - ) + automationStore.actions.addTestDataToAutomation({ + [key]: e.detail, + }) + testData[key] = e.detail + await automationStore.actions.save( + $automationStore.selectedAutomation?.automation + ) + } else { + block.inputs[key] = e.detail + await automationStore.actions.save( + $automationStore.selectedAutomation?.automation + ) + } + }, 800) function getAvailableBindings(block, automation) { if (!block || !automation) { From e81a008a1a3d4001b9936c4cfbf196c573304a82 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 17 Nov 2021 14:28:14 +0000 Subject: [PATCH 2/9] fix animation issue with automation blocks --- .../automation/AutomationBuilder/FlowChart/FlowChart.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index fee8afd71..2d6881d65 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -84,7 +84,6 @@ class="block" animate:flip={{ duration: 500 }} in:fly|local={{ x: 500, duration: 1500 }} - out:fly|local={{ x: 500, duration: 800 }} > From ace9d9b878ea8b260d3b6130d4c97ac354ab4a2d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 18 Nov 2021 11:41:51 +0000 Subject: [PATCH 3/9] fix bug with test results --- .../builder/src/builderStore/store/automation/index.js | 4 +++- .../automation/AutomationBuilder/FlowChart/FlowItem.svelte | 7 +++---- .../automation/AutomationPanel/AutomationList.svelte | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 50a1f476e..7bd0ccca2 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -87,13 +87,15 @@ const automationActions = store => ({ const response = await api.post(`/api/automations/${_id}/test`, testData) const json = await response.json() store.update(state => { - state.selectedAutomation.automation.testResults = json + state.selectedAutomation.testResults = json return state }) }, select: automation => { store.update(state => { + let testResults = state.selectedAutomation?.testResults state.selectedAutomation = new Automation(cloneDeep(automation)) + state.selectedAutomation.testResults = testResults state.selectedBlock = null return state }) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 5ce55437b..ba80e195a 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -25,11 +25,10 @@ let resultsModal let setupToggled let blockComplete - $: testResult = - $automationStore.selectedAutomation.automation.testResults?.steps.filter( - step => step.stepId === block.stepId - ) + $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( + step => step.stepId === block.stepId + ) $: isTrigger = block.type === "TRIGGER" $: selected = $automationStore.selectedBlock?.id === block.id diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte index 79de4bfbe..aa3ab027a 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte @@ -9,6 +9,7 @@ onMount(() => { automationStore.actions.fetch() }) + function selectAutomation(automation) { automationStore.actions.select(automation) $goto(`./${automation._id}`) From c40cffc34d47f27fea9845a0ce0c8f9d758fcb19 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 18 Nov 2021 14:29:31 +0000 Subject: [PATCH 4/9] remove uneeded add action button --- .../AutomationBuilder/FlowChart/FlowItem.svelte | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index ba80e195a..7f379ba13 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -150,15 +150,6 @@ >Finish and test automation {/if} - {/if} From 48942a6b850eb24e831db7fc3e8576fd41f8bd0f Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 18 Nov 2021 15:14:23 +0000 Subject: [PATCH 5/9] disable ability to rename external datasource --- .../backend/TableNavigator/popovers/EditTablePopover.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index 04094b881..64c6c0225 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -22,7 +22,7 @@ let templateScreens let willBeDeleted - $: external = table?.type === "external" + $: internal = table?.type === "internal" function showDeleteModal() { templateScreens = $allScreens.filter( @@ -66,7 +66,9 @@
- Edit + {#if internal} + Edit + {/if} Delete From e91a8a175e0e49d3951055673f8c38e9452631ef Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 22 Nov 2021 09:43:57 +0000 Subject: [PATCH 6/9] fix broken automation test --- packages/builder/cypress/integration/createAutomation.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js index 0620a15e2..afd405d5a 100644 --- a/packages/builder/cypress/integration/createAutomation.spec.js +++ b/packages/builder/cypress/integration/createAutomation.spec.js @@ -22,9 +22,9 @@ context("Create a automation", () => { cy.get(".spectrum-Picker-label").click() cy.wait(500) cy.contains("dog").click() - + cy.wait(2000) // Create action - cy.contains("Add Action").click() + cy.get(".block > .spectrum-Icon").click() cy.get(".modal-inner-wrapper").within(() => { cy.wait(1000) cy.contains("Create Row").trigger('mouseover').click().click() From 6c9461834ea3d81aae68913ee66bb940b361959d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 22 Nov 2021 10:07:30 +0000 Subject: [PATCH 7/9] remove delete button for datasource plus --- .../backend/TableNavigator/popovers/EditTablePopover.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index 64c6c0225..118786d66 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -68,8 +68,8 @@ {#if internal} Edit + Delete {/if} - Delete From 088e96332a30cd89fa0e9f003f193a8c115b49dd Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 22 Nov 2021 10:09:27 +0000 Subject: [PATCH 8/9] Revert "remove delete button for datasource plus" This reverts commit 6c9461834ea3d81aae68913ee66bb940b361959d. --- .../backend/TableNavigator/popovers/EditTablePopover.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index 118786d66..64c6c0225 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -68,8 +68,8 @@ {#if internal} Edit - Delete {/if} + Delete From b1b5197a3141d01f81619ac479c2b7375fd6b4e9 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 23 Nov 2021 13:54:05 +0000 Subject: [PATCH 9/9] show datasource plus popover conditionally --- .../popovers/EditTablePopover.svelte | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index d2c2692b4..0211a3755 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -72,17 +72,17 @@ } - -
- -
- {#if external} - Edit - {/if} - {#if allowDeletion} +{#if allowDeletion} + +
+ +
+ {#if !external} + Edit + {/if} Delete - {/if} -
+
+{/if}