addressing comments

This commit is contained in:
Ivan Atanasov 2024-12-05 16:14:42 +01:00
parent f5b7ecdcda
commit 814eec2c19
No known key found for this signature in database
2 changed files with 16 additions and 9 deletions

View file

@ -299,7 +299,10 @@ export class DynamicNodeParametersService {
return new LoadOptionsContext(workflow, node, additionalData, path); return new LoadOptionsContext(workflow, node, additionalData, path);
} }
private getLocalLoadOptionsContext(path: string, additionalData: IWorkflowExecuteAdditionalData) { private getLocalLoadOptionsContext(
path: string,
additionalData: IWorkflowExecuteAdditionalData,
): ILocalLoadOptionsFunctions {
return new LocalLoadOptionsContext( return new LocalLoadOptionsContext(
this.nodeTypes, this.nodeTypes,
additionalData, additionalData,

View file

@ -26,25 +26,29 @@ export class LocalLoadOptionsContext implements ILocalLoadOptionsFunctions {
const workflowId = value as string; const workflowId = value as string;
if (!workflowId) { if (!workflowId) {
throw new ApplicationError('No workflowId parameter defined on node!'); throw new ApplicationError(`No workflowId parameter defined on node of type "${nodeType}"!`);
} }
const dbWorkflow = await this.workflowLoader.get(workflowId); const dbWorkflow = await this.workflowLoader.get(workflowId);
const workflowNode = dbWorkflow.nodes.find((node) => node.type === nodeType) as INode; const selectedWorkflowNode = dbWorkflow.nodes.find((node) => node.type === nodeType) as INode;
if (workflowNode) { if (selectedWorkflowNode) {
const workflow = new Workflow({ const selectedSingleNodeWorkflow = new Workflow({
nodes: [workflowNode], nodes: [selectedWorkflowNode],
connections: {}, connections: {},
active: false, active: false,
nodeTypes: this.nodeTypes, nodeTypes: this.nodeTypes,
}); });
const workflowAdditionalData = deepCopy(this.additionalData); const workflowAdditionalData = { ...this.additionalData };
workflowAdditionalData.currentNodeParameters = workflowNode.parameters; workflowAdditionalData.currentNodeParameters = selectedWorkflowNode.parameters;
return new LoadWorkflowNodeContext(workflow, workflowNode, workflowAdditionalData); return new LoadWorkflowNodeContext(
selectedSingleNodeWorkflow,
selectedWorkflowNode,
workflowAdditionalData,
);
} }
return null; return null;