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/08 03:35:29 UTC
[inlong] branch master updated: [INLONG-6418][Dashboard] Support management of MongoDB source (#6454)
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 f400e0372 [INLONG-6418][Dashboard] Support management of MongoDB source (#6454)
f400e0372 is described below
commit f400e0372784af204e4cd270d26ace1b966cb252
Author: Lizhen <88...@users.noreply.github.com>
AuthorDate: Tue Nov 8 11:35:24 2022 +0800
[INLONG-6418][Dashboard] Support management of MongoDB source (#6454)
---
inlong-dashboard/src/locales/cn.json | 6 ++
inlong-dashboard/src/locales/en.json | 6 ++
.../src/metas/sources/defaults/Mongodb.ts | 95 ++++++++++++++++++++++
.../src/metas/sources/defaults/index.ts | 5 ++
4 files changed, 112 insertions(+)
diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json
index 91e9e36d7..3d74445f9 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -33,6 +33,12 @@
"meta.Sources.Db.AllMigration": "是否整库迁移",
"meta.Sources.Db.TableWhiteList": "表名白名单",
"meta.Sources.Db.TableWhiteListHelp": "白名单应该是一个以逗号分隔的正则表达式列表,与要监控的表的完全限定名称相匹配。表的完全限定名称的格式为 <dbName>.<tableName>,其中 dbName 和 tablename 都可以配置正则表达式。比如:test_db.table*,inlong_db*.user*,表示采集 test_db 库中以 table 开头的所有表 + 以 inlong_db 开头的所有库下的以 user 开头的所有表。",
+ "meta.Sources.Mongodb.Hosts": "服务器主机",
+ "meta.Sources.Mongodb.Username": "用户名",
+ "meta.Sources.Mongodb.Password": "密码",
+ "meta.Sources.Mongodb.Database": "数据库名",
+ "meta.Sources.Mongodb.Collection": "集合名称",
+ "meta.Sources.Mongodb.PrimaryKey": "主键",
"meta.Sinks.SinkName": "名称",
"meta.Sinks.SinkNameRule": "以英文字母开头,只能包含英文字母、数字、中划线、下划线",
"meta.Sinks.SinkType": "类型",
diff --git a/inlong-dashboard/src/locales/en.json b/inlong-dashboard/src/locales/en.json
index e4d5062f4..5c7ba9880 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -33,6 +33,12 @@
"meta.Sources.Db.AllMigration": "AllMigration",
"meta.Sources.Db.TableWhiteList": "Table WhiteList",
"meta.Sources.Db.TableWhiteListHelp": "The whitelist should be a comma-separated list of regular expressions that match the fully-qualified names of tables to be monitored. Fully-qualified names for tables are of the form <databaseName>.<tableName>, the dbName and tableName can be configured with regular expressions. For example: test_db.order*, inlong_db*.user*, means to collect all tables starting with order in the test_db database + all tables starting with user under all databases [...]
+ "meta.Sources.Mongodb.Hosts": "Hosts",
+ "meta.Sources.Mongodb.Username": "Username",
+ "meta.Sources.Mongodb.Password": "Password",
+ "meta.Sources.Mongodb.Database": "Database",
+ "meta.Sources.Mongodb.Collection": "Collection",
+ "meta.Sources.Mongodb.PrimaryKey": "PrimaryKey",
"meta.Sinks.SinkName": "Name",
"meta.Sinks.SinkNameRule": "At the beginning of English letters, only English letters, numbers, minus, and underscores",
"meta.Sinks.SinkType": "Type",
diff --git a/inlong-dashboard/src/metas/sources/defaults/Mongodb.ts b/inlong-dashboard/src/metas/sources/defaults/Mongodb.ts
new file mode 100644
index 000000000..bfea4b2da
--- /dev/null
+++ b/inlong-dashboard/src/metas/sources/defaults/Mongodb.ts
@@ -0,0 +1,95 @@
+/*
+ * 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 { SourceInfo } from '../common/SourceInfo';
+
+const { I18n } = DataWithBackend;
+const { FieldDecorator } = RenderRow;
+const { ColumnDecorator } = RenderList;
+
+export default class MongodbSource
+ extends SourceInfo
+ implements DataWithBackend, RenderRow, RenderList
+{
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ placeholder: 'localhost:27017,localhost:27018',
+ }),
+ })
+ @ColumnDecorator()
+ @I18n('meta.Sources.Mongodb.Hosts')
+ hosts: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @ColumnDecorator()
+ @I18n('meta.Sources.Mongodb.Username')
+ username: string;
+
+ @FieldDecorator({
+ type: 'password',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.Mongodb.Password')
+ password: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.Mongodb.Database')
+ database: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.Mongodb.Collection')
+ collection: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.Mongodb.PrimaryKey')
+ primaryKey: string;
+}
diff --git a/inlong-dashboard/src/metas/sources/defaults/index.ts b/inlong-dashboard/src/metas/sources/defaults/index.ts
index 9e1720de2..8f2843153 100644
--- a/inlong-dashboard/src/metas/sources/defaults/index.ts
+++ b/inlong-dashboard/src/metas/sources/defaults/index.ts
@@ -41,4 +41,9 @@ export const allDefaultSources: MetaExportWithBackendList<SourceMetaType> = [
value: 'MYSQL_BINLOG',
LoadEntity: () => import('./MySQLBinlog'),
},
+ {
+ label: 'Mongodb',
+ value: 'MONGODB',
+ LoadEntity: () => import('./Mongodb'),
+ },
];