Merge pull request #3441 from Budibase/fix/pc-generic-fixes
Save automation test data
This commit is contained in:
commit
70c522a06a
|
@ -22,9 +22,9 @@ context("Create a automation", () => {
|
||||||
cy.get(".spectrum-Picker-label").click()
|
cy.get(".spectrum-Picker-label").click()
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.contains("dog").click()
|
cy.contains("dog").click()
|
||||||
|
cy.wait(2000)
|
||||||
// Create action
|
// Create action
|
||||||
cy.contains("Add Action").click()
|
cy.get(".block > .spectrum-Icon").click()
|
||||||
cy.get(".modal-inner-wrapper").within(() => {
|
cy.get(".modal-inner-wrapper").within(() => {
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
cy.contains("Create Row").trigger('mouseover').click().click()
|
cy.contains("Create Row").trigger('mouseover').click().click()
|
||||||
|
|
|
@ -93,7 +93,9 @@ const automationActions = store => ({
|
||||||
},
|
},
|
||||||
select: automation => {
|
select: automation => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
|
let testResults = state.selectedAutomation?.testResults
|
||||||
state.selectedAutomation = new Automation(cloneDeep(automation))
|
state.selectedAutomation = new Automation(cloneDeep(automation))
|
||||||
|
state.selectedAutomation.testResults = testResults
|
||||||
state.selectedBlock = null
|
state.selectedBlock = null
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
class="block"
|
class="block"
|
||||||
animate:flip={{ duration: 500 }}
|
animate:flip={{ duration: 500 }}
|
||||||
in:fly|local={{ x: 500, duration: 1500 }}
|
in:fly|local={{ x: 500, duration: 1500 }}
|
||||||
out:fly|local={{ x: 500, duration: 800 }}
|
|
||||||
>
|
>
|
||||||
<FlowItem {testDataModal} {testAutomation} {onSelect} {block} />
|
<FlowItem {testDataModal} {testAutomation} {onSelect} {block} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
let resultsModal
|
let resultsModal
|
||||||
let setupToggled
|
let setupToggled
|
||||||
let blockComplete
|
let blockComplete
|
||||||
|
|
||||||
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter(
|
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter(
|
||||||
step => step.stepId === block.stepId
|
step => step.stepId === block.stepId
|
||||||
)
|
)
|
||||||
|
|
||||||
$: isTrigger = block.type === "TRIGGER"
|
$: isTrigger = block.type === "TRIGGER"
|
||||||
|
|
||||||
$: selected = $automationStore.selectedBlock?.id === block.id
|
$: selected = $automationStore.selectedBlock?.id === block.id
|
||||||
|
@ -150,15 +150,6 @@
|
||||||
>Finish and test automation</Button
|
>Finish and test automation</Button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<Button
|
|
||||||
disabled={!hasCompletedInputs}
|
|
||||||
on:click={() => {
|
|
||||||
setupToggled = false
|
|
||||||
actionModal.show()
|
|
||||||
}}
|
|
||||||
primary={!isTrigger}
|
|
||||||
cta={isTrigger}>Add Action</Button
|
|
||||||
>
|
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
automationStore.actions.fetch()
|
automationStore.actions.fetch()
|
||||||
})
|
})
|
||||||
|
|
||||||
function selectAutomation(automation) {
|
function selectAutomation(automation) {
|
||||||
automationStore.actions.select(automation)
|
automationStore.actions.select(automation)
|
||||||
$goto(`./${automation._id}`)
|
$goto(`./${automation._id}`)
|
||||||
|
|
|
@ -51,31 +51,31 @@
|
||||||
: { schema: {} }
|
: { schema: {} }
|
||||||
$: schemaFields = table ? Object.values(table.schema) : []
|
$: schemaFields = table ? Object.values(table.schema) : []
|
||||||
|
|
||||||
const onChange = debounce(
|
const onChange = debounce(async function (e, key) {
|
||||||
async function (e, key) {
|
if (isTestModal) {
|
||||||
if (isTestModal) {
|
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents
|
||||||
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents
|
if (stepId === "WEBHOOK") {
|
||||||
if (stepId === "WEBHOOK") {
|
|
||||||
automationStore.actions.addTestDataToAutomation({
|
|
||||||
body: {
|
|
||||||
[key]: e.detail,
|
|
||||||
...$automationStore.selectedAutomation.automation.testData.body,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
automationStore.actions.addTestDataToAutomation({
|
automationStore.actions.addTestDataToAutomation({
|
||||||
[key]: e.detail,
|
body: {
|
||||||
|
[key]: e.detail,
|
||||||
|
...$automationStore.selectedAutomation.automation.testData.body,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
testData[key] = e.detail
|
|
||||||
} else {
|
|
||||||
block.inputs[key] = e.detail
|
|
||||||
await automationStore.actions.save(
|
|
||||||
$automationStore.selectedAutomation?.automation
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
},
|
automationStore.actions.addTestDataToAutomation({
|
||||||
isTestModal ? 0 : 800
|
[key]: e.detail,
|
||||||
)
|
})
|
||||||
|
testData[key] = e.detail
|
||||||
|
await automationStore.actions.save(
|
||||||
|
$automationStore.selectedAutomation?.automation
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
block.inputs[key] = e.detail
|
||||||
|
await automationStore.actions.save(
|
||||||
|
$automationStore.selectedAutomation?.automation
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}, 800)
|
||||||
|
|
||||||
function getAvailableBindings(block, automation) {
|
function getAvailableBindings(block, automation) {
|
||||||
if (!block || !automation) {
|
if (!block || !automation) {
|
||||||
|
|
|
@ -72,15 +72,17 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ActionMenu>
|
{#if allowDeletion}
|
||||||
<div slot="control" class="icon">
|
<ActionMenu>
|
||||||
<Icon s hoverable name="MoreSmallList" />
|
<div slot="control" class="icon">
|
||||||
</div>
|
<Icon s hoverable name="MoreSmallList" />
|
||||||
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
|
</div>
|
||||||
{#if allowDeletion}
|
{#if !external}
|
||||||
|
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
|
||||||
|
{/if}
|
||||||
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
|
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
|
||||||
{/if}
|
</ActionMenu>
|
||||||
</ActionMenu>
|
{/if}
|
||||||
|
|
||||||
<Modal bind:this={editorModal}>
|
<Modal bind:this={editorModal}>
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
|
Loading…
Reference in New Issue