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/10 02:55:23 UTC

[inlong] branch master updated: [INLONG-6481][Dashboard] Supports management of SQLServer source (#6490)

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 eed3c338e [INLONG-6481][Dashboard] Supports management of SQLServer source (#6490)
eed3c338e is described below

commit eed3c338e5d1b01c498f1ce780114d96b24aad85
Author: Lizhen <88...@users.noreply.github.com>
AuthorDate: Thu Nov 10 10:55:18 2022 +0800

    [INLONG-6481][Dashboard] Supports management of SQLServer source (#6490)
---
 inlong-dashboard/src/locales/cn.json               |  10 ++
 inlong-dashboard/src/locales/en.json               |  10 ++
 .../src/metas/sources/defaults/SQLServer.ts        | 151 +++++++++++++++++++++
 .../src/metas/sources/defaults/index.ts            |   5 +
 4 files changed, 176 insertions(+)

diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json
index 44ad7e605..029da9daf 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -58,6 +58,16 @@
   "meta.Sources.PostgreSQL.TableName": "表格名称",
   "meta.Sources.PostgreSQL.decodingPluginName": "解码插件名称",
   "meta.Sources.PostgreSQL.PrimaryKey": "主键",
+  "meta.Sources.SQLServer.Hostname": "服务器主机",
+  "meta.Sources.SQLServer.Port": "端口",
+  "meta.Sources.SQLServer.Username": "用户",
+  "meta.Sources.SQLServer.Password": "密码",
+  "meta.Sources.SQLServer.Database": "数据库名",
+  "meta.Sources.SQLServer.SchemaName": "架构名称",
+  "meta.Sources.SQLServer.TableName": "表格名称",
+  "meta.Sources.SQLServer.AllMigration": "是否整库迁移",
+  "meta.Sources.SQLServer.ServerTimezone": "服务器时区",
+  "meta.Sources.SQLServer.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 ecdfcfa24..70e2e536e 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -58,6 +58,16 @@
   "meta.Sources.PostgreSQL.TableName": "TableName",
   "meta.Sources.PostgreSQL.decodingPluginName": "Decoding Plugin Name",
   "meta.Sources.PostgreSQL.PrimaryKey": "PrimaryKey",
+  "meta.Sources.SQLServer.Hostname": "Hostname",
+  "meta.Sources.SQLServer.Port": "Port",
+  "meta.Sources.SQLServer.Username": "Username",
+  "meta.Sources.SQLServer.Password": "Password",
+  "meta.Sources.SQLServer.Database": "Database",
+  "meta.Sources.SQLServer.SchemaName": "SchemaName",
+  "meta.Sources.SQLServer.TableName": "TableName",
+  "meta.Sources.SQLServer.AllMigration": "AllMigration",
+  "meta.Sources.SQLServer.ServerTimezone": "Timezone",
+  "meta.Sources.SQLServer.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/SQLServer.ts b/inlong-dashboard/src/metas/sources/defaults/SQLServer.ts
new file mode 100644
index 000000000..0bd6e40a8
--- /dev/null
+++ b/inlong-dashboard/src/metas/sources/defaults/SQLServer.ts
@@ -0,0 +1,151 @@
+/*
+ * 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';
+import i18n from '@/i18n';
+
+const { I18n } = DataWithBackend;
+const { FieldDecorator } = RenderRow;
+const { ColumnDecorator } = RenderList;
+
+export default class SQLServerSource
+  extends SourceInfo
+  implements DataWithBackend, RenderRow, RenderList
+{
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @ColumnDecorator()
+  @I18n('meta.Sources.SQLServer.Hostname')
+  hostname: string;
+
+  @FieldDecorator({
+    type: 'inputnumber',
+    rules: [{ required: true }],
+    initialValue: 1433,
+    props: values => ({
+      min: 1,
+      max: 65535,
+      disabled: values?.status === 101,
+    }),
+  })
+  @ColumnDecorator()
+  @I18n('meta.Sources.SQLServer.Port')
+  port: number;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @ColumnDecorator()
+  @I18n('meta.Sources.SQLServer.Username')
+  username: string;
+
+  @FieldDecorator({
+    type: 'password',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.Password')
+  password: string;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.Database')
+  database: string;
+
+  @FieldDecorator({
+    type: 'radio',
+    rules: [{ required: true }],
+    initialValue: false,
+    props: values => ({
+      disabled: values?.status === 101,
+      options: [
+        {
+          label: i18n.t('basic.Yes'),
+          value: true,
+        },
+        {
+          label: i18n.t('basic.No'),
+          value: false,
+        },
+      ],
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.AllMigration')
+  allMigration: boolean;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    initialValue: 'UTC',
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.ServerTimezone')
+  serverTimezone: string;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.SchemaName')
+  schemaName: string;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.TableName')
+  tableName: string;
+
+  @FieldDecorator({
+    type: 'input',
+    rules: [{ required: true }],
+    props: values => ({
+      disabled: values?.status === 101,
+    }),
+  })
+  @I18n('meta.Sources.SQLServer.PrimaryKey')
+  primaryKey: string;
+}
diff --git a/inlong-dashboard/src/metas/sources/defaults/index.ts b/inlong-dashboard/src/metas/sources/defaults/index.ts
index 15e30fcc7..f5f0d1d16 100644
--- a/inlong-dashboard/src/metas/sources/defaults/index.ts
+++ b/inlong-dashboard/src/metas/sources/defaults/index.ts
@@ -56,4 +56,9 @@ export const allDefaultSources: MetaExportWithBackendList<SourceMetaType> = [
     value: 'POSTGRESQL',
     LoadEntity: () => import('./PostgreSQL'),
   },
+  {
+    label: 'SQLServer',
+    value: 'SQLSERVER',
+    LoadEntity: () => import('./SQLServer'),
+  },
 ];