mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-20 17:37:25 +03: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.
|
||||
</div>
|
||||
</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="parametersSetting" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
||||
</el-tab-pane>
|
||||
@ -142,6 +142,7 @@ export default mixins(
|
||||
nodeValues: {
|
||||
color: '#ff0000',
|
||||
alwaysOutputData: false,
|
||||
executeOnce: false,
|
||||
notesInFlow: false,
|
||||
continueOnFail: false,
|
||||
retryOnFail: false,
|
||||
@ -187,6 +188,14 @@ export default mixins(
|
||||
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: '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',
|
||||
name: 'retryOnFail',
|
||||
@ -442,6 +451,11 @@ export default mixins(
|
||||
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) {
|
||||
foundNodeSettings.push('continueOnFail');
|
||||
Vue.set(this.nodeValues, 'continueOnFail', this.node.continueOnFail);
|
||||
|
@ -337,6 +337,7 @@ export interface INode {
|
||||
maxTries?: number;
|
||||
waitBetweenTries?: number;
|
||||
alwaysOutputData?: boolean;
|
||||
executeOnce?: boolean;
|
||||
continueOnFail?: boolean;
|
||||
parameters: INodeParameters;
|
||||
credentials?: INodeCredentials;
|
||||
|
@ -1128,6 +1128,18 @@ export class Workflow {
|
||||
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) {
|
||||
const returnPromises: Array<Promise<INodeExecutionData>> = [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user