removed default form complition screen

This commit is contained in:
Michael Kret 2024-10-29 13:32:21 +02:00
parent 13c047126b
commit a41937a5aa
2 changed files with 58 additions and 57 deletions

View file

@ -1,6 +1,6 @@
import axios from 'axios'; import axios from 'axios';
import type express from 'express'; import type express from 'express';
import { FORM_NODE_TYPE, NodeHelpers, sleep, Workflow } from 'n8n-workflow'; import { NodeHelpers, sleep, Workflow } from 'n8n-workflow';
import { Service } from 'typedi'; import { Service } from 'typedi';
import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { ExecutionRepository } from '@/databases/repositories/execution.repository';
@ -94,69 +94,70 @@ export class WaitingWebhooks implements IWebhookManager {
const lastNodeExecuted = execution.data.resultData.lastNodeExecuted as string; const lastNodeExecuted = execution.data.resultData.lastNodeExecuted as string;
if (execution.finished) { if (execution.finished) {
if (this.includeForms && req.method === 'GET') { // if (this.includeForms && req.method === 'GET') {
const executionWorkflowData = execution.workflowData; // const executionWorkflowData = execution.workflowData;
const hasCompletionPage = executionWorkflowData.nodes.some((node) => { // const hasCompletionPage = executionWorkflowData.nodes.some((node) => {
return ( // return (
!node.disabled && // !node.disabled &&
node.type === FORM_NODE_TYPE && // node.type === FORM_NODE_TYPE &&
node.parameters.operation === 'completion' // node.parameters.operation === 'completion'
); // );
}); // });
if (!hasCompletionPage) { // if (!hasCompletionPage) {
res.render('form-trigger-completion', { // res.render('form-trigger-completion', {
title: 'Form Submitted', // title: 'Form Submitted',
message: 'Your response has been recorded', // message: 'Your response has been recorded',
formTitle: 'Form Submitted', // formTitle: 'Form Submitted',
}); // });
return { // return {
noWebhookResponse: true, // noWebhookResponse: true,
}; // };
} // }
// const workflow = this.getWorkflow(execution); // const workflow = this.getWorkflow(execution);
// const parentNodes = workflow.getParentNodes( // const parentNodes = workflow.getParentNodes(
// execution.data.resultData.lastNodeExecuted as string, // execution.data.resultData.lastNodeExecuted as string,
// ); // );
// const lastNodeExecuted = execution.data.resultData.lastNodeExecuted as string; // const lastNodeExecuted = execution.data.resultData.lastNodeExecuted as string;
// const lastNode = workflow.nodes[lastNodeExecuted]; // const lastNode = workflow.nodes[lastNodeExecuted];
// if ( // if (
// !lastNode.disabled && // !lastNode.disabled &&
// lastNode.type === FORM_NODE_TYPE && // lastNode.type === FORM_NODE_TYPE &&
// lastNode.parameters.operation === 'completion' // lastNode.parameters.operation === 'completion'
// ) { // ) {
// completionPage = lastNodeExecuted; // completionPage = lastNodeExecuted;
// } else { // } else {
// completionPage = Object.keys(workflow.nodes).find((nodeName) => { // completionPage = Object.keys(workflow.nodes).find((nodeName) => {
// const node = workflow.nodes[nodeName]; // const node = workflow.nodes[nodeName];
// return ( // return (
// parentNodes.includes(nodeName) && // parentNodes.includes(nodeName) &&
// !node.disabled && // !node.disabled &&
// node.type === FORM_NODE_TYPE && // node.type === FORM_NODE_TYPE &&
// node.parameters.operation === 'completion' // node.parameters.operation === 'completion'
// ); // );
// }); // });
// } // }
// if (!completionPage) { // if (!completionPage) {
// res.render('form-trigger-completion', { // res.render('form-trigger-completion', {
// title: 'Form Submitted', // title: 'Form Submitted',
// message: 'Your response has been recorded', // message: 'Your response has been recorded',
// formTitle: 'Form Submitted', // formTitle: 'Form Submitted',
// }); // });
// return { // return {
// noWebhookResponse: true, // noWebhookResponse: true,
// }; // };
// } // }
} else { // } else {
throw new ConflictError(`The execution "${executionId} has finished already.`); // throw new ConflictError(`The execution "${executionId} has finished already.`);
} // }
throw new ConflictError(`The execution "${executionId} has finished already.`);
} }
if (execution.data.resultData.error) { if (execution.data.resultData.error) {

View file

@ -267,7 +267,7 @@ export class Wait extends Webhook {
], ],
properties: [ properties: [
{ {
displayName: 'Resume', displayName: 'Resume On',
name: 'resume', name: 'resume',
type: 'options', type: 'options',
options: [ options: [