2020-04-04 07:04:25 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
|
|
|
|
|
|
|
export const formOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'form',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2020-04-12 03:28:36 -07:00
|
|
|
name: 'Submit a Form',
|
2020-04-04 07:04:25 -07:00
|
|
|
value: 'submit',
|
|
|
|
description: 'Store submission of a form',
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
default: 'submit',
|
|
|
|
description: 'The operation to perform.',
|
|
|
|
}
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const formFields = [
|
2020-04-05 06:49:47 -07:00
|
|
|
{
|
|
|
|
displayName: 'Form',
|
|
|
|
name: 'form',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'form',
|
2020-04-05 06:49:47 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
description: 'Name of the form to operate on.'
|
|
|
|
},
|
|
|
|
|
2020-04-06 01:03:49 -07:00
|
|
|
// Form:submit
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
2020-04-11 11:24:58 -07:00
|
|
|
displayName: 'JSON Data fields',
|
|
|
|
name: 'jsonDataFields',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'form',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'submit',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'If form fields should be set via the value-key pair UI or JSON.',
|
|
|
|
},
|
|
|
|
{
|
2020-04-12 03:28:36 -07:00
|
|
|
displayName: 'Form Data',
|
2020-04-11 11:24:58 -07:00
|
|
|
name: 'dataFieldsJson',
|
2020-04-04 07:04:25 -07:00
|
|
|
type: 'json',
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2020-04-11 11:24:58 -07:00
|
|
|
jsonDataFields: [
|
|
|
|
true,
|
|
|
|
],
|
2020-04-04 07:04:25 -07:00
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'form',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
2020-04-11 11:24:58 -07:00
|
|
|
operation: [
|
|
|
|
'submit',
|
|
|
|
]
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
},
|
2020-04-12 03:28:36 -07:00
|
|
|
description: 'Form data to send as JSON.',
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
{
|
2020-04-12 03:28:36 -07:00
|
|
|
displayName: 'Form Data',
|
2020-04-11 11:24:58 -07:00
|
|
|
name: 'dataFieldsUi',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
jsonDataFields: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'form',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'submit',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2020-04-12 03:28:36 -07:00
|
|
|
description: 'Form data to send.',
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
] as INodeProperties[];
|