This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push: new d91262e261 [INLONG-9963][Dashboard][Agent] Add agentIp fields to Kafka and Pulsar source (#9964) d91262e261 is described below commit d91262e261a5a7e2c7dcfdc2ccc8d701be1d982d Author: haifxu <xhf1208357...@gmail.com> AuthorDate: Thu Apr 11 11:55:50 2024 +0800 [INLONG-9963][Dashboard][Agent] Add agentIp fields to Kafka and Pulsar source (#9964) --- .../inlong/agent/plugin/sources/KafkaSource.java | 2 +- .../src/plugins/sources/defaults/Kafka.ts | 94 +++++++++++++++++++++- .../src/plugins/sources/defaults/Pulsar.ts | 92 +++++++++++++++++++++ inlong-dashboard/src/ui/locales/en.json | 2 +- 4 files changed, 187 insertions(+), 3 deletions(-) diff --git a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/KafkaSource.java b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/KafkaSource.java index 62aa87433b..fe31730fdc 100644 --- a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/KafkaSource.java +++ b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/KafkaSource.java @@ -145,7 +145,7 @@ public class KafkaSource extends AbstractSource { props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, profile.get(TASK_KAFKA_AUTO_COMMIT_OFFSET_RESET)); props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false); - allPartitionOffsets = profile.get(TASK_KAFKA_OFFSET); + allPartitionOffsets = profile.get(TASK_KAFKA_OFFSET, null); isRestoreFromDB = profile.getBoolean(RESTORE_FROM_DB, false); if (!isRestoreFromDB && StringUtils.isNotBlank(allPartitionOffsets)) { // example:0#110_1#666_2#222 diff --git a/inlong-dashboard/src/plugins/sources/defaults/Kafka.ts b/inlong-dashboard/src/plugins/sources/defaults/Kafka.ts index da0ff9d0b1..1c11b35ab4 100644 --- a/inlong-dashboard/src/plugins/sources/defaults/Kafka.ts +++ b/inlong-dashboard/src/plugins/sources/defaults/Kafka.ts @@ -22,6 +22,7 @@ import { RenderRow } from '@/plugins/RenderRow'; import { RenderList } from '@/plugins/RenderList'; import { SourceInfo } from '../common/SourceInfo'; import i18n from '@/i18n'; +import rulesPattern from '@/core/utils/pattern'; const { I18n } = DataWithBackend; const { FieldDecorator, SyncField, IngestionField } = RenderRow; @@ -31,6 +32,97 @@ export default class KafkaSource extends SourceInfo implements DataWithBackend, RenderRow, RenderList { + @FieldDecorator({ + type: 'select', + rules: [{ required: true }], + props: values => ({ + disabled: Boolean(values.id), + showSearch: true, + allowClear: true, + filterOption: false, + options: { + requestTrigger: ['onOpen', 'onSearch'], + requestService: keyword => ({ + url: '/cluster/list', + method: 'POST', + data: { + keyword, + type: 'AGENT', + pageNum: 1, + pageSize: 10, + }, + }), + requestParams: { + formatResult: result => + result?.list?.map(item => ({ + ...item, + label: item.displayName, + value: item.name, + })), + }, + }, + onChange: (value, option) => { + return { + clusterId: option.id, + }; + }, + }), + }) + @ColumnDecorator() + @IngestionField() + @I18n('meta.Sources.File.ClusterName') + inlongClusterName: string; + + @FieldDecorator({ + type: 'text', + hidden: true, + }) + @I18n('clusterId') + @IngestionField() + clusterId: number; + + @FieldDecorator({ + type: 'select', + rules: [ + { + pattern: rulesPattern.ip, + message: i18n.t('meta.Sources.File.IpRule'), + required: true, + }, + ], + props: values => ({ + disabled: Boolean(values.id), + showSearch: true, + allowClear: true, + filterOption: false, + options: { + requestTrigger: ['onOpen', 'onSearch'], + requestService: keyword => ({ + url: '/cluster/node/list', + method: 'POST', + data: { + keyword, + parentId: values.clusterId, + pageNum: 1, + pageSize: 10, + }, + }), + requestParams: { + formatResult: result => + result?.list?.map(item => ({ + ...item, + label: item.ip, + value: item.ip, + })), + }, + }, + }), + }) + @ColumnDecorator() + @IngestionField() + @I18n('meta.Sources.File.DataSourceIP') + agentIp: string; + @FieldDecorator({ type: 'input', rules: [{ required: true }], @@ -60,7 +152,7 @@ export default class KafkaSource @FieldDecorator({ type: 'select', - initialValue: 'Latest', + initialValue: 'latest', rules: [{ required: true }], props: values => ({ disabled: values?.status === 101, diff --git a/inlong-dashboard/src/plugins/sources/defaults/Pulsar.ts b/inlong-dashboard/src/plugins/sources/defaults/Pulsar.ts index 0d6c1c9f6e..3f3f0bf9c1 100644 --- a/inlong-dashboard/src/plugins/sources/defaults/Pulsar.ts +++ b/inlong-dashboard/src/plugins/sources/defaults/Pulsar.ts @@ -23,6 +23,7 @@ import { RenderList } from '@/plugins/RenderList'; import { SourceInfo } from '../common/SourceInfo'; import dayjs from 'dayjs'; import i18n from '@/i18n'; +import rulesPattern from '@/core/utils/pattern'; const { I18n } = DataWithBackend; const { FieldDecorator, SyncField, IngestionField } = RenderRow; @@ -32,6 +33,97 @@ export default class PulsarSource extends SourceInfo implements DataWithBackend, RenderRow, RenderList { + @FieldDecorator({ + type: 'select', + rules: [{ required: true }], + props: values => ({ + disabled: Boolean(values.id), + showSearch: true, + allowClear: true, + filterOption: false, + options: { + requestTrigger: ['onOpen', 'onSearch'], + requestService: keyword => ({ + url: '/cluster/list', + method: 'POST', + data: { + keyword, + type: 'AGENT', + pageNum: 1, + pageSize: 10, + }, + }), + requestParams: { + formatResult: result => + result?.list?.map(item => ({ + ...item, + label: item.displayName, + value: item.name, + })), + }, + }, + onChange: (value, option) => { + return { + clusterId: option.id, + }; + }, + }), + }) + @ColumnDecorator() + @IngestionField() + @I18n('meta.Sources.File.ClusterName') + inlongClusterName: string; + + @FieldDecorator({ + type: 'text', + hidden: true, + }) + @I18n('clusterId') + @IngestionField() + clusterId: number; + + @FieldDecorator({ + type: 'select', + rules: [ + { + pattern: rulesPattern.ip, + message: i18n.t('meta.Sources.File.IpRule'), + required: true, + }, + ], + props: values => ({ + disabled: Boolean(values.id), + showSearch: true, + allowClear: true, + filterOption: false, + options: { + requestTrigger: ['onOpen', 'onSearch'], + requestService: keyword => ({ + url: '/cluster/node/list', + method: 'POST', + data: { + keyword, + parentId: values.clusterId, + pageNum: 1, + pageSize: 10, + }, + }), + requestParams: { + formatResult: result => + result?.list?.map(item => ({ + ...item, + label: item.ip, + value: item.ip, + })), + }, + }, + }), + }) + @ColumnDecorator() + @IngestionField() + @I18n('meta.Sources.File.DataSourceIP') + agentIp: string; + @FieldDecorator({ type: 'input', rules: [{ required: true }], diff --git a/inlong-dashboard/src/ui/locales/en.json b/inlong-dashboard/src/ui/locales/en.json index 87198b1e8d..57bae06cb5 100644 --- a/inlong-dashboard/src/ui/locales/en.json +++ b/inlong-dashboard/src/ui/locales/en.json @@ -27,7 +27,7 @@ "meta.Sources.NameRule": "Only English letters, numbers, dots(.), minus(-), and underscores(_)", "meta.Sources.Type": "Type", "meta.Sources.File.SerializationType": "File type", - "meta.Sources.File.DataSourceIP": "Data source IP", + "meta.Sources.File.DataSourceIP": "Source IP", "meta.Sources.File.ClusterName": "Cluster name", "meta.Sources.File.FilePath": "File path", "meta.Sources.File.FilePathHelp": "Must be an absolute path and support regular expressions, such as: /data/.*log",