mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
✨ Add functionality to send console.log messages to editor-UI (#1816)
* ✨ Send console.log messages to editor-UI * ⚡ Send message only to session which started workflow * ⚡ Made it also work in own process * ⚡ Add support for console.log UI forward also to FunctionItem Node * 👕 Fix lint issue * 👕 Fix linting issue * ⚡ Improve code Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -627,7 +627,7 @@ export async function executeWorkflow(workflowInfo: IExecuteWorkflowInfo, additi
|
||||
// If no timeout was given from the parent, then we use our timeout.
|
||||
subworkflowTimeout = Math.min(additionalData.executionTimeoutTimestamp || Number.MAX_SAFE_INTEGER, Date.now() + (workflowData.settings.executionTimeout as number * 1000));
|
||||
}
|
||||
|
||||
|
||||
additionalDataIntegrated.executionTimeoutTimestamp = subworkflowTimeout;
|
||||
|
||||
|
||||
@@ -663,6 +663,24 @@ export async function executeWorkflow(workflowInfo: IExecuteWorkflowInfo, additi
|
||||
}
|
||||
|
||||
|
||||
export function sendMessageToUI(source: string, message: string) {
|
||||
if (this.sessionId === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Push data to session which started workflow
|
||||
try {
|
||||
const pushInstance = Push.getInstance();
|
||||
pushInstance.send('sendConsoleMessage', {
|
||||
source: `Node: "${source}"`,
|
||||
message,
|
||||
}, this.sessionId);
|
||||
} catch (error) {
|
||||
Logger.warn(`There was a problem sending messsage to UI: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the base additional data without webhooks
|
||||
*
|
||||
@@ -785,4 +803,3 @@ export function getWorkflowHooksMain(data: IWorkflowExecutionDataProcess, execut
|
||||
|
||||
return new WorkflowHooks(hookFunctions, data.executionMode, executionId, data.workflowData, { sessionId: data.sessionId, retryOf: data.retryOf as string });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user