From c50b6c2c21855452cd1374c5fcf3f11afe720b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Sat, 4 Dec 2021 11:57:13 +0100 Subject: [PATCH] :sparkles: Enable multiple args in logging via nodes (#2501) * :zap: Enable multiple args in logging via nodes * :shirt: Fix lint * :zap: Change to behave more as expected Co-authored-by: Jan Oberhauser --- packages/cli/src/WorkflowExecuteAdditionalData.ts | 4 ++-- packages/core/src/NodeExecuteFunctions.ts | 4 ++-- packages/editor-ui/src/Interface.ts | 2 +- packages/editor-ui/src/components/mixins/pushConnection.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/WorkflowExecuteAdditionalData.ts b/packages/cli/src/WorkflowExecuteAdditionalData.ts index 6ec88655fd..5fae499e82 100644 --- a/packages/cli/src/WorkflowExecuteAdditionalData.ts +++ b/packages/cli/src/WorkflowExecuteAdditionalData.ts @@ -924,7 +924,7 @@ export async function executeWorkflow( } // eslint-disable-next-line @typescript-eslint/no-explicit-any -export function sendMessageToUI(source: string, message: any) { +export function sendMessageToUI(source: string, messages: any[]) { if (this.sessionId === undefined) { return; } @@ -936,7 +936,7 @@ export function sendMessageToUI(source: string, message: any) { 'sendConsoleMessage', { source: `Node: "${source}"`, - message, + messages, }, this.sessionId, ); diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index fa1894a1da..07afcd2bb7 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -1649,13 +1649,13 @@ export function getExecuteFunctions( async putExecutionToWait(waitTill: Date): Promise { runExecutionData.waitTill = waitTill; }, - sendMessageToUI(message: any): void { + sendMessageToUI(...args: any[]): void { if (mode !== 'manual') { return; } try { if (additionalData.sendMessageToUI) { - additionalData.sendMessageToUI(node.name, message); + additionalData.sendMessageToUI(node.name, args); } } catch (error) { // eslint-disable-next-line @typescript-eslint/restrict-template-expressions diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 2518f1bb58..5248c17bd9 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -461,7 +461,7 @@ export interface IPushDataTestWebhook { export interface IPushDataConsoleMessage { source: string; - message: string; + messages: string[]; } export interface IVersionNotificationSettings { diff --git a/packages/editor-ui/src/components/mixins/pushConnection.ts b/packages/editor-ui/src/components/mixins/pushConnection.ts index cff75292db..bf57e26a23 100644 --- a/packages/editor-ui/src/components/mixins/pushConnection.ts +++ b/packages/editor-ui/src/components/mixins/pushConnection.ts @@ -165,7 +165,7 @@ export const pushConnection = mixins( if (receivedData.type === 'sendConsoleMessage') { const pushData = receivedData.data; - console.log(pushData.source, pushData.message); // eslint-disable-line no-console + console.log(pushData.source, ...pushData.messages); // eslint-disable-line no-console return true; }