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);
}
private getLocalLoadOptionsContext(path: string, additionalData: IWorkflowExecuteAdditionalData) {
private getLocalLoadOptionsContext(
path: string,
additionalData: IWorkflowExecuteAdditionalData,
): ILocalLoadOptionsFunctions {
return new LocalLoadOptionsContext(
this.nodeTypes,
additionalData,

View file

@ -26,25 +26,29 @@ export class LocalLoadOptionsContext implements ILocalLoadOptionsFunctions {
const workflowId = value as string;
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 workflowNode = dbWorkflow.nodes.find((node) => node.type === nodeType) as INode;
const selectedWorkflowNode = dbWorkflow.nodes.find((node) => node.type === nodeType) as INode;
if (workflowNode) {
const workflow = new Workflow({
nodes: [workflowNode],
if (selectedWorkflowNode) {
const selectedSingleNodeWorkflow = new Workflow({
nodes: [selectedWorkflowNode],
connections: {},
active: false,
nodeTypes: this.nodeTypes,
});
const workflowAdditionalData = deepCopy(this.additionalData);
workflowAdditionalData.currentNodeParameters = workflowNode.parameters;
const workflowAdditionalData = { ...this.additionalData };
workflowAdditionalData.currentNodeParameters = selectedWorkflowNode.parameters;
return new LoadWorkflowNodeContext(workflow, workflowNode, workflowAdditionalData);
return new LoadWorkflowNodeContext(
selectedSingleNodeWorkflow,
selectedWorkflowNode,
workflowAdditionalData,
);
}
return null;