Merge branch 'contextual-workflows' of github.com:Budibase/budibase into contextual-workflows

This commit is contained in:
mike12345567 2020-09-18 13:52:17 +01:00
commit 9c80e1102d
4 changed files with 35 additions and 18 deletions

View File

@ -1,12 +0,0 @@
<script>
export let value
$:
</script>
<div>
</div>
<style>
</style>

View File

@ -1,6 +1,6 @@
<script> <script>
import mustache from "mustache"
import { workflowStore, backendUiStore } from "builderStore" import { workflowStore, backendUiStore } from "builderStore"
import WorkflowBlockTagline from "./WorkflowBlockTagline.svelte"
export let onSelect export let onSelect
export let block export let block
@ -26,7 +26,6 @@
} }
$: inputs = enrichInputs(block.inputs) $: inputs = enrichInputs(block.inputs)
$: tagline = block.tagline.replace(/{{/g, "<b>{{").replace(/}}/, "}}</b>")
</script> </script>
<div <div
@ -41,7 +40,7 @@
<i class="ri-flashlight-fill" /> <i class="ri-flashlight-fill" />
<span>Do this...</span> <span>Do this...</span>
{:else if block.type === 'LOGIC'} {:else if block.type === 'LOGIC'}
<i class="ri-pause-fill" /> <i class="ri-git-branch-line" />
<span>Only continue if...</span> <span>Only continue if...</span>
{/if} {/if}
<div class="label"> <div class="label">
@ -50,7 +49,7 @@
</header> </header>
<hr /> <hr />
<p> <p>
{@html mustache.render(tagline, { inputs })} <WorkflowBlockTagline tagline={block.tagline} {inputs} />
</p> </p>
</div> </div>
@ -87,7 +86,7 @@
padding: var(--spacing-s); padding: var(--spacing-s);
color: var(--grey-8); color: var(--grey-8);
border-radius: var(--border-radius-m); border-radius: var(--border-radius-m);
background-color: var(--grey-2); background-color: rgba(0, 0, 0, 0.05);
} }
header i { header i {
font-size: 20px; font-size: 20px;

View File

@ -0,0 +1,30 @@
<script>
import mustache from "mustache"
export let tagline
export let inputs
// Add bolt tags around inputs
$: boldTagline = tagline.replace(/{{/g, "<b>{{").replace(/}}/, "}}</b>")
// Fill in inputs with mustache
$: parsedTagline = mustache.render(boldTagline, { inputs })
// Wrap bound fields inside spans to highlight them
$: html = (parsedTagline || "")
.replace(/{{\s/g, "<span>")
.replace(/\s}}/g, "</span>")
</script>
<div>
{@html html}
</div>
<style>
div :global(span) {
font-size: 0.9em;
background-color: var(--purple-light);
padding: var(--spacing-xs);
border-radius: var(--border-radius-m);
}
</style>

View File

@ -14,7 +14,7 @@ const PrettyLogicConditions = {
module.exports.definition = { module.exports.definition = {
name: "Filter", name: "Filter",
tagline: "{{inputs.filter}} {{inputs.condition}} {{inputs.value}}", tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
icon: "ri-git-branch-line", icon: "ri-git-branch-line",
description: "Filter any workflows which do not meet certain conditions", description: "Filter any workflows which do not meet certain conditions",
type: "LOGIC", type: "LOGIC",