🐛 Fix issue that it did export default parameter values if they were

objects
This commit is contained in:
Jan Oberhauser 2021-05-19 18:07:26 -05:00
parent 2ac4e425d6
commit b9b6e8b5df
3 changed files with 94 additions and 2 deletions

View file

@ -38,6 +38,7 @@
},
"dependencies": {
"lodash.get": "^4.4.2",
"lodash.isequal": "^4.5.0",
"riot-tmpl": "^3.0.8",
"xml2js": "^0.4.23"
},

View file

@ -21,7 +21,7 @@ import {
Workflow
} from './Workflow';
import { get } from 'lodash';
import { get, isEqual } from 'lodash';
@ -585,7 +585,9 @@ export function getNodeParameters(nodePropertiesArray: INodeProperties[], nodeVa
nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name] || nodeProperties.default;
}
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];
} else if (nodeValues[nodeProperties.name] !== nodeProperties.default || (nodeValues[nodeProperties.name] !== undefined && parentType === 'collection')) {
} else if ((nodeValues[nodeProperties.name] !== nodeProperties.default && typeof nodeValues[nodeProperties.name] !== 'object') ||
(typeof nodeValues[nodeProperties.name] === 'object' && !isEqual(nodeValues[nodeProperties.name], nodeProperties.default)) ||
(nodeValues[nodeProperties.name] !== undefined && parentType === 'collection')) {
// Set only if it is different to the default value
nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name];
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];

View file

@ -2939,6 +2939,95 @@ describe('Workflow', () => {
},
},
},
{
description: 'complex type "fixedCollection" with "multipleValues: true". Which contains parameter of type multiOptions and has so an array default value.',
input: {
nodePropertiesArray: [
{
name: 'values',
displayName: 'Values',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
default: {},
options: [
{
name: 'propertyValues',
displayName: 'Property',
values: [
{
displayName: 'Options',
name: 'multiSelectValue',
type: 'multiOptions',
options: [
{
name: 'Value1',
value: 'value1',
},
{
name: 'Value2',
value: 'value2',
},
],
default: [],
},
],
},
],
},
],
nodeValues: {
values: {
propertyValues: [
{
multiSelectValue: [],
}
]
},
},
},
output: {
noneDisplayedFalse: {
defaultsFalse: {
values: {
propertyValues: [
{
}
],
},
},
defaultsTrue: {
values: {
propertyValues: [
{
multiSelectValue: [],
}
],
},
},
},
noneDisplayedTrue: {
defaultsFalse: {
values: {
propertyValues: [
{
}
],
},
},
defaultsTrue: {
values: {
propertyValues: [
{
multiSelectValue: [],
}
],
},
},
},
},
},
];