feat(n8n Form Trigger Node): Improvements (#7571)

Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
Michael Kret
2023-12-13 17:00:51 +02:00
committed by GitHub
parent 26f0d57f5f
commit 953a58f18b
37 changed files with 1163 additions and 496 deletions

View File

@@ -14,6 +14,9 @@ export const useRootStore = defineStore(STORES.ROOT, {
? 'rest'
: window.REST_ENDPOINT,
defaultLocale: 'en',
endpointForm: 'form',
endpointFormTest: 'form-test',
endpointFormWaiting: 'form-waiting',
endpointWebhook: 'webhook',
endpointWebhookTest: 'webhook-test',
pushConnectionActive: true,
@@ -34,6 +37,18 @@ export const useRootStore = defineStore(STORES.ROOT, {
return this.baseUrl;
},
getFormUrl(): string {
return `${this.urlBaseWebhook}${this.endpointForm}`;
},
getFormTestUrl(): string {
return `${this.urlBaseEditor}${this.endpointFormTest}`;
},
getFormWaitingUrl(): string {
return `${this.baseUrl}${this.endpointFormWaiting}`;
},
getWebhookUrl(): string {
return `${this.urlBaseWebhook}${this.endpointWebhook}`;
},
@@ -71,6 +86,15 @@ export const useRootStore = defineStore(STORES.ROOT, {
const url = urlBaseEditor.endsWith('/') ? urlBaseEditor : `${urlBaseEditor}/`;
this.urlBaseEditor = url;
},
setEndpointForm(endpointForm: string): void {
this.endpointForm = endpointForm;
},
setEndpointFormTest(endpointFormTest: string): void {
this.endpointFormTest = endpointFormTest;
},
setEndpointFormWaiting(endpointFormWaiting: string): void {
this.endpointFormWaiting = endpointFormWaiting;
},
setEndpointWebhook(endpointWebhook: string): void {
this.endpointWebhook = endpointWebhook;
},

View File

@@ -263,6 +263,9 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
rootStore.setUrlBaseWebhook(settings.urlBaseWebhook);
rootStore.setUrlBaseEditor(settings.urlBaseEditor);
rootStore.setEndpointForm(settings.endpointForm);
rootStore.setEndpointFormTest(settings.endpointFormTest);
rootStore.setEndpointFormWaiting(settings.endpointFormWaiting);
rootStore.setEndpointWebhook(settings.endpointWebhook);
rootStore.setEndpointWebhookTest(settings.endpointWebhookTest);
rootStore.setTimezone(settings.timezone);

View File

@@ -196,6 +196,18 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
return {};
};
},
isNodeInOutgoingNodeConnections() {
return (firstNode: string, secondNode: string): boolean => {
const firstNodeConnections = this.outgoingConnectionsByNodeName(firstNode);
if (!firstNodeConnections || !firstNodeConnections.main || !firstNodeConnections.main[0])
return false;
const connections = firstNodeConnections.main[0];
if (connections.some((node) => node.node === secondNode)) return true;
return connections.some((node) =>
this.isNodeInOutgoingNodeConnections(node.node, secondNode),
);
};
},
allNodes(): INodeUi[] {
return this.workflow.nodes;
},