mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
Add new fields to the node
This commit is contained in:
parent
5d2f2ff493
commit
294a9ea599
|
@ -21,6 +21,7 @@ import {
|
|||
formOperations
|
||||
} from './FormDescription';
|
||||
import { submitForm } from './FormFunctions';
|
||||
import { createDataFromParameters } from './GenericFunctions';
|
||||
import {
|
||||
singletonFields,
|
||||
singletonOperations,
|
||||
|
@ -74,7 +75,6 @@ export class Cockpit implements INodeType {
|
|||
],
|
||||
},
|
||||
|
||||
|
||||
...collectionOperations,
|
||||
...collectionFields,
|
||||
...formOperations,
|
||||
|
@ -84,7 +84,6 @@ export class Cockpit implements INodeType {
|
|||
],
|
||||
};
|
||||
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
async getCollections(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
@ -123,8 +122,9 @@ export class Cockpit implements INodeType {
|
|||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'collection') {
|
||||
const collectionName = this.getNodeParameter('collection', i) as string;
|
||||
|
||||
if (operation === 'create') {
|
||||
const data = this.getNodeParameter('data', i) as IDataObject;
|
||||
const data = createDataFromParameters.call(this, i);
|
||||
|
||||
responseData = await createCollectionEntry.call(this, collectionName, data);
|
||||
} else if (operation === 'getAll') {
|
||||
|
@ -138,19 +138,21 @@ export class Cockpit implements INodeType {
|
|||
responseData = await getAllCollectionEntries.call(this, collectionName, options);
|
||||
} else if (operation === 'update') {
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
const data = this.getNodeParameter('data', i) as IDataObject;
|
||||
const data = createDataFromParameters.call(this, i);
|
||||
|
||||
responseData = await createCollectionEntry.call(this, collectionName, data, id);
|
||||
}
|
||||
} else if (resource === 'form') {
|
||||
const formName = this.getNodeParameter('form', i) as string;
|
||||
|
||||
if (operation === 'submit') {
|
||||
const form = this.getNodeParameter('form', i) as IDataObject;
|
||||
const form = createDataFromParameters.call(this, i);
|
||||
|
||||
responseData = await submitForm.call(this, formName, form);
|
||||
}
|
||||
} else if (resource === 'singleton') {
|
||||
const singletonName = this.getNodeParameter('singleton', i) as string;
|
||||
|
||||
if (operation === 'get') {
|
||||
responseData = await getSingleton.call(this, singletonName);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue