Move useSchemaRegistry out of the options to be easier to see the extra fields

This commit is contained in:
Ricardo Georgel 2021-06-05 18:48:00 -03:00
parent 4af53d1b95
commit e5e0929332

View file

@ -58,6 +58,28 @@ export class KafkaTrigger implements INodeType {
placeholder: 'n8n-kafka', placeholder: 'n8n-kafka',
description: 'ID of the consumer group.', description: 'ID of the consumer group.',
}, },
{
displayName: 'Use Schema Registry',
name: 'useSchemaRegistry',
type: 'boolean',
default: false,
description: 'Use Apache Avro serialization format and Confluent\' wire formats.',
},
{
displayName: 'Schema Registry URL',
name: 'schemaRegistryUrl',
type: 'string',
required: true,
displayOptions: {
show: {
useSchemaRegistry: [
true,
],
},
},
default: '',
description: 'URL of the schema registry.',
},
{ {
displayName: 'Options', displayName: 'Options',
name: 'options', name: 'options',
@ -100,27 +122,6 @@ export class KafkaTrigger implements INodeType {
default: 30000, default: 30000,
description: 'The time to await a response in ms.', description: 'The time to await a response in ms.',
}, },
{
displayName: 'Use Schema Registry',
name: 'useSchemaRegistry',
type: 'boolean',
default: false,
description: 'Use Apache Avro serialization format and Confluent\' wire formats.',
},
{
displayName: 'Schema Registry URL',
name: 'schemaRegistryUrl',
type: 'string',
displayOptions: {
show: {
useSchemaRegistry: [
true,
],
},
},
default: '',
description: 'URL of the schema registry.',
},
], ],
}, },
], ],
@ -170,9 +171,13 @@ export class KafkaTrigger implements INodeType {
const options = this.getNodeParameter('options', {}) as IDataObject; const options = this.getNodeParameter('options', {}) as IDataObject;
const useSchemaRegistry = this.getNodeParameter('useSchemaRegistry', 0) as boolean;
const schemaRegistryUrl = this.getNodeParameter('schemaRegistryUrl', 0) as string;
let registry: SchemaRegistry; let registry: SchemaRegistry;
if (options.useSchemaRegistry) { if (useSchemaRegistry) {
registry = new SchemaRegistry({ host: options.schemaRegistryUrl as string }); registry = new SchemaRegistry({ host: schemaRegistryUrl });
} }
const startConsumer = async () => { const startConsumer = async () => {