mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(n8n Evaluation Trigger Node): Fix tweaks (#15473)
This commit is contained in:
@@ -11,6 +11,7 @@ export const setOutputProperties: INodeProperties[] = [
|
||||
},
|
||||
{
|
||||
...document,
|
||||
displayName: 'Document Containing Dataset',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['setOutputs'],
|
||||
@@ -19,6 +20,7 @@ export const setOutputProperties: INodeProperties[] = [
|
||||
},
|
||||
{
|
||||
...sheet,
|
||||
displayName: 'Sheet Containing Dataset',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['setOutputs'],
|
||||
|
||||
@@ -32,6 +32,9 @@ export class Evaluation implements INodeType {
|
||||
},
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: `={{(${setOutputs})($parameter)}}`,
|
||||
codex: {
|
||||
alias: ['Test', 'Metrics', 'Evals', 'Set Output', 'Set Metrics'],
|
||||
},
|
||||
credentials: [
|
||||
{
|
||||
name: 'googleApi',
|
||||
|
||||
@@ -54,9 +54,10 @@ export class EvaluationTrigger implements INodeType {
|
||||
authentication,
|
||||
{
|
||||
...document,
|
||||
displayName: 'Document Containing Dataset',
|
||||
hint: 'Example dataset format <a href="https://docs.google.com/spreadsheets/d/1vD_IdeFUg7sHsK9okL6Doy1rGOkWTnPJV3Dro4FBUsY/edit?gid=0#gid=0">here</a>',
|
||||
},
|
||||
sheet,
|
||||
{ ...sheet, displayName: 'Sheet Containing Dataset' },
|
||||
{
|
||||
displayName: 'Limit Rows',
|
||||
name: 'limitRows',
|
||||
@@ -76,6 +77,9 @@ export class EvaluationTrigger implements INodeType {
|
||||
},
|
||||
readFilter,
|
||||
],
|
||||
codex: {
|
||||
alias: ['Test', 'Metrics', 'Evals', 'Set Output', 'Set Metrics'],
|
||||
},
|
||||
credentials: [
|
||||
{
|
||||
name: 'googleApi',
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('Test Evaluation', () => {
|
||||
|
||||
const result = await new Evaluation().execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toEqual([[{ json: {} }]]);
|
||||
|
||||
expect(GoogleSheet.prototype.updateRows).not.toBeCalled();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export async function setOutput(this: IExecuteFunctions): Promise<INodeExecution
|
||||
message: "No outputs were set since the execution didn't start from an evaluation trigger",
|
||||
location: 'outputPane',
|
||||
});
|
||||
return [];
|
||||
return [this.getInputData()];
|
||||
}
|
||||
|
||||
const outputFields = this.getNodeParameter('outputs.values', 0, []) as Array<{
|
||||
@@ -107,12 +107,6 @@ export async function setMetrics(this: IExecuteFunctions): Promise<INodeExecutio
|
||||
const assignmentValue =
|
||||
typeof assignment.value === 'number' ? assignment.value : Number(assignment.value);
|
||||
|
||||
if (!assignment.name || isNaN(assignmentValue)) {
|
||||
throw new NodeOperationError(this.getNode(), 'Metric name missing', {
|
||||
description: 'Make sure each metric you define has a name',
|
||||
});
|
||||
}
|
||||
|
||||
if (isNaN(assignmentValue)) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -123,6 +117,12 @@ export async function setMetrics(this: IExecuteFunctions): Promise<INodeExecutio
|
||||
);
|
||||
}
|
||||
|
||||
if (!assignment.name || isNaN(assignmentValue)) {
|
||||
throw new NodeOperationError(this.getNode(), 'Metric name missing', {
|
||||
description: 'Make sure each metric you define has a name',
|
||||
});
|
||||
}
|
||||
|
||||
const { name, value } = validateEntry(
|
||||
assignment.name,
|
||||
assignment.type as FieldType,
|
||||
|
||||
Reference in New Issue
Block a user