You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by le...@apache.org on 2022/04/02 07:31:29 UTC
[incubator-inlong] branch master updated: [INLONG-3506][Dashboard] Support Kafka Sink
This is an automated email from the ASF dual-hosted git repository.
leezng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 5d0b35f [INLONG-3506][Dashboard] Support Kafka Sink
5d0b35f is described below
commit 5d0b35f1c8289be649a596279f3bef64879d5f6a
Author: Daniel <le...@outlook.com>
AuthorDate: Sat Apr 2 15:31:23 2022 +0800
[INLONG-3506][Dashboard] Support Kafka Sink
---
.../src/components/MetaData/StorageKafka.tsx | 124 +++++++++++++++++++++
inlong-dashboard/src/components/MetaData/index.ts | 6 +
inlong-dashboard/src/locales/cn.json | 4 +
inlong-dashboard/src/locales/en.json | 4 +
4 files changed, 138 insertions(+)
diff --git a/inlong-dashboard/src/components/MetaData/StorageKafka.tsx b/inlong-dashboard/src/components/MetaData/StorageKafka.tsx
new file mode 100644
index 0000000..aa1d99c
--- /dev/null
+++ b/inlong-dashboard/src/components/MetaData/StorageKafka.tsx
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { getColsFromFields, GetStorageFormFieldsType } from '@/utils/metaData';
+import i18n from '@/i18n';
+import { ColumnsType } from 'antd/es/table';
+import { excludeObject } from '@/utils';
+
+const getForm: GetStorageFormFieldsType = (
+ type: 'form' | 'col' = 'form',
+ { currentValues, isEdit } = {} as any,
+) => {
+ const fileds = [
+ {
+ name: 'bootstrapServers',
+ type: 'input',
+ label: i18n.t('components.AccessHelper.StorageMetaData.Kafka.Server'),
+ rules: [{ required: true }],
+ initialValue: '127.0.0.1:9092',
+ props: {
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ _inTable: true,
+ },
+ {
+ name: 'topicName',
+ type: 'input',
+ label: 'Topic',
+ rules: [{ required: true }],
+ props: {
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ _inTable: true,
+ },
+ {
+ name: 'serializationType',
+ type: 'radio',
+ label: i18n.t('components.AccessHelper.StorageMetaData.Kafka.SerializationType'),
+ initialValue: 'JSON',
+ rules: [{ required: true }],
+ props: {
+ options: [
+ {
+ label: 'JSON',
+ value: 'JSON',
+ },
+ {
+ label: 'CANAL',
+ value: 'CANAL',
+ },
+ {
+ label: 'AVRO',
+ value: 'AVRO',
+ },
+ ],
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ _inTable: true,
+ },
+ {
+ name: i18n.t('components.AccessHelper.StorageMetaData.Kafka.PartitionNum'),
+ type: 'inputnumber',
+ label: 'Topic分区数',
+ initialValue: 3,
+ props: {
+ min: 1,
+ max: 30,
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ rules: [{ required: true }],
+ },
+ {
+ name: 'autoOffsetReset',
+ type: 'radio',
+ label: i18n.t('components.AccessHelper.StorageMetaData.Kafka.AutoOffsetReset'),
+ initialValue: 'earliest',
+ rules: [{ required: true }],
+ props: {
+ options: [
+ {
+ label: 'earliest',
+ value: 'earliest',
+ },
+ {
+ label: 'latest',
+ value: 'latest',
+ },
+ {
+ label: 'none',
+ value: 'none',
+ },
+ ],
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ },
+ ];
+
+ return type === 'col'
+ ? getColsFromFields(fileds)
+ : fileds.map(item => excludeObject(['_inTable'], item));
+};
+
+const tableColumns = getForm('col') as ColumnsType;
+
+export const StorageKafka = {
+ getForm,
+ tableColumns,
+};
diff --git a/inlong-dashboard/src/components/MetaData/index.ts b/inlong-dashboard/src/components/MetaData/index.ts
index 5671382..62a353c 100644
--- a/inlong-dashboard/src/components/MetaData/index.ts
+++ b/inlong-dashboard/src/components/MetaData/index.ts
@@ -21,6 +21,7 @@ import type { GetStorageFormFieldsType, GetStorageColumnsType } from '@/utils/me
import type { ColumnsType } from 'antd/es/table';
import { StorageHive } from './StorageHive';
import { StorageClickhouse } from './StorageClickhouse';
+import { StorageKafka } from './StorageKafka';
export interface StoragesType {
label: string;
@@ -48,4 +49,9 @@ export const Storages: StoragesType[] = [
value: 'CLICK_HOUSE',
...StorageClickhouse,
},
+ {
+ label: 'KAFKA',
+ value: 'KAFKA',
+ ...StorageKafka,
+ },
];
diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json
index 18ef34d..719cb9e 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -78,6 +78,10 @@
"components.AccessHelper.StorageMetaData.Clickhouse.FieldNameRule": "以英文字母开头,只能包含英文字母、数字、下划线",
"components.AccessHelper.StorageMetaData.Clickhouse.FieldType": "字段类型",
"components.AccessHelper.StorageMetaData.Clickhouse.FieldDescription": "字段描述",
+ "components.AccessHelper.StorageMetaData.Kafka.Server": "服务器地址",
+ "components.AccessHelper.StorageMetaData.Kafka.SerializationType": "序列化类型",
+ "components.AccessHelper.StorageMetaData.Kafka.PartitionNum": "Topic分区数",
+ "components.AccessHelper.StorageMetaData.Kafka.AutoOffsetReset": "自动偏移量重置",
"components.AccessHelper.FieldsConfig.businessFields.BusinessLabelName": "Group 中文名称",
"components.AccessHelper.FieldsConfig.businessFields.Stripe/Second": "条/秒",
"components.AccessHelper.FieldsConfig.businessFields.MessageMiddleware": "消息中间件",
diff --git a/inlong-dashboard/src/locales/en.json b/inlong-dashboard/src/locales/en.json
index 6a55ec7..fdad9da 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -78,6 +78,10 @@
"components.AccessHelper.StorageMetaData.Clickhouse.FieldNameRule": "At the beginning of English letters, only English letters, numbers, and underscores",
"components.AccessHelper.StorageMetaData.Clickhouse.FieldType": "FieldType",
"components.AccessHelper.StorageMetaData.Clickhouse.FieldDescription": "FieldDescription",
+ "components.AccessHelper.StorageMetaData.Kafka.Server": "Server",
+ "components.AccessHelper.StorageMetaData.Kafka.SerializationType": "SerializationType",
+ "components.AccessHelper.StorageMetaData.Kafka.PartitionNum": "PartitionNum",
+ "components.AccessHelper.StorageMetaData.Kafka.AutoOffsetReset": "AutoOffsetReset",
"components.AccessHelper.FieldsConfig.businessFields.BusinessLabelName": "Group Label",
"components.AccessHelper.FieldsConfig.businessFields.Stripe/Second": "Stripe / S",
"components.AccessHelper.FieldsConfig.businessFields.MessageMiddleware": "Middleware",