mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
✨ Add "Execute Once" node-setting
This commit is contained in:
parent
4c275513b4
commit
da0ef0d94c
|
@ -25,7 +25,7 @@
|
||||||
The node does not have any parameters.
|
The node does not have any parameters.
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="Node">
|
<el-tab-pane label="Settings">
|
||||||
<parameter-input-list :parameters="nodeSettings" :hideDelete="true" :nodeValues="nodeValues" path="" @valueChanged="valueChanged" />
|
<parameter-input-list :parameters="nodeSettings" :hideDelete="true" :nodeValues="nodeValues" path="" @valueChanged="valueChanged" />
|
||||||
<parameter-input-list :parameters="parametersSetting" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
<parameter-input-list :parameters="parametersSetting" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
@ -142,6 +142,7 @@ export default mixins(
|
||||||
nodeValues: {
|
nodeValues: {
|
||||||
color: '#ff0000',
|
color: '#ff0000',
|
||||||
alwaysOutputData: false,
|
alwaysOutputData: false,
|
||||||
|
executeOnce: false,
|
||||||
notesInFlow: false,
|
notesInFlow: false,
|
||||||
continueOnFail: false,
|
continueOnFail: false,
|
||||||
retryOnFail: false,
|
retryOnFail: false,
|
||||||
|
@ -187,6 +188,14 @@ export default mixins(
|
||||||
noDataExpression: true,
|
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.',
|
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: 'Execute Once',
|
||||||
|
name: 'executeOnce',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
noDataExpression: true,
|
||||||
|
description: 'Instead of executing once per item does it only execute once with the data of the first item.',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Retry On Fail',
|
displayName: 'Retry On Fail',
|
||||||
name: 'retryOnFail',
|
name: 'retryOnFail',
|
||||||
|
@ -442,6 +451,11 @@ export default mixins(
|
||||||
Vue.set(this.nodeValues, 'alwaysOutputData', this.node.alwaysOutputData);
|
Vue.set(this.nodeValues, 'alwaysOutputData', this.node.alwaysOutputData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.node.executeOnce) {
|
||||||
|
foundNodeSettings.push('executeOnce');
|
||||||
|
Vue.set(this.nodeValues, 'executeOnce', this.node.executeOnce);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.node.continueOnFail) {
|
if (this.node.continueOnFail) {
|
||||||
foundNodeSettings.push('continueOnFail');
|
foundNodeSettings.push('continueOnFail');
|
||||||
Vue.set(this.nodeValues, 'continueOnFail', this.node.continueOnFail);
|
Vue.set(this.nodeValues, 'continueOnFail', this.node.continueOnFail);
|
||||||
|
|
|
@ -337,6 +337,7 @@ export interface INode {
|
||||||
maxTries?: number;
|
maxTries?: number;
|
||||||
waitBetweenTries?: number;
|
waitBetweenTries?: number;
|
||||||
alwaysOutputData?: boolean;
|
alwaysOutputData?: boolean;
|
||||||
|
executeOnce?: boolean;
|
||||||
continueOnFail?: boolean;
|
continueOnFail?: boolean;
|
||||||
parameters: INodeParameters;
|
parameters: INodeParameters;
|
||||||
credentials?: INodeCredentials;
|
credentials?: INodeCredentials;
|
||||||
|
|
|
@ -1128,6 +1128,18 @@ export class Workflow {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.executeOnce === true) {
|
||||||
|
// If node should be executed only use only the first input item
|
||||||
|
connectionInputData = connectionInputData.slice(0, 1);
|
||||||
|
const newInputData: ITaskDataConnections = {};
|
||||||
|
for (const inputName of Object.keys(inputData)) {
|
||||||
|
newInputData[inputName] = inputData[inputName].map(input => {
|
||||||
|
return input && input.slice(0, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
inputData = newInputData;
|
||||||
|
}
|
||||||
|
|
||||||
if (nodeType.executeSingle) {
|
if (nodeType.executeSingle) {
|
||||||
const returnPromises: Array<Promise<INodeExecutionData>> = [];
|
const returnPromises: Array<Promise<INodeExecutionData>> = [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue