mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
Add data fields to collections
This commit is contained in:
parent
c99910750f
commit
fe3cca5344
|
@ -54,29 +54,6 @@ export const collectionFields = [
|
|||
description: 'Name of the collection to operate on.'
|
||||
},
|
||||
|
||||
// Collection:entry:create
|
||||
{
|
||||
displayName: 'Data',
|
||||
name: 'data',
|
||||
type: 'json',
|
||||
required: true,
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'collection',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
]
|
||||
},
|
||||
},
|
||||
description: 'The data to create.',
|
||||
},
|
||||
|
||||
// Collection:entry:getAll
|
||||
{
|
||||
displayName: 'Return All',
|
||||
|
@ -214,25 +191,95 @@ export const collectionFields = [
|
|||
},
|
||||
description: 'The entry ID.',
|
||||
},
|
||||
|
||||
// Collection:entry:create
|
||||
// Collection:entry:update
|
||||
{
|
||||
displayName: 'Data',
|
||||
name: 'data',
|
||||
type: 'json',
|
||||
required: true,
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
displayName: 'JSON Data fields',
|
||||
name: 'jsonDataFields',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'collection',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
'update',
|
||||
]
|
||||
},
|
||||
},
|
||||
description: 'The data to update.',
|
||||
description: 'If new entry fields should be set via the value-key pair UI or JSON.',
|
||||
},
|
||||
{
|
||||
displayName: 'Data fields',
|
||||
name: 'dataFieldsJson',
|
||||
type: 'json',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
jsonDataFields: [
|
||||
true,
|
||||
],
|
||||
resource: [
|
||||
'collection',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
'update',
|
||||
]
|
||||
},
|
||||
},
|
||||
description: 'Data to send as JSON.',
|
||||
},
|
||||
{
|
||||
displayName: 'Data fields',
|
||||
name: 'dataFieldsUi',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
jsonDataFields: [
|
||||
false,
|
||||
],
|
||||
resource: [
|
||||
'collection',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
'update',
|
||||
]
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Field',
|
||||
name: 'field',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the field.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value of the field.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description: 'Data field to send.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -9,7 +9,7 @@ import { cockpitApiRequest } from './GenericFunctions';
|
|||
|
||||
export async function createCollectionEntry(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, resourceName: string, data: IDataObject, id?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
const body: ICollection = {
|
||||
data: JSON.parse(data.toString())
|
||||
data,
|
||||
};
|
||||
|
||||
if (id) {
|
||||
|
|
Loading…
Reference in a new issue