save inputted test data

This commit is contained in:
Peter Clement 2021-11-17 13:49:34 +00:00
parent 04cfca8b8e
commit 2d76c530f7
3 changed files with 27 additions and 26 deletions

View File

@ -87,7 +87,7 @@ const automationActions = store => ({
const response = await api.post(`/api/automations/${_id}/test`, testData) const response = await api.post(`/api/automations/${_id}/test`, testData)
const json = await response.json() const json = await response.json()
store.update(state => { store.update(state => {
state.selectedAutomation.testResults = json state.selectedAutomation.automation.testResults = json
return state return state
}) })
}, },

View File

@ -25,9 +25,10 @@
let resultsModal let resultsModal
let setupToggled let setupToggled
let blockComplete let blockComplete
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( $: testResult =
step => step.stepId === block.stepId $automationStore.selectedAutomation.automation.testResults?.steps.filter(
) step => step.stepId === block.stepId
)
$: isTrigger = block.type === "TRIGGER" $: isTrigger = block.type === "TRIGGER"

View File

@ -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) {