🐛 Fix bug with sibling loading with fixedCollections

This commit is contained in:
Jan Oberhauser 2021-05-16 19:25:04 -05:00
parent 002f53a4af
commit bf7800cb15
2 changed files with 12 additions and 19 deletions

View file

@ -230,7 +230,7 @@ export default mixins(
// Get the resolved parameter values of the current node
const currentNodeParameters = this.$store.getters.activeNode.parameters;
const resolvedNodeParameters = this.getResolveNodeParameters(currentNodeParameters);
const resolvedNodeParameters = this.resolveParameter(currentNodeParameters);
const returnValues: string[] = [];
for (const parameterPath of loadOptionsDependsOn) {
@ -456,21 +456,6 @@ export default mixins(
},
},
methods: {
getResolveNodeParameters (nodeParameters: INodeParameters): INodeParameters {
const returnData: INodeParameters = {};
for (const key of Object.keys(nodeParameters)) {
if (Array.isArray(nodeParameters[key])) {
returnData[key] = (nodeParameters[key] as string[]).map(value => {
return this.resolveExpression(value as string) as string;
});
} else if (typeof nodeParameters[key] === 'object') {
returnData[key] = this.getResolveNodeParameters(nodeParameters[key] as INodeParameters) as INodeParameters;
} else {
returnData[key] = this.resolveExpression(nodeParameters[key] as string, nodeParameters) as NodeParameterValue;
}
}
return returnData;
},
async loadRemoteParameterOptions () {
if (this.node === null || this.remoteMethod === undefined || this.remoteParameterOptionsLoading) {
return;
@ -481,7 +466,7 @@ export default mixins(
// Get the resolved parameter values of the current node
const currentNodeParameters = this.$store.getters.activeNode.parameters;
const resolvedNodeParameters = this.getResolveNodeParameters(currentNodeParameters);
const resolvedNodeParameters = this.resolveParameter(currentNodeParameters) as INodeParameters;
try {
const options = await this.restApi().getNodeParameterOptions(this.node.type, this.path, this.remoteMethod, resolvedNodeParameters, this.node.credentials);

View file

@ -7,6 +7,7 @@ import {
INodeExecutionData,
INodeIssues,
INodeParameters,
NodeParameterValue,
INodeType,
INodeTypes,
INodeTypeData,
@ -337,7 +338,8 @@ export const workflowHelpers = mixins(
return nodeData;
},
resolveExpression (expression: string, siblingParameters: INodeParameters = {}) {
resolveParameter(parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]) {
const inputIndex = 0;
const itemIndex = 0;
const runIndex = 0;
@ -363,13 +365,19 @@ export const workflowHelpers = mixins(
connectionInputData = [];
}
return workflow.expression.getParameterValue(parameter, runExecutionData, runIndex, itemIndex, activeNode.name, connectionInputData, 'manual', false) as IDataObject;
},
resolveExpression(expression: string, siblingParameters: INodeParameters = {}) {
const parameters = {
'__xxxxxxx__': expression,
...siblingParameters,
};
const returnData = workflow.expression.getParameterValue(parameters, runExecutionData, runIndex, itemIndex, activeNode.name, connectionInputData, 'manual', false) as IDataObject;
const returnData = this.resolveParameter(parameters) as IDataObject;
if (typeof returnData['__xxxxxxx__'] === 'object') {
const workflow = this.getWorkflow();
return workflow.expression.convertObjectValueToString(returnData['__xxxxxxx__'] as object);
}
return returnData['__xxxxxxx__'];