Merge branch 'feature/automation-redesign' of github.com:Budibase/budibase into feature/automation-query

This commit is contained in:
mike12345567 2021-09-16 14:54:09 +01:00
commit 6d48dc85ef
8 changed files with 32 additions and 23 deletions

View File

@ -8,7 +8,7 @@
export let title export let title
export let fillWidth export let fillWidth
let visible = false let visible = false
$: console.log(fillWidth)
export function show() { export function show() {
if (visible) { if (visible) {
return return

View File

@ -19,7 +19,6 @@
export let onSelect export let onSelect
let testDataModal let testDataModal
let blocks let blocks
$: instanceId = $database._id $: instanceId = $database._id
$: { $: {
@ -69,7 +68,9 @@
<Icon name="DeleteOutline" /> <Icon name="DeleteOutline" />
</span> </span>
<ActionButton <ActionButton
on:click={() => testDataModal.show()} on:click={() => {
testDataModal.show()
}}
icon="MultipleCheck" icon="MultipleCheck"
size="S">Run test</ActionButton size="S">Run test</ActionButton
> >

View File

@ -18,12 +18,12 @@
// get the outputs so we can define the fields // get the outputs so we can define the fields
// check to see if there is existing test data in the store // check to see if there is existing test data in the store
let testData = $automationStore.selectedAutomation.automation.testData $: testData = $automationStore.selectedAutomation.automation.testData
// Check the schema to see if required fields have been entered // Check the schema to see if required fields have been entered
$: isError = !trigger.schema.outputs.required.every( $: isError = !trigger.schema.outputs.required.every(
required => testData[required] required => testData[required]
) )
function parseTestJSON(e) { function parseTestJSON(e) {
try { try {
const obj = JSON.parse(e.detail) const obj = JSON.parse(e.detail)
@ -52,6 +52,7 @@
<AutomationBlockSetup <AutomationBlockSetup
bind:testData bind:testData
{schemaProperties} {schemaProperties}
isTestModal
block={trigger} block={trigger}
/> />
</div></Tab </div></Tab

View File

@ -31,6 +31,7 @@
export let webhookModal export let webhookModal
export let testData export let testData
export let schemaProperties export let schemaProperties
export let isTestModal = false
let drawer let drawer
let tempFilters = lookForFilters(schemaProperties) || [] let tempFilters = lookForFilters(schemaProperties) || []
let fillWidth = true let fillWidth = true
@ -49,17 +50,20 @@
: { schema: {} } : { schema: {} }
$: schemaFields = table ? Object.values(table.schema) : [] $: schemaFields = table ? Object.values(table.schema) : []
const onChange = debounce(async function (e, key) { const onChange = debounce(
if (testData) { async function (e, key) {
testData[key] = e.detail if (isTestModal) {
} else { testData[key] = e.detail
block.inputs[key] = e.detail } else {
await automationStore.actions.save({ block.inputs[key] = e.detail
instanceId, await automationStore.actions.save({
automation: $automationStore.selectedAutomation?.automation, instanceId,
}) automation: $automationStore.selectedAutomation?.automation,
} })
}, 800) }
},
isTestModal ? 0 : 800
)
function getAvailableBindings(block, automation) { function getAvailableBindings(block, automation) {
if (!block || !automation) { if (!block || !automation) {
@ -160,7 +164,7 @@
value={inputData[key]} value={inputData[key]}
/> />
{:else if value.customType === "email"} {:else if value.customType === "email"}
{#if testData} {#if isTestModal}
<ModalBindableInput <ModalBindableInput
title={value.title} title={value.title}
value={inputData[key]} value={inputData[key]}
@ -168,6 +172,7 @@
type="email" type="email"
on:change={e => onChange(e, key)} on:change={e => onChange(e, key)}
{bindings} {bindings}
fillWidth
/> />
{:else} {:else}
<DrawerBindableInput <DrawerBindableInput
@ -221,7 +226,7 @@
/> />
</CodeEditorModal> </CodeEditorModal>
{:else if value.type === "string" || value.type === "number"} {:else if value.type === "string" || value.type === "number"}
{#if testData} {#if isTestModal}
<ModalBindableInput <ModalBindableInput
title={value.title} title={value.title}
value={inputData[key]} value={inputData[key]}
@ -233,7 +238,7 @@
{:else} {:else}
<div class="test"> <div class="test">
<DrawerBindableInput <DrawerBindableInput
fillWidth fillWidth={true}
title={value.title} title={value.title}
panel={AutomationBindingPanel} panel={AutomationBindingPanel}
type={value.customType} type={value.customType}

View File

@ -38,6 +38,7 @@
label={field.name} label={field.name}
type="string" type="string"
{bindings} {bindings}
fillWidth={true}
/> />
{/each} {/each}
</div> </div>

View File

@ -69,6 +69,7 @@
label={field} label={field}
type="string" type="string"
{bindings} {bindings}
fillWidth={true}
/> />
{/if} {/if}
{/if} {/if}

View File

@ -14,7 +14,7 @@
export let placeholder export let placeholder
export let label export let label
export let disabled = false export let disabled = false
export let fillWidth = false export let fillWidth
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let bindingDrawer let bindingDrawer

View File

@ -29,9 +29,9 @@
> >
<use xlink:href="#spectrum-icon-18-WorkflowAdd" /> <use xlink:href="#spectrum-icon-18-WorkflowAdd" />
</svg> </svg>
<Heading size="S">You have no automations</Heading> <Heading size="M">You have no automations</Heading>
<Body size="S">Let's fix that. Call the bots!</Body> <Body size="M">Let's fix that. Call the bots!</Body>
<Button on:click={() => modal.show()} size="S" cta <Button on:click={() => modal.show()} size="M" cta
>Create automation</Button >Create automation</Button
> >
</Layout> </Layout>