Remove "loadOptionsMethod" for Airtable application selection

This commit is contained in:
Jan Oberhauser 2020-02-10 17:39:44 -08:00
parent e67afb9e92
commit 87f2e8b91c

View file

@ -75,16 +75,12 @@ export class Airtable implements INodeType {
// All // All
// ---------------------------------- // ----------------------------------
{ {
displayName: 'Application', displayName: 'Application ID',
name: 'application', name: 'application',
type: 'options', type: 'string',
typeOptions: {
loadOptionsMethod: 'getApplications',
},
options: [],
default: '', default: '',
required: true, required: true,
description: 'The application to access', description: 'The ID of the application to access.',
}, },
{ {
displayName: 'Table', displayName: 'Table',
@ -93,7 +89,7 @@ export class Airtable implements INodeType {
default: '', default: '',
placeholder: 'Stories', placeholder: 'Stories',
required: true, required: true,
description: 'The name of table to access', description: 'The name of table to access.',
}, },
// ---------------------------------- // ----------------------------------
@ -363,32 +359,6 @@ export class Airtable implements INodeType {
], ],
}; };
methods = {
loadOptions: {
// Get all the available applications to display them to user so that he can
// select them easily
async getApplications(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const endpoint = 'meta';
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
if (responseData.applications === undefined) {
throw new Error('No data got returned');
}
const returnData: INodePropertyOptions[] = [];
for (const baseData of responseData.applications) {
returnData.push({
name: baseData.name,
value: baseData.id,
});
}
return returnData;
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> { async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData(); const items = this.getInputData();
const returnData: IDataObject[] = []; const returnData: IDataObject[] = [];