Fix issue with option parameters that are named the same #1808

This commit is contained in:
Jan Oberhauser 2021-05-28 18:13:15 -05:00
parent 440971673c
commit d3c59a6fe3

View file

@ -68,7 +68,7 @@ export default mixins(
for (const name of this.propertyNames) { for (const name of this.propertyNames) {
tempProperties = this.getOptionProperties(name); tempProperties = this.getOptionProperties(name);
if (tempProperties !== undefined) { if (tempProperties !== undefined) {
returnProperties.push(tempProperties); returnProperties.push(...tempProperties);
} }
} }
return returnProperties; return returnProperties;
@ -104,14 +104,15 @@ export default mixins(
return this.parameter.typeOptions[argumentName]; return this.parameter.typeOptions[argumentName];
}, },
getOptionProperties (optionName: string): INodeProperties | undefined { getOptionProperties (optionName: string): INodeProperties[] {
const properties: INodeProperties[] = [];
for (const option of this.parameter.options) { for (const option of this.parameter.options) {
if (option.name === optionName) { if (option.name === optionName) {
return option; properties.push(option);
} }
} }
return undefined; return properties;
}, },
displayNodeParameter (parameter: INodeProperties) { displayNodeParameter (parameter: INodeProperties) {
if (parameter.displayOptions === undefined) { if (parameter.displayOptions === undefined) {
@ -121,10 +122,12 @@ export default mixins(
return this.displayParameter(this.nodeValues, parameter, this.path); return this.displayParameter(this.nodeValues, parameter, this.path);
}, },
optionSelected (optionName: string) { optionSelected (optionName: string) {
const option = this.getOptionProperties(optionName); const options = this.getOptionProperties(optionName);
if (option === undefined) { if (options.length === 0) {
return; return;
} }
const option = options[0];
const name = `${this.path}.${option.name}`; const name = `${this.path}.${option.name}`;
let parameterData; let parameterData;