fix merge conflicts, make arguments more consistent

This commit is contained in:
Maurits Lourens 2021-09-16 23:20:31 +02:00
parent 1116b1de16
commit 931ec7bfd9
8 changed files with 27 additions and 27 deletions

View File

@ -78,11 +78,11 @@ const automationActions = store => ({
return state return state
}) })
}, },
trigger: async ({ automation }) => { trigger: async automation => {
const { _id } = automation const { _id } = automation
return await api.post(`/api/automations/${_id}/trigger`) return await api.post(`/api/automations/${_id}/trigger`)
}, },
test: async ({ automation }, testData) => { test: async (automation, testData) => {
const { _id } = automation const { _id } = automation
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()

View File

@ -38,10 +38,9 @@
actionVal actionVal
) )
automationStore.actions.addBlockToAutomation(newBlock) automationStore.actions.addBlockToAutomation(newBlock)
await automationStore.actions.save({ await automationStore.actions.save(
instanceId, $automationStore.selectedAutomation?.automation
automation: $automationStore.selectedAutomation?.automation, )
})
} }
</script> </script>

View File

@ -32,16 +32,15 @@
} }
async function deleteAutomation() { async function deleteAutomation() {
await automationStore.actions.delete({ await automationStore.actions.delete(
instanceId, $automationStore.selectedAutomation?.automation
automation: $automationStore.selectedAutomation?.automation, )
})
} }
async function testAutomation() { async function testAutomation() {
const result = await automationStore.actions.trigger({ const result = await automationStore.actions.trigger(
automation: $automationStore.selectedAutomation.automation, $automationStore.selectedAutomation.automation
}) )
if (result.status === 200) { if (result.status === 200) {
notifications.success( notifications.success(
`Automation ${$automationStore.selectedAutomation.automation.name} triggered successfully.` `Automation ${$automationStore.selectedAutomation.automation.name} triggered successfully.`

View File

@ -52,10 +52,9 @@
async function deleteStep() { async function deleteStep() {
automationStore.actions.deleteAutomationBlock(block) automationStore.actions.deleteAutomationBlock(block)
await automationStore.actions.save({ await automationStore.actions.save(
instanceId, $automationStore.selectedAutomation?.automation
automation: $automationStore.selectedAutomation?.automation, )
})
} }
</script> </script>

View File

@ -42,7 +42,10 @@
disabled={isError} disabled={isError}
onConfirm={() => { onConfirm={() => {
automationStore.actions.addTestDataToAutomation(testData) automationStore.actions.addTestDataToAutomation(testData)
automationStore.actions.test($automationStore.selectedAutomation, testData) automationStore.actions.test(
$automationStore.selectedAutomation?.automation,
testData
)
}} }}
cancelText="Cancel" cancelText="Cancel"
> >

View File

@ -29,10 +29,9 @@
webhookModal.show webhookModal.show
} }
await automationStore.actions.save({ await automationStore.actions.save(
instanceId, $automationStore.selectedAutomation?.automation
automation: $automationStore.selectedAutomation?.automation, )
})
notifications.success(`Automation ${name} created.`) notifications.success(`Automation ${name} created.`)

View File

@ -56,10 +56,9 @@
testData[key] = e.detail testData[key] = e.detail
} else { } else {
block.inputs[key] = e.detail block.inputs[key] = e.detail
await automationStore.actions.save({ await automationStore.actions.save(
instanceId, $automationStore.selectedAutomation?.automation
automation: $automationStore.selectedAutomation?.automation, )
})
} }
}, },
isTestModal ? 0 : 800 isTestModal ? 0 : 800

View File

@ -46,7 +46,9 @@
} }
automationStore.actions.addBlockToAutomation(newBlock) automationStore.actions.addBlockToAutomation(newBlock)
await automationStore.actions.save($automationStore.selectedAutomation) await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
parameters.automationId = $automationStore.selectedAutomation.automation._id parameters.automationId = $automationStore.selectedAutomation.automation._id
delete parameters.newAutomationName delete parameters.newAutomationName
} }