mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
🐛 Fix issue that it did export default parameter values if they were
objects
This commit is contained in:
parent
2ac4e425d6
commit
b9b6e8b5df
|
@ -38,6 +38,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"riot-tmpl": "^3.0.8",
|
||||
"xml2js": "^0.4.23"
|
||||
},
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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: [],
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue