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