Make workflow builder scrollable and improve UX around selecting and editing worflow blocks

This commit is contained in:
Andrew Kingston 2020-09-10 07:46:01 +01:00
parent 4d118b6eed
commit 6dcaa3c4d8
6 changed files with 100 additions and 64 deletions

View File

@ -15,7 +15,7 @@
} }
</script> </script>
<div class="bb-margin-xl block-field"> <div class="block-field">
<select class="budibase__input" bind:value={value.model}> <select class="budibase__input" bind:value={value.model}>
{#each $backendUiStore.models as model} {#each $backendUiStore.models as model}
<option value={model}>{model.name}</option> <option value={model}>{model.name}</option>

View File

@ -14,12 +14,13 @@
: [] : []
</script> </script>
<label class="selected-label">{workflowBlock.type}: {workflowBlock.name}</label> <div class="container">
<!-- <label class="selected-label">{workflowBlock.type}: {workflowBlock.name}</label> -->
{#each workflowParams as [parameter, type]} {#each workflowParams as [parameter, type]}
<div class="block-field"> <div class="block-field">
<label class="label">{parameter}</label> <label class="label">{parameter}</label>
{#if Array.isArray(type)} {#if Array.isArray(type)}
<Select bind:value={workflowBlock.args[parameter]} thin> <Select bind:value={workflowBlock.args[parameter]} thin secondary>
{#each type as option} {#each type as option}
<option value={option}>{option}</option> <option value={option}>{option}</option>
{/each} {/each}
@ -32,15 +33,14 @@
<option value="POWER_USER">Power User</option> <option value="POWER_USER">Power User</option>
</Select> </Select>
{:else if type === 'password'} {:else if type === 'password'}
<Input type="password" thin bind:value={workflowBlock.args[parameter]} /> <Input
type="password"
thin
bind:value={workflowBlock.args[parameter]} />
{:else if type === 'number'} {:else if type === 'number'}
<Input type="number" thin bind:value={workflowBlock.args[parameter]} /> <Input type="number" thin bind:value={workflowBlock.args[parameter]} />
{:else if type === 'longText'} {:else if type === 'longText'}
<TextArea <TextArea type="text" thin bind:value={workflowBlock.args[parameter]} />
type="text"
thin
bind:value={workflowBlock.args[parameter]}
label="" />
{:else if type === 'model'} {:else if type === 'model'}
<ModelSelector bind:value={workflowBlock.args[parameter]} /> <ModelSelector bind:value={workflowBlock.args[parameter]} />
{:else if type === 'record'} {:else if type === 'record'}
@ -50,8 +50,13 @@
{/if} {/if}
</div> </div>
{/each} {/each}
</div>
<style> <style>
.container {
margin-top: -20px;
}
.block-field { .block-field {
display: grid; display: grid;
} }

View File

@ -37,6 +37,7 @@
<section> <section>
<Flowchart blocks={uiTree} {onSelect} /> <Flowchart blocks={uiTree} {onSelect} />
</section>
<footer> <footer>
{#if selectedWorkflow} {#if selectedWorkflow}
<button <button
@ -55,13 +56,22 @@
</button> </button>
{/if} {/if}
</footer> </footer>
</section>
<style> <style>
section {
display: flex;
flex-direction: row;
justify-content: center;
align-items: flex-start;
overflow: auto;
height: 100%;
position: relative;
}
footer { footer {
position: absolute; position: absolute;
bottom: 0; bottom: 20px;
right: 0; right: 30px;
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
} }
@ -77,7 +87,9 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-right: 24px; }
footer > button:first-child {
margin-right: 20px;
} }
.play-button.highlighted { .play-button.highlighted {

View File

@ -7,7 +7,7 @@
</script> </script>
<section class="canvas"> <section class="canvas">
{#each blocks as block, idx} {#each blocks as block, idx (block.id)}
<FlowItem {onSelect} {block} /> <FlowItem {onSelect} {block} />
{#if idx !== blocks.length - 1} {#if idx !== blocks.length - 1}
<Arrow /> <Arrow />
@ -16,6 +16,11 @@
</section> </section>
<style> <style>
section {
position: absolute;
padding: 20px 40px;
}
.canvas { .canvas {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -1,15 +1,27 @@
<script> <script>
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
import { workflowStore } from "builderStore"
export let onSelect export let onSelect
export let block export let block
let selected = false
function selectBlock() { function selectBlock() {
onSelect(block) onSelect(block)
} }
$: selected =
$workflowStore.selectedWorkflowBlock != null &&
$workflowStore.selectedWorkflowBlock.id === block.id
console.log(selected)
</script> </script>
<div transition:fade class={`${block.type} hoverable`} on:click={selectBlock}> <div
transition:fade
class={`${block.type} hoverable`}
class:selected
on:click={selectBlock}>
<header> <header>
{#if block.type === 'TRIGGER'} {#if block.type === 'TRIGGER'}
<i class="ri-lightbulb-fill" /> <i class="ri-lightbulb-fill" />
@ -32,8 +44,8 @@
div { div {
width: 320px; width: 320px;
padding: 20px; padding: 20px;
border-radius: 5px; border-radius: var(--border-radius-m);
transition: 0.3s all; transition: 0.3s all ease;
box-shadow: 0 4px 30px 0 rgba(57, 60, 68, 0.08); box-shadow: 0 4px 30px 0 rgba(57, 60, 68, 0.08);
background-color: var(--ink); background-color: var(--ink);
font-size: 16px; font-size: 16px;
@ -69,9 +81,12 @@
p { p {
color: inherit; color: inherit;
margin-bottom: 0;
} }
div.selected,
div:hover { div:hover {
transform: scale(1.05); transform: scale(1.1);
box-shadow: 0 4px 30px 0 rgba(57, 60, 68, 0.15);
} }
</style> </style>

View File

@ -35,7 +35,6 @@
.content { .content {
flex: 1 1 auto; flex: 1 1 auto;
margin: 20px 40px;
} }
.nav { .nav {