fix debounce / store test data bug
This commit is contained in:
parent
a871a3a44f
commit
ab2fd51dc2
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
>
|
>
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
|
|
||||||
// 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
|
let 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
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
export let webhookModal
|
export let webhookModal
|
||||||
export let testData
|
export let testData
|
||||||
export let schemaProperties
|
export let schemaProperties
|
||||||
|
export let isTestModal = false
|
||||||
|
|
||||||
$: stepId = block.stepId
|
$: stepId = block.stepId
|
||||||
$: bindings = getAvailableBindings(
|
$: bindings = getAvailableBindings(
|
||||||
block || $automationStore.selectedBlock,
|
block || $automationStore.selectedBlock,
|
||||||
|
@ -29,8 +31,9 @@
|
||||||
|
|
||||||
$: inputData = testData ? testData : block.inputs
|
$: inputData = testData ? testData : block.inputs
|
||||||
|
|
||||||
const onChange = debounce(async function (e, key) {
|
const onChange = debounce(
|
||||||
if (testData) {
|
async function (e, key) {
|
||||||
|
if (isTestModal) {
|
||||||
testData[key] = e.detail
|
testData[key] = e.detail
|
||||||
} else {
|
} else {
|
||||||
block.inputs[key] = e.detail
|
block.inputs[key] = e.detail
|
||||||
|
@ -39,7 +42,9 @@
|
||||||
automation: $automationStore.selectedAutomation?.automation,
|
automation: $automationStore.selectedAutomation?.automation,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 800)
|
},
|
||||||
|
isTestModal ? 0 : 800
|
||||||
|
)
|
||||||
|
|
||||||
function getAvailableBindings(block, automation) {
|
function getAvailableBindings(block, automation) {
|
||||||
if (!block || !automation) {
|
if (!block || !automation) {
|
||||||
|
@ -91,7 +96,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]}
|
||||||
|
@ -99,6 +104,7 @@
|
||||||
type="email"
|
type="email"
|
||||||
on:change={e => onChange(e, key)}
|
on:change={e => onChange(e, key)}
|
||||||
{bindings}
|
{bindings}
|
||||||
|
fillWidth
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<DrawerBindableInput
|
<DrawerBindableInput
|
||||||
|
@ -152,7 +158,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]}
|
||||||
|
@ -164,7 +170,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}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
label={field.name}
|
label={field.name}
|
||||||
type="string"
|
type="string"
|
||||||
{bindings}
|
{bindings}
|
||||||
|
fillWidth={true}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
label={field}
|
label={field}
|
||||||
type="string"
|
type="string"
|
||||||
{bindings}
|
{bindings}
|
||||||
|
fillWidth={true}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue