From e79d4f11c99630e6aa70772e1ebae5a2f68ab6ef Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 14 Sep 2020 09:33:18 +0100 Subject: [PATCH] Add working test workflow button --- packages/builder/src/builderStore/store/workflow/index.js | 5 +++++ .../src/components/workflow/SetupPanel/SetupPanel.svelte | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/builderStore/store/workflow/index.js b/packages/builder/src/builderStore/store/workflow/index.js index 74a2b86359..947bb6edda 100644 --- a/packages/builder/src/builderStore/store/workflow/index.js +++ b/packages/builder/src/builderStore/store/workflow/index.js @@ -68,6 +68,11 @@ const workflowActions = store => ({ return state }) }, + trigger: async ({ workflow }) => { + const { _id } = workflow + const TRIGGER_WORKFLOW_URL = `/api/workflows/${_id}/trigger` + return await api.post(TRIGGER_WORKFLOW_URL) + }, select: workflow => { store.update(state => { state.selectedWorkflow = new Workflow(cloneDeep(workflow)) diff --git a/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte index 09478d5e13..2c1d1928e3 100644 --- a/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte @@ -28,7 +28,10 @@ notifier.info("Workflow block deleted.") } - function testWorkflow() { + async function testWorkflow() { + const result = await workflowStore.actions.trigger({ + workflow: $workflowStore.selectedWorkflow.workflow, + }) testResult = "Workflow passed" }