clarify default value for property editor of flows

This commit is contained in:
Ruben Fiszel
2023-05-05 09:57:30 +02:00
parent 96ff45ecb5
commit e606e27cdb
3 changed files with 28 additions and 13 deletions

View File

@@ -14,6 +14,8 @@
import { flip } from 'svelte/animate'
import Portal from 'svelte-portal'
export let isFlowInput = false
const dispatch = createEventDispatcher()
export let schema: Schema = emptySchema()
@@ -286,6 +288,7 @@
<Portal>
<SchemaModal
{isFlowInput}
bind:this={schemaModal}
bind:property={modalProperty}
bind:error={argError}

View File

@@ -49,7 +49,7 @@
import StringTypeNarrowing from './StringTypeNarrowing.svelte'
import Required from './Required.svelte'
import ObjectTypeNarrowing from './ObjectTypeNarrowing.svelte'
import { Button } from './common'
import { Alert, Button } from './common'
import Toggle from '$lib/components/Toggle.svelte'
import DrawerContent from './common/drawer/DrawerContent.svelte'
import Drawer from './common/drawer/Drawer.svelte'
@@ -58,6 +58,7 @@
export let error = ''
export let editing = false
export let oldArgName: string | undefined = undefined
export let isFlowInput = false
let resource_type: string | undefined = undefined
@@ -173,18 +174,28 @@
</Button>
</div>
</div>
<div class="flex flex-row gap-x-4">
<ArgInput
label="Default"
bind:value={property.default}
type={property.selectedType}
pattern={property.pattern}
/>
<Toggle
options={{ right: 'Required' }}
class="mt-5 !justify-start"
bind:checked={property.required}
/>
<div>
<div class="flex flex-row gap-x-4">
<ArgInput
label="Default"
bind:value={property.default}
type={property.selectedType}
pattern={property.pattern}
/>
<Toggle
options={{ right: 'Required' }}
class="mt-5 !justify-start"
bind:checked={property.required}
/>
</div>
{#if isFlowInput}
<Alert type="info" title="Default not used by webhooks">
If this flow is triggered by a webhook, the default value will not replace a missing
value from the payload. It will only be used as the default value in the autogenerated
UI. We recommend using default values in the signature of the steps where this value is
used (using `x=default`) to have the desired behavior.</Alert
>
{/if}
</div>
{#if property.selectedType !== 'boolean'}
<div>

View File

@@ -40,6 +40,7 @@
</div>
<div class="pt-6">
<SchemaEditor
isFlowInput
bind:schema={$flowStore.schema}
on:change={() => {
$flowStore = $flowStore