From f8bf00fc0ff775a1e816cf35038a67487eabacbd Mon Sep 17 00:00:00 2001 From: William Date: Fri, 1 Dec 2023 16:31:08 -0300 Subject: [PATCH] [ENG-28582] feat: first part of adjustments in data streaming (#402) * refactor: update services to handle newline * fix: add pagetitledelete prop * fix: remove unnecessary boolean requirement * refactor: update services to handle newline * refactor: adjust validations in standard DS * refactor: adjust validations in standard DS * refactor: move standard DS payload fields to another block * refactor: remove placeholder from loglineseparator * refactor: remove asterisk in new block --- .../create-data-streaming-service.js | 2 +- .../edit-data-streaming-service.js | 4 +- .../load-data-streaming-service.js | 5 +- src/templates/edit-form-block/index.vue | 1 - src/views/DataStreaming/CreateView.vue | 10 +- src/views/DataStreaming/EditView.vue | 8 +- .../FormFields/FormFieldsDataStreaming.vue | 146 +++++++++--------- src/views/DataStreaming/ListView.vue | 3 +- 8 files changed, 94 insertions(+), 85 deletions(-) diff --git a/src/services/data-streaming-services/create-data-streaming-service.js b/src/services/data-streaming-services/create-data-streaming-service.js index 70e3730c7..083ec78a5 100644 --- a/src/services/data-streaming-services/create-data-streaming-service.js +++ b/src/services/data-streaming-services/create-data-streaming-service.js @@ -33,7 +33,7 @@ const parseByEndpointType = (payload) => { endpoint_type: 'standard', url: payload.endpointUrl, payload_format: payload.payloadFormat, - log_line_separator: payload.lineSeparator, + log_line_separator: payload.lineSeparator === '\\n' ? '\n' : payload.lineSeparator, max_size: payload.maxSize, headers: getHeaders(payload.headers) } diff --git a/src/services/data-streaming-services/edit-data-streaming-service.js b/src/services/data-streaming-services/edit-data-streaming-service.js index da8a8116f..df58467b3 100644 --- a/src/services/data-streaming-services/edit-data-streaming-service.js +++ b/src/services/data-streaming-services/edit-data-streaming-service.js @@ -20,7 +20,7 @@ const adapt = (payload) => { template_id: payload.template, data_source: payload.dataSource, domain_ids: allDomains ? [] : getDomains(payload.domains[1]), - all_domains: allDomains ? true : false, + all_domains: allDomains, active: payload.status, endpoint: getEndpoint(payload) } @@ -33,7 +33,7 @@ const getEndpoint = (payload) => { endpoint_type: 'standard', url: payload.endpointUrl, payload_format: payload.payloadFormat, - log_line_separator: payload.lineSeparator, + log_line_separator: payload.lineSeparator === '\\n' ? '\n' : payload.lineSeparator, max_size: payload.maxSize, headers: getHeaders(payload.headers) } diff --git a/src/services/data-streaming-services/load-data-streaming-service.js b/src/services/data-streaming-services/load-data-streaming-service.js index ed27b26ac..0589831d6 100644 --- a/src/services/data-streaming-services/load-data-streaming-service.js +++ b/src/services/data-streaming-services/load-data-streaming-service.js @@ -40,7 +40,10 @@ const getInfoByEndpoint = (payload) => { return { endpointUrl: payload.endpoint.url, payloadFormat: payload.endpoint.payload_format, - lineSeparator: payload.endpoint.log_line_separator, + lineSeparator: + payload.endpoint.log_line_separator === '\n' + ? '\\n' + : payload.endpoint.log_line_separator, maxSize: payload.endpoint.max_size, ...getHeaders(payload) } diff --git a/src/templates/edit-form-block/index.vue b/src/templates/edit-form-block/index.vue index 563ec4f8b..a632b4b08 100644 --- a/src/templates/edit-form-block/index.vue +++ b/src/templates/edit-form-block/index.vue @@ -10,7 +10,6 @@ const props = defineProps({ isTabs: { type: Boolean, - required: true, default: false }, editService: { diff --git a/src/views/DataStreaming/CreateView.vue b/src/views/DataStreaming/CreateView.vue index 7f0646f3f..89289e29f 100644 --- a/src/views/DataStreaming/CreateView.vue +++ b/src/views/DataStreaming/CreateView.vue @@ -49,15 +49,15 @@ ), maxSize: yup.number().when('endpoint', { is: 'standard', - then: (schema) => schema.required('Payload Max Size is a required field') + then: (schema) => schema.required('Max Size is a required field') }), lineSeparator: yup.string().when('endpoint', { is: 'standard', - then: (schema) => schema.required('Payload Log Line Separator is a required field') + then: (schema) => schema.required('Log Line Separator is a required field') }), payloadFormat: yup.string().when('endpoint', { is: 'standard', - then: (schema) => schema.required('Payload Format is a required field') + then: (schema) => schema.required('Format is a required field') }), // Kafka @@ -93,7 +93,7 @@ }), objectKey: yup.string().when('endpoint', { is: 's3', - then: (schema) => schema.max(150).required('Object Key Prefix is a required field') + then: (schema) => schema.max(150) }), contentType: yup.string().when('endpoint', { is: 's3', @@ -215,7 +215,7 @@ endpointUrl: '', headers: [{ value: '', deleted: false }], maxSize: 1000000, - lineSeparator: '\n', + lineSeparator: '\\n', payloadFormat: '$dataset', // Kafka diff --git a/src/views/DataStreaming/EditView.vue b/src/views/DataStreaming/EditView.vue index 6ef3070bb..5a2d722ef 100644 --- a/src/views/DataStreaming/EditView.vue +++ b/src/views/DataStreaming/EditView.vue @@ -54,15 +54,15 @@ ), maxSize: yup.number().when('endpoint', { is: 'standard', - then: (schema) => schema.required('Payload Max Size is a required field') + then: (schema) => schema.required('Max Size is a required field') }), lineSeparator: yup.string().when('endpoint', { is: 'standard', - then: (schema) => schema.required('Payload Log Line Separator is a required field') + then: (schema) => schema.required('Log Line Separator is a required field') }), payloadFormat: yup.string().when('endpoint', { is: 'standard', - then: (schema) => schema.required('Payload Format is a required field') + then: (schema) => schema.required('Format is a required field') }), // Kafka @@ -98,7 +98,7 @@ }), objectKey: yup.string().when('endpoint', { is: 's3', - then: (schema) => schema.max(150).required('Object Key Prefix is a required field') + then: (schema) => schema.max(150) }), contentType: yup.string().when('endpoint', { is: 's3', diff --git a/src/views/DataStreaming/FormFields/FormFieldsDataStreaming.vue b/src/views/DataStreaming/FormFields/FormFieldsDataStreaming.vue index be73ff8b5..98275e881 100644 --- a/src/views/DataStreaming/FormFields/FormFieldsDataStreaming.vue +++ b/src/views/DataStreaming/FormFields/FormFieldsDataStreaming.vue @@ -243,75 +243,6 @@ @click="addHeader()" /> - -
- - - - The format that payload will be sent. The $dataset variable will be replaced by all logs - already with the log line separator applied. - - {{ payloadFormatError }} -
- -
- - - - The format that payload will be sent. The $dataset variable will be replaced by all logs - already with the log line separator applied. - - {{ lineSeparatorError }} -
- -
- - - - You can define the maximum size of data packets in bytes. Use a value starting from - 1000000. - - {{ maxSizeError }} -
Object Key Prefix *Object Key Prefix + + +