From 7fd79d3d4edee2b6ccde29e795bf75c9c7b02813 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 6 Sep 2021 14:31:55 +0100 Subject: [PATCH] Update flow chart styling and event handling --- .../bbui/src/ActionButton/ActionButton.svelte | 5 + .../AutomationBuilder.svelte | 1 - .../AutomationBuilder/FlowChart/Arrow.svelte | 1 + .../FlowChart/FlowChart.svelte | 80 +++++-- .../FlowChart/FlowItem.svelte | 224 ++++++++++++++---- .../FlowChart/TestDataModal.svelte | 12 + .../CreateAutomationModal.svelte | 31 ++- .../SetupPanel/AutomationBlockSetup.svelte | 8 +- .../automate/[automation]/_layout.svelte | 15 -- 9 files changed, 273 insertions(+), 104 deletions(-) create mode 100644 packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/automate/[automation]/_layout.svelte diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index 83f71d385b..b518ac3d92 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -12,6 +12,7 @@ export let dataCy = null export let size = "M" export let active = false + export let fullWidth = false function longPress(element) { if (!longPressable) return @@ -40,6 +41,7 @@ class:spectrum-ActionButton--quiet={quiet} class:spectrum-ActionButton--emphasized={emphasized} class:is-selected={selected} + class:fullWidth class="spectrum-ActionButton spectrum-ActionButton--size{size}" class:active {disabled} @@ -71,6 +73,9 @@ diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 439db62639..d36204897e 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -1,21 +1,83 @@
onSelect(block)} > -
- {#if block.type === "TRIGGER"} - - When this happens... - {:else if block.type === "ACTION"} - - Do this... - {:else if block.type === "LOGIC"} - - Only continue if... - {/if} -
- {#if block.type === "TRIGGER"}Trigger{:else}Step {blockIdx + 1}{/if} +
+
+ + + +
+ When this happens: + + {block.name.toUpperCase()} +
- {#if block.type !== "TRIGGER" || allowDeleteTrigger} -
- {/if} -
-
-

- -

+
+ +
+ +
+
{ + if (!setupComplete) { + setupToggled = !setupToggled + } + }} + class="toggle" + > + {#if setupToggled} + + {:else} + + {/if} + Setup +
+
deleteStep()}> + +
+
+ + {#if setupToggled} + + {#if block.inputs[schemaKey]} + + {/if} + {/if} +
+
+ + +
+ +
{ + if (setupComplete) { + testToggled = !testToggled + } + }} + class="toggle" + > + {#if testToggled} + + {:else} + + {/if} + Test +
+ {#if testToggled} + Add test data + + {/if} +
+
+ + + + + + + + + + + + diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte new file mode 100644 index 0000000000..31139fdc9e --- /dev/null +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte @@ -0,0 +1,12 @@ + + + + test + diff --git a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte index 43bb2ff777..799cd930dd 100644 --- a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte @@ -3,7 +3,7 @@ import { database } from "stores/backend" import { automationStore } from "builderStore" import { notifications } from "@budibase/bbui" - import { Input, ModalContent, Layout, Body } from "@budibase/bbui" + import { Input, ModalContent, Layout, Body, Icon } from "@budibase/bbui" import analytics from "analytics" let name @@ -18,17 +18,18 @@ name, instanceId, }) - const newBlock = await $automationStore.selectedAutomation.constructBlock( + const newBlock = $automationStore.selectedAutomation.constructBlock( "TRIGGER", triggerVal.stepId, triggerVal ) + automationStore.actions.addBlockToAutomation(newBlock) if (triggerVal.stepId === "WEBHOOK") { webhookModal.show() } - notifications.success(`Automation ${name} created.`) + $goto(`./${$automationStore.selectedAutomation.automation._id}`) analytics.captureEvent("Automation Created", { name }) } @@ -56,16 +57,16 @@ Triggers -
+
{#each triggers as [idx, trigger]}
selectTrigger(trigger)} > -
- - +
+ + {trigger.name}
@@ -76,13 +77,21 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/automate/[automation]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/automate/[automation]/_layout.svelte deleted file mode 100644 index 3be71a1bbe..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/automate/[automation]/_layout.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - -