From 1e099b9b5ad4e5d46d9731af76728df2983abdd5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 17 Sep 2020 14:18:22 +0100 Subject: [PATCH] Use user readable enums in workflow block setup fields --- .../SetupPanel/WorkflowBlockSetup.svelte | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte index dd8fa2811d..c2c3a21695 100644 --- a/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte @@ -7,7 +7,7 @@ export let block $: inputs = Object.entries(block.schema?.inputs?.properties || {}) - $: availableBindings = getAvailableBindings( + $: bindings = getAvailableBindings( block, $workflowStore.selectedWorkflow?.workflow?.definition ) @@ -16,8 +16,15 @@ if (!block || !workflow) { return [] } - const allSteps = [workflow.trigger, ...workflow.steps] + + // Find previous steps to the selected one + let allSteps = [...workflow.steps] + if (workflow.trigger) { + allSteps = [workflow.trigger, ...allSteps] + } const blockIdx = allSteps.findIndex(step => step.id === block.id) + + // Extract all outputs from all previous steps as available bindings let bindings = [] for (let idx = 0; idx < blockIdx; idx++) { const outputs = Object.entries(allSteps[idx].schema?.outputs?.properties) @@ -43,26 +50,24 @@ {#if value.type === 'string' && value.enum} {:else if value.customType === 'password'} - {:else if value.type === 'number'} - - {:else if value.customType === 'longText'} -