Add possibility to retry with currently saved workflow

This commit is contained in:
Jan Oberhauser
2019-12-12 18:12:38 -06:00
parent b389854046
commit 359dc3b485
4 changed files with 42 additions and 8 deletions

View File

@@ -947,6 +947,18 @@ class App {
retryOf: req.params.id,
workflowData: fullExecutionData.workflowData,
};
if (req.body.loadWorkflow === true) {
// Loads the currently saved workflow to execute instead of the
// one saved at the time of the execution.
const workflowId = fullExecutionData.workflowData.id;
data.workflowData = await Db.collections.Workflow!.findOne(workflowId) as IWorkflowBase;
if (data.workflowData === undefined) {
throw new Error(`The workflow with the ID "${workflowId}" could not be found and so the data not be loaded for the retry.`);
}
}
const workflowRunner = new WorkflowRunner();
const executionId = await workflowRunner.run(data);