Fix workflow editing state binding, fix transitions and fix select placeholder options

This commit is contained in:
Andrew Kingston 2020-09-11 21:14:58 +01:00
parent 0b3ed7435e
commit 1c75824134
6 changed files with 11 additions and 19 deletions

View File

@ -8,7 +8,7 @@
<div class="block-field"> <div class="block-field">
<select class="budibase__input" bind:value={modelId}> <select class="budibase__input" bind:value={modelId}>
<option value="" /> <option value="">Choose an option</option>
{#each $backendUiStore.models as model} {#each $backendUiStore.models as model}
<option value={model._id}>{model.name}</option> <option value={model._id}>{model.name}</option>
{/each} {/each}

View File

@ -3,6 +3,8 @@
import { Input, Label } from "@budibase/bbui" import { Input, Label } from "@budibase/bbui"
export let value export let value
let modelId = value && value.model ? value.model._id : ""
$: value.model = $backendUiStore.models.find(x => x._id === modelId)
function setParsedValue(evt, field) { function setParsedValue(evt, field) {
const fieldSchema = value.model.schema[field] const fieldSchema = value.model.schema[field]
@ -10,15 +12,15 @@
value[field] = parseInt(evt.target.value) value[field] = parseInt(evt.target.value)
return return
} }
value[field] = evt.target.value value[field] = evt.target.value
} }
</script> </script>
<div class="block-field"> <div class="block-field">
<select class="budibase__input" bind:value={value.model}> <select class="budibase__input" bind:value={modelId}>
<option value="">Choose an option</option>
{#each $backendUiStore.models as model} {#each $backendUiStore.models as model}
<option value={model}>{model.name}</option> <option value={model._id}>{model.name}</option>
{/each} {/each}
</select> </select>
</div> </div>

View File

@ -15,6 +15,7 @@
<label class="label">{parameter}</label> <label class="label">{parameter}</label>
{#if Array.isArray(type)} {#if Array.isArray(type)}
<Select bind:value={block.args[parameter]} thin secondary> <Select bind:value={block.args[parameter]} thin secondary>
<option value="">Choose an option</option>
{#each type as option} {#each type as option}
<option value={option}>{option}</option> <option value={option}>{option}</option>
{/each} {/each}
@ -35,7 +36,7 @@
{:else if type === 'model'} {:else if type === 'model'}
<ModelSelector bind:value={block.args[parameter]} /> <ModelSelector bind:value={block.args[parameter]} />
{:else if type === 'record'} {:else if type === 'record'}
<RecordSelector value={block.args[parameter]} /> <RecordSelector bind:value={block.args[parameter]} />
{:else if type === 'string'} {:else if type === 'string'}
<Input type="text" thin bind:value={block.args[parameter]} /> <Input type="text" thin bind:value={block.args[parameter]} />
{/if} {/if}

View File

@ -4,8 +4,6 @@
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import Flowchart from "./flowchart/FlowChart.svelte" import Flowchart from "./flowchart/FlowChart.svelte"
let section
$: workflow = $: workflow =
$workflowStore.selectedWorkflow && $workflowStore.selectedWorkflow.workflow $workflowStore.selectedWorkflow && $workflowStore.selectedWorkflow.workflow
$: workflowLive = workflow && workflow.live $: workflowLive = workflow && workflow.live
@ -27,13 +25,9 @@
notifier.danger(`Workflow ${workflow.name} disabled.`) notifier.danger(`Workflow ${workflow.name} disabled.`)
} }
} }
afterUpdate(() => {
section.scrollTo(0, section.scrollHeight)
})
</script> </script>
<section bind:this={section}> <section>
<Flowchart {workflow} {onSelect} /> <Flowchart {workflow} {onSelect} />
</section> </section>
<footer> <footer>

View File

@ -1,9 +1,4 @@
<script>
import { fade } from "svelte/transition"
</script>
<svg <svg
transition:fade
width="9" width="9"
height="75" height="75"
viewBox="0 0 9 75" viewBox="0 0 9 75"

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 290 B

View File

@ -24,8 +24,8 @@
<div <div
class="block" class="block"
animate:flip={{ duration: 600 }} animate:flip={{ duration: 600 }}
in:fade in:fade|local
out:fly={{ x: 100 }}> out:fly|local={{ x: 100 }}>
<FlowItem {onSelect} {block} /> <FlowItem {onSelect} {block} />
{#if idx !== blocks.length - 1} {#if idx !== blocks.length - 1}
<Arrow /> <Arrow />