1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

Add "alwaysOutputData" option to nodes

This commit is contained in:
Jan Oberhauser 2020-04-12 19:58:30 +02:00
parent dc10f52db3
commit c7024ca454
3 changed files with 26 additions and 0 deletions

View File

@ -596,6 +596,17 @@ export class WorkflowExecute {
this.runExecutionData.resultData.lastNodeExecuted = executionData.node.name;
nodeSuccessData = await workflow.runNode(executionData.node, executionData.data, this.runExecutionData, runIndex, this.additionalData, NodeExecuteFunctions, this.mode);
if (nodeSuccessData === null || nodeSuccessData[0][0] === undefined) {
if (executionData.node.alwaysOutputData === true) {
nodeSuccessData = nodeSuccessData || [];
nodeSuccessData[0] = [
{
json: {},
}
];
}
}
if (nodeSuccessData === null) {
// If null gets returned it means that the node did succeed
// but did not have any data. So the branch should end

View File

@ -141,6 +141,7 @@ export default mixins(
nodeColor: null,
nodeValues: {
color: '#ff0000',
alwaysOutputData: false,
continueOnFail: false,
retryOnFail: false,
maxTries: 3,
@ -169,6 +170,14 @@ export default mixins(
noDataExpression: true,
description: 'The color of the node in the flow.',
},
{
displayName: 'Always Output Data',
name: 'alwaysOutputData',
type: 'boolean',
default: false,
noDataExpression: true,
description: 'If activated and the node does not have any data for the first output,<br />it returns an empty item anyway. Be careful setting this on<br />IF-Nodes as it could easily cause an infinite loop.',
},
{
displayName: 'Retry On Fail',
name: 'retryOnFail',
@ -419,6 +428,11 @@ export default mixins(
Vue.set(this.nodeValues, 'notes', this.node.notes);
}
if (this.node.alwaysOutputData) {
foundNodeSettings.push('alwaysOutputData');
Vue.set(this.nodeValues, 'alwaysOutputData', this.node.alwaysOutputData);
}
if (this.node.continueOnFail) {
foundNodeSettings.push('continueOnFail');
Vue.set(this.nodeValues, 'continueOnFail', this.node.continueOnFail);

View File

@ -292,6 +292,7 @@ export interface INode {
retryOnFail?: boolean;
maxTries?: number;
waitBetweenTries?: number;
alwaysOutputData?: boolean;
continueOnFail?: boolean;
parameters: INodeParameters;
credentials?: INodeCredentials;