Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Google Sheets Node): Better error when column to match on is empty #10442

Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const fieldDescription = computed<string>(() => {
resourceMapperTypeOptions.value?.multiKeyMatch === true
? `${pluralFieldWord.value}`
: `${singularFieldWord.value}`,
nodeDisplayName: props.serviceName,
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,18 @@ describe('ResourceMapper.vue', () => {
},
{ merge: true },
);

await waitAllPromises();
expect(getByText('Set the value for each foo')).toBeInTheDocument();
expect(
getByText('Look for incoming data that matches the foos in the service'),
).toBeInTheDocument();
expect(getByText('Foos to Match On')).toBeInTheDocument();
expect(getByText('The foos that identify the row(s) to modify')).toBeInTheDocument();
expect(
getByText(
'The foos to use when matching rows in the service to the input items of this node. Usually an ID.',
),
).toBeInTheDocument();
});

it('should render correct fields based on saved schema', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1491,8 +1491,8 @@
"resourceMapper.fetchingFields.errorMessage": "Can't get {fieldWord}.",
"resourceMapper.fetchingFields.noFieldsFound": "No {fieldWord} found in {serviceName}.",
"resourceMapper.columnsToMatchOn.label": "{fieldWord} to Match On",
"resourceMapper.columnsToMatchOn.multi.description": "The {fieldWord} that identify the row(s) to modify",
"resourceMapper.columnsToMatchOn.single.description": "The {fieldWord} that identifies the row(s) to modify",
"resourceMapper.columnsToMatchOn.multi.description": "The {fieldWord} to use when matching rows in {nodeDisplayName} to the input items of this node. Usually an ID.",
"resourceMapper.columnsToMatchOn.single.description": "The {fieldWord} to use when matching rows in {nodeDisplayName} to the input items of this node. Usually an ID.",
"resourceMapper.columnsToMatchOn.tooltip": "The {fieldWord} to compare when finding the rows to update",
"resourceMapper.columnsToMatchOn.noFieldsFound": "No {fieldWord} that can be used for matching found in {serviceName}.",
"resourceMapper.valuesToSend.label": "Values to Send",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,18 @@ export async function execute(
} else {
const valueToMatchOn =
nodeVersion < 4
? (this.getNodeParameter('valueToMatchOn', i) as string)
: (this.getNodeParameter(`columns.value[${columnsToMatchOn[0]}]`, i) as string);
? (this.getNodeParameter('valueToMatchOn', i, '') as string)
: (this.getNodeParameter(`columns.value[${columnsToMatchOn[0]}]`, i, '') as string);

if (valueToMatchOn === '') {
throw new NodeOperationError(
this.getNode(),
"The 'Column to Match On' parameter is required",
{
itemIndex: i,
},
);
}

if (nodeVersion < 4) {
const valuesToSend = this.getNodeParameter('fieldsUi.values', i, []) as IDataObject[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,18 @@ export async function execute(
} else {
const valueToMatchOn =
nodeVersion < 4
? (this.getNodeParameter('valueToMatchOn', i) as string)
: (this.getNodeParameter(`columns.value[${columnsToMatchOn[0]}]`, i) as string);
? (this.getNodeParameter('valueToMatchOn', i, '') as string)
: (this.getNodeParameter(`columns.value[${columnsToMatchOn[0]}]`, i, '') as string);

if (valueToMatchOn === '') {
throw new NodeOperationError(
this.getNode(),
"The 'Column to Match On' parameter is required",
{
itemIndex: i,
},
);
}

if (nodeVersion < 4) {
const valuesToSend = this.getNodeParameter('fieldsUi.values', i, []) as IDataObject[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const properties: INodeProperties[] = [
loadOptionsDependsOn: ['schema.value', 'table.value'],
},
default: '',
hint: 'The column that identifies the row(s) to modify',
hint: 'The column to use when matching rows in Postgres to the input items of this node. Usually an ID.',
displayOptions: {
show: {
'@version': [2, 2.1],
Expand Down
Loading