From 5311c8ee7e75309e9d9c7672c8a86ae77bd71dd4 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 16cc490bb2..50a1f476ef 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 7ddc5c3e48..5ce55437be 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 874a0e68eb..e7208518d5 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 f237cd891e2bf5a7204bc3c23bf606a202464953 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 fee8afd711..2d6881d652 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 b902e017dd3b7fbc57befac08a2b011021ef95c7 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 50a1f476ef..7bd0ccca22 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 5ce55437be..ba80e195ab 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 79de4bfbe6..aa3ab027a8 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 d16ea9108247bb8ffcf61bbcf38edd53b91e3531 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 ba80e195ab..7f379ba138 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 0b8c074b81ea8c793df51dc12fb541237664c0c9 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 04094b881a..64c6c0225a 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 8581c06721e6872a00e9f3d27f2ec6abb4bd2235 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 0620a15e25..afd405d5ab 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 fbe1b02e934740d9ff2ea72af68f1a2ae4783753 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 64c6c0225a..118786d66c 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 cc019feab1ab0ceec23aeaddf13a19c0a0720a6f 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 fbe1b02e934740d9ff2ea72af68f1a2ae4783753. --- .../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 118786d66c..64c6c0225a 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 b2fbe308be0a0b97ee0b03b4555110524a9c3b10 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 d2c2692b42..0211a37557 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}