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 2023/03/03 05:04:20 UTC

[inlong] branch master updated: [INLONG-7499][Dashboard] Support redis node management (#7500)

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 2929e6523 [INLONG-7499][Dashboard] Support redis node management (#7500)
2929e6523 is described below

commit 2929e65239629830ff54d5b62d3d3ab26780c76e
Author: Lizhen <88...@users.noreply.github.com>
AuthorDate: Fri Mar 3 13:04:13 2023 +0800

    [INLONG-7499][Dashboard] Support redis node management (#7500)
---
 inlong-dashboard/src/locales/cn.json               |  3 +
 inlong-dashboard/src/locales/en.json               |  3 +
 inlong-dashboard/src/metas/nodes/defaults/Redis.ts | 53 ++++++++++++++++
 inlong-dashboard/src/metas/nodes/defaults/index.ts |  5 ++
 inlong-dashboard/src/metas/sinks/defaults/Redis.ts | 70 ++--------------------
 5 files changed, 70 insertions(+), 64 deletions(-)

diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json
index 955f7fc66..442cd377d 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -487,6 +487,9 @@
   "meta.Nodes.Hudi.Url": "地址",
   "meta.Nodes.Hudi.CatalogType": "目录类型",
   "meta.Nodes.Hudi.Warehouse": "仓库路径",
+  "meta.Nodes.Redis.Username": "用户名",
+  "meta.Nodes.Redis.Password": "密码",
+  "meta.Nodes.Redis.Url": "地址",
   "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 ac6d6d44e..daa52583b 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -482,6 +482,9 @@
   "meta.Nodes.StarRocks.Username": "Username",
   "meta.Nodes.StarRocks.Password": "Password",
   "meta.Nodes.StarRocks.Url": "URL",
+  "meta.Nodes.Redis.Username": "Username",
+  "meta.Nodes.Redis.Password": "Password",
+  "meta.Nodes.Redis.Url": "URL",
   "meta.Nodes.Hudi.Username": "Username",
   "meta.Nodes.Hudi.Password": "Password",
   "meta.Nodes.Hudi.Url": "URL",
diff --git a/inlong-dashboard/src/metas/nodes/defaults/Redis.ts b/inlong-dashboard/src/metas/nodes/defaults/Redis.ts
new file mode 100644
index 000000000..3db155c35
--- /dev/null
+++ b/inlong-dashboard/src/metas/nodes/defaults/Redis.ts
@@ -0,0 +1,53 @@
+/*
+ * 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';
+
+const { I18n } = DataWithBackend;
+const { FieldDecorator } = RenderRow;
+
+export default class RedisNode extends NodeInfo implements DataWithBackend, RenderRow, RenderList {
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+  })
+  @I18n('meta.Nodes.Redis.Username')
+  username: string;
+
+  @FieldDecorator({
+    type: 'password',
+    rules: [{ required: true }],
+  })
+  @I18n('meta.Nodes.Redis.Password')
+  token: string;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: [110, 130].includes(values?.status),
+      placeholder: '127.0.0.1:6379,127.0.0.1:6378',
+    }),
+  })
+  @I18n('meta.Nodes.Redis.Url')
+  url: string;
+}
diff --git a/inlong-dashboard/src/metas/nodes/defaults/index.ts b/inlong-dashboard/src/metas/nodes/defaults/index.ts
index 4b7208d60..57ae08146 100644
--- a/inlong-dashboard/src/metas/nodes/defaults/index.ts
+++ b/inlong-dashboard/src/metas/nodes/defaults/index.ts
@@ -56,6 +56,11 @@ export const allDefaultNodes: MetaExportWithBackendList<NodeMetaType> = [
     value: 'MYSQL',
     LoadEntity: () => import('./MySQL'),
   },
+  {
+    label: 'Redis',
+    value: 'REDIS',
+    LoadEntity: () => import('./Redis'),
+  },
   {
     label: 'StarRocks',
     value: 'STARROCKS',
diff --git a/inlong-dashboard/src/metas/sinks/defaults/Redis.ts b/inlong-dashboard/src/metas/sinks/defaults/Redis.ts
index c489c4788..e927b4679 100644
--- a/inlong-dashboard/src/metas/sinks/defaults/Redis.ts
+++ b/inlong-dashboard/src/metas/sinks/defaults/Redis.ts
@@ -24,6 +24,7 @@ import i18n from '@/i18n';
 import EditableTable from '@/components/EditableTable';
 import { sourceFields } from '../common/sourceFields';
 import { SinkInfo } from '../common/SinkInfo';
+import NodeSelect from '@/components/NodeSelect';
 
 const { I18n } = DataWithBackend;
 const { FieldDecorator } = RenderRow;
@@ -95,34 +96,15 @@ export default class RedisSink extends SinkInfo implements DataWithBackend, Rend
   clusterMode: string;
 
   @FieldDecorator({
-    type: 'input',
-    initialValue: '127.0.0.1',
-    rules: [{ required: false }],
-    props: values => ({
-      disabled: [110, 130].includes(values?.status),
-      placeholder: '127.0.0.1',
-    }),
-    visible: values => values!.clusterMode == 'standalone',
-  })
-  @ColumnDecorator()
-  @I18n('meta.Sinks.Redis.Host')
-  host: String;
-
-  @FieldDecorator({
-    type: 'inputnumber',
-    rules: [{ required: false }],
-    initialValue: 6379,
+    type: NodeSelect,
+    rules: [{ required: true }],
     props: values => ({
       disabled: [110, 130].includes(values?.status),
-      min: 1,
-      max: 65535,
-      placeholder: i18n.t('meta.Sinks.Redis.PortHelper'),
+      nodeType: 'Redis',
     }),
-    visible: values => values!.clusterMode == 'standalone',
   })
-  @ColumnDecorator()
-  @I18n('meta.Sinks.Redis.Port')
-  port: number;
+  @I18n('meta.Sinks.DataNodeName')
+  dataNodeName: string;
 
   @FieldDecorator({
     type: 'input',
@@ -137,34 +119,6 @@ export default class RedisSink extends SinkInfo implements DataWithBackend, Rend
   @I18n('meta.Sinks.Redis.SentinelMasterName')
   sentinelMasterName: String;
 
-  @FieldDecorator({
-    type: 'input',
-    initialValue: '',
-    rules: [{ required: false }],
-    props: values => ({
-      disabled: [110, 130].includes(values?.status),
-      placeholder: '127.0.0.1:6379,127.0.0.1:6378',
-    }),
-    visible: values => values!.clusterMode == 'sentinel',
-  })
-  @ColumnDecorator()
-  @I18n('meta.Sinks.Redis.SentinelsInfo')
-  sentinelsInfo: String;
-
-  @FieldDecorator({
-    type: 'input',
-    initialValue: '',
-    rules: [{ required: false }],
-    props: values => ({
-      disabled: [110, 130].includes(values?.status),
-      placeholder: '127.0.0.1:6379,127.0.0.1:6378',
-    }),
-    visible: values => values!.clusterMode == 'cluster',
-  })
-  @ColumnDecorator()
-  @I18n('meta.Sinks.Redis.ClusterNodes')
-  clusterNodes: String;
-
   @FieldDecorator({
     type: 'select',
     rules: [{ required: true }],
@@ -342,18 +296,6 @@ export default class RedisSink extends SinkInfo implements DataWithBackend, Rend
   @I18n('meta.Sinks.Redis.Database')
   database: number;
 
-  @FieldDecorator({
-    type: 'password',
-    rules: [{ required: false }],
-    initialValue: '',
-    props: values => ({
-      disabled: [110, 130].includes(values?.status),
-    }),
-  })
-  @ColumnDecorator()
-  @I18n('meta.Sinks.Redis.Password')
-  password: string;
-
   @FieldDecorator({
     type: 'inputnumber',
     initialValue: 0,