n8n/packages/nodes-base/nodes/Cockpit/FormDescription.ts

132 lines
2.1 KiB
TypeScript
Raw Normal View History

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: [
'form',
2020-04-04 07:04:25 -07:00
],
},
},
options: [
{
name: 'Submit a Form',
2020-04-04 07:04:25 -07:00
value: 'submit',
description: 'Store data from a form submission',
2020-04-04 07:04:25 -07:00
},
],
default: 'submit',
description: 'The operation to perform.',
2020-10-22 06:46:03 -07:00
},
2020-04-04 07:04:25 -07:00
] as INodeProperties[];
export const formFields = [
{
displayName: 'Form',
name: 'form',
type: 'string',
displayOptions: {
show: {
resource: [
'form',
],
},
},
default: '',
required: true,
2020-10-22 06:46:03 -07:00
description: 'Name of the form to operate on.',
},
// 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',
2020-10-22 06:46:03 -07:00
],
2020-04-11 11:24:58 -07:00
},
},
description: 'If form fields should be set via the value-key pair UI or JSON.',
},
{
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: [
'form',
2020-04-04 07:04:25 -07:00
],
2020-04-11 11:24:58 -07:00
operation: [
'submit',
2020-10-22 06:46:03 -07:00
],
2020-04-04 07:04:25 -07:00
},
},
description: 'Form data to send as JSON.',
2020-04-11 11:24:58 -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',
2020-10-22 06:46:03 -07:00
],
2020-04-11 11:24:58 -07:00
},
},
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: 'Form data to send.',
2020-04-04 07:04:25 -07:00
},
] as INodeProperties[];