🔃Add unction getCurrentNodeParameters to get currents parameters in loading function

This commit is contained in:
BenoitTallandier
2019-10-20 20:55:49 +02:00
parent 94d91ff9e8
commit 02a7d92fc1
7 changed files with 39 additions and 9 deletions

View File

@@ -525,6 +525,7 @@ class App {
this.app.get('/rest/node-parameter-options', ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<INodePropertyOptions[]> => {
const nodeType = req.query.nodeType;
let credentials: INodeCredentials | undefined = undefined;
const currentNodeParameters = req.query.currentNodeParameters;
if (req.query.credentials !== undefined) {
credentials = JSON.parse(req.query.credentials);
}
@@ -537,7 +538,7 @@ class App {
const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase;
const workflowCredentials = await WorkflowCredentials(workflowData.nodes);
const additionalData = await WorkflowExecuteAdditionalData.getBase(executionMode, workflowCredentials);
const additionalData = await WorkflowExecuteAdditionalData.getBase(executionMode, workflowCredentials,currentNodeParameters);
return loadDataInstance.getOptions(methodName, additionalData);
}));

View File

@@ -23,6 +23,7 @@ import {
IWorkflowExecuteAdditionalData,
IWorkflowExecuteHooks,
WorkflowExecuteMode,
INodeParameters,
} from 'n8n-workflow';
import * as config from '../config';
@@ -245,7 +246,7 @@ const hooks = (mode: WorkflowExecuteMode, workflowData: IWorkflowBase, execution
* @param {IWorkflowCredentials} credentials
* @returns {Promise<IWorkflowExecuteAdditionalData>}
*/
export async function getBase(mode: WorkflowExecuteMode, credentials: IWorkflowCredentials): Promise<IWorkflowExecuteAdditionalData> {
export async function getBase(mode: WorkflowExecuteMode, credentials: IWorkflowCredentials,currentNodeParameters: INodeParameters[] = []): Promise<IWorkflowExecuteAdditionalData> {
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
const timezone = config.get('generic.timezone') as string;
@@ -263,6 +264,7 @@ export async function getBase(mode: WorkflowExecuteMode, credentials: IWorkflowC
timezone,
webhookBaseUrl,
webhookTestBaseUrl,
currentNodeParameters
};
}