mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
feat(Airtable Trigger Node): use resource locator component for base and table parameters (#4391)
add base and table RLC to AirtableTrigger.node.ts
This commit is contained in:
parent
839f6ac777
commit
227212c928
|
@ -35,20 +35,92 @@ export class AirtableTrigger implements INodeType {
|
|||
outputs: ['main'],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Base ID',
|
||||
displayName: 'Base',
|
||||
name: 'baseId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
type: 'resourceLocator',
|
||||
default: { mode: 'url', value: '' },
|
||||
required: true,
|
||||
description: 'The ID of this base',
|
||||
description: 'The Airtable Base in which to operate on',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'By URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
placeholder: 'https://airtable.com/app12DiScdfes/tblAAAAAAAAAAAAA/viwHdfasdfeieg5p',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: 'https://airtable.com/([a-zA-Z0-9]{2,})/.*',
|
||||
errorMessage: 'Not a valid Airtable Base URL',
|
||||
},
|
||||
},
|
||||
],
|
||||
extractValue: {
|
||||
type: 'regex',
|
||||
regex: 'https://airtable.com/([a-zA-Z0-9]{2,})',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Table ID',
|
||||
name: 'tableId',
|
||||
displayName: 'ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The ID of the table to access',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: '[a-zA-Z0-9]{2,}',
|
||||
errorMessage: 'Not a valid Airtable Base ID',
|
||||
},
|
||||
},
|
||||
],
|
||||
placeholder: 'appD3dfaeidke',
|
||||
url: '=https://airtable.com/{{$value}}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Table',
|
||||
name: 'tableId',
|
||||
type: 'resourceLocator',
|
||||
default: { mode: 'url', value: '' },
|
||||
required: true,
|
||||
modes: [
|
||||
{
|
||||
displayName: 'By URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
placeholder: 'https://airtable.com/app12DiScdfes/tblAAAAAAAAAAAAA/viwHdfasdfeieg5p',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: 'https://airtable.com/[a-zA-Z0-9]{2,}/([a-zA-Z0-9]{2,})/.*',
|
||||
errorMessage: 'Not a valid Airtable Table URL',
|
||||
},
|
||||
},
|
||||
],
|
||||
extractValue: {
|
||||
type: 'regex',
|
||||
regex: 'https://airtable.com/[a-zA-Z0-9]{2,}/([a-zA-Z0-9]{2,})',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: '[a-zA-Z0-9]{2,}',
|
||||
errorMessage: 'Not a valid Airtable Table ID',
|
||||
},
|
||||
},
|
||||
],
|
||||
placeholder: 'tbl3dirwqeidke',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Trigger Field',
|
||||
|
@ -126,9 +198,9 @@ export class AirtableTrigger implements INodeType {
|
|||
|
||||
const additionalFields = this.getNodeParameter('additionalFields') as IDataObject;
|
||||
|
||||
const base = this.getNodeParameter('baseId') as string;
|
||||
const base = this.getNodeParameter('baseId', '', { extractValue: true }) as string;
|
||||
|
||||
const table = this.getNodeParameter('tableId') as string;
|
||||
const table = this.getNodeParameter('tableId', '', { extractValue: true }) as string;
|
||||
|
||||
const triggerField = this.getNodeParameter('triggerField') as string;
|
||||
|
||||
|
|
Loading…
Reference in a new issue