revert to addition fields design choice

This commit is contained in:
quansenB 2019-10-25 16:15:01 +02:00
parent f5c585c7be
commit 0034a17b17

View file

@ -528,23 +528,6 @@ export class ActiveCampaign implements INodeType {
}, },
description: 'The title of the deal', description: 'The title of the deal',
}, },
{
displayName: 'Description',
name: 'dealDescription',
type: 'string',
default: '',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'deal',
],
},
},
description: 'The description of the deal',
},
{ {
displayName: 'Deal\'s contact ID', displayName: 'Deal\'s contact ID',
name: 'dealContactId', name: 'dealContactId',
@ -600,10 +583,10 @@ export class ActiveCampaign implements INodeType {
description: 'The currency of the deal in 3-character ISO format', description: 'The currency of the deal in 3-character ISO format',
}, },
{ {
displayName: 'Deal group ID', displayName: 'Additional Fields',
name: 'dealGroup', name: 'additionalFields',
type: 'string', type: 'collection',
default: '', placeholder: 'Add Field',
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
@ -614,6 +597,20 @@ export class ActiveCampaign implements INodeType {
], ],
}, },
}, },
default: {},
options: [
{
displayName: 'Description',
name: 'dealDescription',
type: 'string',
default: '',
description: 'The description of the deal',
},
{
displayName: 'Deal group ID',
name: 'dealGroup',
type: 'string',
default: '',
description: 'The group ID of the deal', description: 'The group ID of the deal',
}, },
{ {
@ -621,16 +618,6 @@ export class ActiveCampaign implements INodeType {
name: 'dealStage', name: 'dealStage',
type: 'string', type: 'string',
default: '', default: '',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'deal',
],
},
},
description: 'The stage ID of the deal', description: 'The stage ID of the deal',
}, },
{ {
@ -638,16 +625,6 @@ export class ActiveCampaign implements INodeType {
name: 'dealOwner', name: 'dealOwner',
type: 'string', type: 'string',
default: '', default: '',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'deal',
],
},
},
description: 'The owner ID of the deal', description: 'The owner ID of the deal',
}, },
{ {
@ -655,16 +632,6 @@ export class ActiveCampaign implements INodeType {
name: 'dealPercentage', name: 'dealPercentage',
type: 'number', type: 'number',
default: 0, default: 0,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'deal',
],
},
},
description: 'The percentage of the deal', description: 'The percentage of the deal',
}, },
{ {
@ -672,18 +639,10 @@ export class ActiveCampaign implements INodeType {
name: 'dealStatus', name: 'dealStatus',
type: 'number', type: 'number',
default: 0, default: 0,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'deal',
],
},
},
description: 'The status of the deal', description: 'The status of the deal',
}, },
]
},
// ---------------------------------- // ----------------------------------
// deal:update // deal:update
@ -715,7 +674,7 @@ export class ActiveCampaign implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'update', 'create',
], ],
resource: [ resource: [
'deal', 'deal',
@ -724,32 +683,16 @@ export class ActiveCampaign implements INodeType {
}, },
description: 'The title of the deal', description: 'The title of the deal',
}, },
{
displayName: 'Description',
name: 'dealDescription',
type: 'string',
default: '',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'deal',
],
},
},
description: 'The description of the deal',
},
{ {
displayName: 'Deal\'s contact ID', displayName: 'Deal\'s contact ID',
name: 'dealContactId', name: 'dealContactId',
type: 'number', type: 'number',
default: 0, default: 0,
required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'update', 'create',
], ],
resource: [ resource: [
'deal', 'deal',
@ -763,10 +706,11 @@ export class ActiveCampaign implements INodeType {
name: 'dealValue', name: 'dealValue',
type: 'number', type: 'number',
default: 0, default: 0,
required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'update', 'create',
], ],
resource: [ resource: [
'deal', 'deal',
@ -780,10 +724,11 @@ export class ActiveCampaign implements INodeType {
name: 'dealCurrency', name: 'dealCurrency',
type: 'string', type: 'string',
default: '', default: '',
required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'update', 'create',
], ],
resource: [ resource: [
'deal', 'deal',
@ -793,20 +738,34 @@ export class ActiveCampaign implements INodeType {
description: 'The currency of the deal in 3-character ISO format', description: 'The currency of the deal in 3-character ISO format',
}, },
{ {
displayName: 'Deal group ID', displayName: 'Additional Fields',
name: 'dealGroup', name: 'additionalFields',
type: 'string', type: 'collection',
default: '', placeholder: 'Add Field',
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'update', 'create',
], ],
resource: [ resource: [
'deal', 'deal',
], ],
}, },
}, },
default: {},
options: [
{
displayName: 'Description',
name: 'dealDescription',
type: 'string',
default: '',
description: 'The description of the deal',
},
{
displayName: 'Deal group ID',
name: 'dealGroup',
type: 'string',
default: '',
description: 'The group ID of the deal', description: 'The group ID of the deal',
}, },
{ {
@ -814,16 +773,6 @@ export class ActiveCampaign implements INodeType {
name: 'dealStage', name: 'dealStage',
type: 'string', type: 'string',
default: '', default: '',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'deal',
],
},
},
description: 'The stage ID of the deal', description: 'The stage ID of the deal',
}, },
{ {
@ -831,16 +780,6 @@ export class ActiveCampaign implements INodeType {
name: 'dealOwner', name: 'dealOwner',
type: 'string', type: 'string',
default: '', default: '',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'deal',
],
},
},
description: 'The owner ID of the deal', description: 'The owner ID of the deal',
}, },
{ {
@ -848,16 +787,6 @@ export class ActiveCampaign implements INodeType {
name: 'dealPercentage', name: 'dealPercentage',
type: 'number', type: 'number',
default: 0, default: 0,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'deal',
],
},
},
description: 'The percentage of the deal', description: 'The percentage of the deal',
}, },
{ {
@ -865,18 +794,10 @@ export class ActiveCampaign implements INodeType {
name: 'dealStatus', name: 'dealStatus',
type: 'number', type: 'number',
default: 0, default: 0,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'deal',
],
},
},
description: 'The status of the deal', description: 'The status of the deal',
}, },
]
},
// ---------------------------------- // ----------------------------------
@ -1164,41 +1085,13 @@ export class ActiveCampaign implements INodeType {
title: this.getNodeParameter('dealTitle', i) as string, title: this.getNodeParameter('dealTitle', i) as string,
contact: this.getNodeParameter('dealContactId', i) as string, contact: this.getNodeParameter('dealContactId', i) as string,
value: this.getNodeParameter('dealValue', i) as number, value: this.getNodeParameter('dealValue', i) as number,
currency: '',
} as IDataObject; } as IDataObject;
let currency= this.getNodeParameter('dealCurrency', i) as string let currency = this.getNodeParameter('dealCurrency', i).toString().toLowerCase() as string
if (currency.length === 3) {
currency = currency.toLowerCase();
addAdditionalField(body.deal as IDataObject, currency) addAdditionalField(body.deal as IDataObject, currency)
} else {
throw new Error('Currency must be in 3-character ISO format')
}
let description = this.getNodeParameter('dealDescription', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
if (description.length !== 0){ addAdditionalFields(body.deal as IDataObject, additionalFields);
addAdditionalField(body.deal as IDataObject, description)
}
let group = this.getNodeParameter('dealGroup', i) as string;
if (group.length !== 0){
addAdditionalField(body.deal as IDataObject, group)
}
let stage = this.getNodeParameter('dealStage', i) as string;
if (stage.length !== 0){
addAdditionalField(body.deal as IDataObject, stage)
}
let percentage = this.getNodeParameter('dealPercentage', i) as number;
if (percentage !== 0){
addAdditionalField(body.deal as IDataObject, percentage)
}
let status = this.getNodeParameter('dealStatus', i) as number;
if (status !== 0){
addAdditionalField(body.deal as IDataObject, status)
}
} else if (operation === 'delete') { } else if (operation === 'delete') {