You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/11/29 09:09:02 UTC
[inlong] branch master updated: [INLONG-6661][Dashboard] Support Elasticsearch DataNode (#6662)
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 1e9109b6f [INLONG-6661][Dashboard] Support Elasticsearch DataNode (#6662)
1e9109b6f is described below
commit 1e9109b6ffaffb5529a2902f4158f7669bd049e4
Author: Daniel <le...@apache.org>
AuthorDate: Tue Nov 29 17:08:56 2022 +0800
[INLONG-6661][Dashboard] Support Elasticsearch DataNode (#6662)
---
inlong-dashboard/src/locales/cn.json | 14 +-
inlong-dashboard/src/locales/en.json | 14 +-
.../src/metas/nodes/defaults/Elasticsearch.ts | 152 +++++++++++++++++++++
.../sinks/defaults/{ES.ts => Elasticsearch.ts} | 95 +++++--------
inlong-dashboard/src/metas/sinks/defaults/index.ts | 2 +-
.../src/metas/sources/common/SourceDefaultInfo.ts | 1 +
inlong-dashboard/src/pages/Clusters/index.tsx | 4 +-
inlong-dashboard/src/pages/Nodes/DetailModal.tsx | 7 +-
inlong-dashboard/src/pages/Nodes/index.tsx | 4 +-
9 files changed, 217 insertions(+), 76 deletions(-)
diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json
index 1ecc66660..817547fcb 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -150,15 +150,12 @@
"meta.Sinks.ClickHouse.PrimaryKey": "主键",
"meta.Sinks.ClickHouse.CompressionCode": "压缩格式",
"meta.Sinks.ClickHouse.TtlExpr": "生命周期",
+ "meta.Sinks.ES.DataNodeName": "数据节点",
"meta.Sinks.ES.IndexName": "索引名称",
- "meta.Sinks.ES.FlushInterval": "刷新的间隔",
- "meta.Sinks.ES.FlushIntervalUnit": "秒",
"meta.Sinks.ES.FlushRecord": "刷新的数据条数",
"meta.Sinks.ES.FlushRecordUnit": "条",
"meta.Sinks.ES.RetryTimes": "重试次数",
"meta.Sinks.ES.RetryTimesUnit": "次",
- "meta.Sinks.ES.Host": "主机地址",
- "meta.Sinks.ES.Port": "端口",
"meta.Sinks.ES.FieldName": "字段名",
"meta.Sinks.ES.FieldNameRule": "以英文字母开头,只能包含英文字母、数字、下划线",
"meta.Sinks.ES.FieldType": "字段类型",
@@ -354,6 +351,15 @@
"meta.Nodes.MySQL.Password": "密码",
"meta.Nodes.MySQL.Url": "地址",
"meta.Nodes.MySQL.BackupUrl": "备份地址",
+ "meta.Nodes.ES.Host": "主机",
+ "meta.Nodes.ES.Username": "用户名",
+ "meta.Nodes.ES.Password": "密码",
+ "meta.Nodes.ES.FlushInterval": "刷新的间隔",
+ "meta.Nodes.ES.ConcurrentRequests": "并发线程数",
+ "meta.Nodes.ES.MaxConnect": "最大连接数",
+ "meta.Nodes.ES.KeywordMaxLength": "keyword类型的最大长度",
+ "meta.Nodes.ES.IsUseIndexId": "是否创建index id",
+ "meta.Nodes.ES.MaxThreads": "最大线程数",
"components.EditableTable.NewLine": "新增一行",
"components.FormGenerator.plugins.PleaseChoose": "请选择",
"components.FormGenerator.plugins.PleaseInput": "请输入",
diff --git a/inlong-dashboard/src/locales/en.json b/inlong-dashboard/src/locales/en.json
index 36e2fab62..c041ab8e8 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -150,15 +150,12 @@
"meta.Sinks.ClickHouse.PrimaryKey": "PrimaryKey",
"meta.Sinks.ClickHouse.CompressionCode": "CompressionCode",
"meta.Sinks.ClickHouse.TtlExpr": "TtlExpr",
+ "meta.Sinks.ES.DataNodeName": "DataNode",
"meta.Sinks.ES.IndexName": "IndexName",
- "meta.Sinks.ES.FlushInterval": "FlushInterval",
- "meta.Sinks.ES.FlushIntervalUnit": "S",
"meta.Sinks.ES.FlushRecord": "FlushRecord",
"meta.Sinks.ES.FlushRecordUnit": "items",
"meta.Sinks.ES.RetryTimes": "RetryTimes",
"meta.Sinks.ES.RetryTimesUnit": "items",
- "meta.Sinks.ES.Host": "Host",
- "meta.Sinks.ES.Port": "Port",
"meta.Sinks.ES.FieldName": "FieldName",
"meta.Sinks.ES.FieldNameRule": "At the beginning of English letters, only English letters, numbers, and underscores",
"meta.Sinks.ES.FieldType": "FieldType",
@@ -354,6 +351,15 @@
"meta.Nodes.MySQL.Password": "Password",
"meta.Nodes.MySQL.Url": "URL",
"meta.Nodes.MySQL.BackupUrl": "Backup URL",
+ "meta.Nodes.ES.Host": "Host",
+ "meta.Nodes.ES.Username": "Username",
+ "meta.Nodes.ES.Password": "Password",
+ "meta.Nodes.ES.FlushInterval": "FlushInterval",
+ "meta.Nodes.ES.ConcurrentRequests": "ConcurrentRequests",
+ "meta.Nodes.ES.MaxConnect": "MaxConnect",
+ "meta.Nodes.ES.KeywordMaxLength": "Max keyword length",
+ "meta.Nodes.ES.IsUseIndexId": "Create index id or not",
+ "meta.Nodes.ES.MaxThreads": "MaxThreads",
"components.EditableTable.NewLine": "New line",
"components.FormGenerator.plugins.PleaseChoose": "Please select",
"components.FormGenerator.plugins.PleaseInput": "Please input",
diff --git a/inlong-dashboard/src/metas/nodes/defaults/Elasticsearch.ts b/inlong-dashboard/src/metas/nodes/defaults/Elasticsearch.ts
new file mode 100644
index 000000000..34b451777
--- /dev/null
+++ b/inlong-dashboard/src/metas/nodes/defaults/Elasticsearch.ts
@@ -0,0 +1,152 @@
+/*
+ * 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 { DataWithBackend } from '@/metas/DataWithBackend';
+import { RenderRow } from '@/metas/RenderRow';
+import { RenderList } from '@/metas/RenderList';
+import { NodeInfo } from '../common/NodeInfo';
+import i18n from '@/i18n';
+
+const { I18n } = DataWithBackend;
+const { FieldDecorator } = RenderRow;
+
+export default class ElasticsearchNode
+ extends NodeInfo
+ implements DataWithBackend, RenderRow, RenderList
+{
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: {
+ placeholder: 'ip:port',
+ },
+ })
+ @I18n('meta.Nodes.ES.Host')
+ httpHosts: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ })
+ @I18n('meta.Nodes.ES.Username')
+ username: string;
+
+ @FieldDecorator({
+ type: 'password',
+ rules: [{ required: true }],
+ })
+ @I18n('meta.Nodes.ES.Password')
+ password: string;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 4000,
+ props: {
+ min: 0,
+ },
+ })
+ @I18n('bulkAction')
+ bulkAction: number;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 10,
+ props: {
+ min: 0,
+ },
+ suffix: 'MB',
+ })
+ @I18n('bulkSize')
+ bulkSizeMb: number;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 60,
+ props: {
+ min: 0,
+ },
+ })
+ @I18n('meta.Nodes.ES.FlushInterval')
+ flushInterval: number;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 5,
+ props: {
+ min: 0,
+ },
+ })
+ @I18n('meta.Nodes.ES.ConcurrentRequests')
+ concurrentRequests: number;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 10,
+ props: {
+ min: 0,
+ },
+ })
+ @I18n('meta.Nodes.ES.MaxConnect')
+ maxConnect: number;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 32767,
+ props: {
+ min: 0,
+ },
+ })
+ @I18n('meta.Nodes.ES.KeywordMaxLength')
+ keywordMaxLength: number;
+
+ @FieldDecorator({
+ type: 'radio',
+ initialValue: false,
+ props: {
+ options: [
+ {
+ label: i18n.t('basic.Yes'),
+ value: true,
+ },
+ {
+ label: i18n.t('basic.No'),
+ value: false,
+ },
+ ],
+ },
+ })
+ @I18n('meta.Nodes.ES.IsUseIndexId')
+ isUseIndexId: boolean;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ initialValue: 2,
+ props: {
+ min: 0,
+ },
+ })
+ @I18n('meta.Nodes.ES.MaxThreads')
+ maxThreads: number;
+
+ @FieldDecorator({
+ type: 'input',
+ })
+ @I18n('auditSetName')
+ auditSetName: string;
+}
diff --git a/inlong-dashboard/src/metas/sinks/defaults/ES.ts b/inlong-dashboard/src/metas/sinks/defaults/Elasticsearch.ts
similarity index 80%
rename from inlong-dashboard/src/metas/sinks/defaults/ES.ts
rename to inlong-dashboard/src/metas/sinks/defaults/Elasticsearch.ts
index 13ccfaaf3..f8fc431d0 100644
--- a/inlong-dashboard/src/metas/sinks/defaults/ES.ts
+++ b/inlong-dashboard/src/metas/sinks/defaults/Elasticsearch.ts
@@ -47,7 +47,39 @@ const esTypes = [
value: item,
}));
-export default class EsSink extends SinkInfo implements DataWithBackend, RenderRow, RenderList {
+export default class ElasticsearchSink
+ extends SinkInfo
+ implements DataWithBackend, RenderRow, RenderList
+{
+ @FieldDecorator({
+ type: 'select',
+ rules: [{ required: true }],
+ props: values => ({
+ showSearch: true,
+ disabled: [110, 130].includes(values?.status),
+ options: {
+ requestService: {
+ url: '/node/list',
+ method: 'POST',
+ data: {
+ type: 'ELASTICSEARCH',
+ pageNum: 1,
+ pageSize: 20,
+ },
+ },
+ requestParams: {
+ formatResult: result =>
+ result?.list?.map(item => ({
+ label: item.name,
+ value: item.name,
+ })),
+ },
+ },
+ }),
+ })
+ @I18n('meta.Sinks.ES.DataNodeName')
+ dataNodeName: string;
+
@FieldDecorator({
type: 'input',
rules: [{ required: true }],
@@ -81,67 +113,6 @@ export default class EsSink extends SinkInfo implements DataWithBackend, RenderR
@I18n('meta.Sinks.EnableCreateResource')
enableCreateResource: number;
- @FieldDecorator({
- type: 'input',
- rules: [{ required: true }],
- props: values => ({
- disabled: [110, 130].includes(values?.status),
- }),
- })
- @ColumnDecorator()
- @I18n('meta.Sinks.Username')
- username: string;
-
- @FieldDecorator({
- type: 'password',
- rules: [{ required: true }],
- props: values => ({
- disabled: [110, 130].includes(values?.status),
- }),
- })
- @ColumnDecorator()
- @I18n('meta.Sinks.Password')
- password: string;
-
- @FieldDecorator({
- type: 'password',
- rules: [{ required: true }],
- props: values => ({
- disabled: [110, 130].includes(values?.status),
- }),
- })
- @ColumnDecorator()
- @I18n('meta.Sinks.ES.Host')
- host: string;
-
- @FieldDecorator({
- type: 'inputnumber',
- initialValue: 9200,
- rules: [{ required: true }],
- props: values => ({
- min: 1,
- max: 65535,
- disabled: [110, 130].includes(values?.status),
- }),
- })
- @ColumnDecorator()
- @I18n('meta.Sinks.ES.Port')
- port: number;
-
- @FieldDecorator({
- type: 'inputnumber',
- initialValue: 1,
- rules: [{ required: true }],
- suffix: i18n.t('meta.Sinks.ES.FlushIntervalUnit'),
- props: values => ({
- min: 1,
- disabled: [110, 130].includes(values?.status),
- }),
- })
- @ColumnDecorator()
- @I18n('meta.Sinks.ES.FlushInterval')
- flushInterval: number;
-
@FieldDecorator({
type: 'inputnumber',
initialValue: 1000,
diff --git a/inlong-dashboard/src/metas/sinks/defaults/index.ts b/inlong-dashboard/src/metas/sinks/defaults/index.ts
index 536c114ab..700013573 100644
--- a/inlong-dashboard/src/metas/sinks/defaults/index.ts
+++ b/inlong-dashboard/src/metas/sinks/defaults/index.ts
@@ -39,7 +39,7 @@ export const allDefaultSinks: MetaExportWithBackendList<SinkMetaType> = [
{
label: 'Elasticsearch',
value: 'ELASTICSEARCH',
- LoadEntity: () => import('./ES'),
+ LoadEntity: () => import('./Elasticsearch'),
},
{
label: 'Greenplum',
diff --git a/inlong-dashboard/src/metas/sources/common/SourceDefaultInfo.ts b/inlong-dashboard/src/metas/sources/common/SourceDefaultInfo.ts
index 301512ec9..6a7abf43e 100644
--- a/inlong-dashboard/src/metas/sources/common/SourceDefaultInfo.ts
+++ b/inlong-dashboard/src/metas/sources/common/SourceDefaultInfo.ts
@@ -89,6 +89,7 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
initialValue: defaultValue,
props: values => ({
disabled: Boolean(values.id),
+ dropdownMatchSelectWidth: false,
options: sources
.filter(item => item.value)
.map(item => ({
diff --git a/inlong-dashboard/src/pages/Clusters/index.tsx b/inlong-dashboard/src/pages/Clusters/index.tsx
index 42829341f..a50c56498 100644
--- a/inlong-dashboard/src/pages/Clusters/index.tsx
+++ b/inlong-dashboard/src/pages/Clusters/index.tsx
@@ -111,12 +111,12 @@ const Comp: React.FC = () => {
name: 'keyword',
},
{
- type: 'radiobutton',
+ type: 'select',
name: 'type',
label: i18n.t('pages.Clusters.Type'),
initialValue: defaultValues.type,
props: {
- buttonStyle: 'solid',
+ dropdownMatchSelectWidth: false,
options: clusters,
},
},
diff --git a/inlong-dashboard/src/pages/Nodes/DetailModal.tsx b/inlong-dashboard/src/pages/Nodes/DetailModal.tsx
index fd6154530..d98b3dd6f 100644
--- a/inlong-dashboard/src/pages/Nodes/DetailModal.tsx
+++ b/inlong-dashboard/src/pages/Nodes/DetailModal.tsx
@@ -81,7 +81,12 @@ const Comp: React.FC<Props> = ({ id, ...modalProps }) => {
}, [Entity]);
return (
- <Modal {...modalProps} title={id ? i18n.t('basic.Detail') : i18n.t('basic.Create')} onOk={onOk}>
+ <Modal
+ {...modalProps}
+ width={720}
+ title={id ? i18n.t('basic.Detail') : i18n.t('basic.Create')}
+ onOk={onOk}
+ >
<FormGenerator
content={content}
form={form}
diff --git a/inlong-dashboard/src/pages/Nodes/index.tsx b/inlong-dashboard/src/pages/Nodes/index.tsx
index 4b00c4045..e50b01fd5 100644
--- a/inlong-dashboard/src/pages/Nodes/index.tsx
+++ b/inlong-dashboard/src/pages/Nodes/index.tsx
@@ -94,12 +94,12 @@ const Comp: React.FC = () => {
name: 'keyword',
},
{
- type: 'radiobutton',
+ type: 'select',
name: 'type',
label: i18n.t('meta.Nodes.Type'),
initialValue: defaultValues.type,
props: {
- buttonStyle: 'solid',
+ dropdownMatchSelectWidth: false,
options: nodes,
},
},