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 e8950a9ba [INLONG-4906][Dashboard] Support Oracle sink (#4909)
e8950a9ba is described below
commit e8950a9bacb34ad511e87202232d7f59c77714f6
Author: Lizhen <[email protected]>
AuthorDate: Mon Jul 11 11:38:55 2022 +0800
[INLONG-4906][Dashboard] Support Oracle sink (#4909)
---
.../src/components/MetaData/StorageOracle.tsx | 206 +++++++++++++++++++++
inlong-dashboard/src/components/MetaData/index.ts | 6 +
inlong-dashboard/src/locales/cn.json | 8 +
inlong-dashboard/src/locales/en.json | 8 +
4 files changed, 228 insertions(+)
diff --git a/inlong-dashboard/src/components/MetaData/StorageOracle.tsx
b/inlong-dashboard/src/components/MetaData/StorageOracle.tsx
new file mode 100644
index 000000000..ac9254da8
--- /dev/null
+++ b/inlong-dashboard/src/components/MetaData/StorageOracle.tsx
@@ -0,0 +1,206 @@
+/*
+ * 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 React from 'react';
+import {
+ getColsFromFields,
+ GetStorageColumnsType,
+ GetStorageFormFieldsType,
+} from '@/utils/metaData';
+import { ColumnsType } from 'antd/es/table';
+import EditableTable, { ColumnsItemProps } from '@/components/EditableTable';
+import i18n from '@/i18n';
+import { excludeObject } from '@/utils';
+import { sourceDataFields } from './SourceDataFields';
+
+// oracleFieldTypes
+const oracleFieldTypes = [
+ 'BINARY_FLOAT',
+ 'BINARY_DOUBLE',
+ 'SMALLINT',
+ 'FLOAT',
+ 'FLOAT4',
+ 'FLOAT8',
+ 'DOUBLE PRECISION',
+ 'REAL',
+ 'NUMBER',
+ 'NUMERIC',
+ 'DATE',
+ 'DECIMAL',
+ 'BOOLEAN',
+ 'TIMESTAMP',
+ 'CHAR',
+ 'VARCHAR',
+ 'CLOB',
+ 'RAW',
+ 'BLOB',
+ // 'interval',
+].map(item => ({
+ label: item,
+ value: item,
+}));
+
+const getForm: GetStorageFormFieldsType = (
+ type,
+ { currentValues, inlongGroupId, isEdit, dataType, form } = {} as any,
+) => {
+ const fileds = [
+ {
+ type: 'input',
+ label: 'JDBC URL',
+ name: 'jdbcUrl',
+ rules: [{ required: true }],
+ props: {
+ placeholder: 'jdbc:oracle:thin://127.0.0.1:3306/write',
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ style: { width: 500 },
+ },
+ },
+ {
+ type: 'input',
+ label:
i18n.t('components.AccessHelper.StorageMetaData.Oracle.TableName'),
+ name: 'tableName',
+ rules: [{ required: true }],
+ props: {
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ _inTable: true,
+ },
+ {
+ type: 'input',
+ label:
i18n.t('components.AccessHelper.StorageMetaData.Oracle.PrimaryKey'),
+ name: 'primaryKey',
+ rules: [{ required: true }],
+ props: {
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ _inTable: true,
+ },
+ {
+ type: 'input',
+ label: i18n.t('components.AccessHelper.StorageMetaData.Username'),
+ name: 'username',
+ rules: [{ required: true }],
+ props: {
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ },
+ _inTable: true,
+ },
+ {
+ type: 'password',
+ label: i18n.t('components.AccessHelper.StorageMetaData.Password'),
+ name: 'password',
+ rules: [{ required: true }],
+ props: {
+ disabled: isEdit && [110, 130].includes(currentValues?.status),
+ style: {
+ maxWidth: 500,
+ },
+ },
+ },
+ {
+ type: (
+ <EditableTable
+ size="small"
+ columns={getFieldListColumns(dataType, currentValues)}
+ canDelete={(record, idx, isNew) => !isEdit || isNew}
+ />
+ ),
+ name: 'sinkFieldList',
+ },
+ ];
+
+ return type === 'col'
+ ? getColsFromFields(fileds)
+ : fileds.map(item => excludeObject(['_inTable'], item));
+};
+
+const getFieldListColumns: GetStorageColumnsType = (dataType, currentValues)
=> {
+ return [
+ ...sourceDataFields,
+ {
+ title:
`ORACLE${i18n.t('components.AccessHelper.StorageMetaData.Oracle.FieldName')}`,
+ dataIndex: 'fieldName',
+ initialValue: '',
+ rules: [
+ { required: true },
+ {
+ pattern: /^[a-z][0-9a-z_]*$/,
+ message:
i18n.t('components.AccessHelper.StorageMetaData.Oracle.FieldNameRule'),
+ },
+ ],
+ props: (text, record, idx, isNew) => ({
+ disabled: [110, 130].includes(currentValues?.status as number) &&
!isNew,
+ }),
+ },
+ {
+ title:
`ORACLE${i18n.t('components.AccessHelper.StorageMetaData.Oracle.FieldType')}`,
+ dataIndex: 'fieldType',
+ initialValue: oracleFieldTypes[0].value,
+ type: 'select',
+ props: (text, record, idx, isNew) => ({
+ options: oracleFieldTypes,
+ disabled: [110, 130].includes(currentValues?.status as number) &&
!isNew,
+ }),
+ rules: [{ required: true }],
+ },
+ {
+ title:
i18n.t('components.AccessHelper.StorageMetaData.Oracle.IsMetaField'),
+ dataIndex: 'isMetaField',
+ type: 'select',
+ props: (text, record, idx, isNew) => ({
+ options: [
+ {
+ label: i18n.t('basic.Yes'),
+ value: 1,
+ },
+ {
+ label: i18n.t('basic.No'),
+ value: 0,
+ },
+ ],
+ }),
+ },
+ {
+ title:
i18n.t('components.AccessHelper.StorageMetaData.Oracle.FieldFormat'),
+ dataIndex: 'fieldFormat',
+ initialValue: '',
+ type: 'autocomplete',
+ props: (text, record, idx, isNew) => ({
+ options: ['MICROSECONDS', 'MILLISECONDS', 'SECONDS', 'SQL',
'ISO_8601'].map(item => ({
+ label: item,
+ value: item,
+ })),
+ }),
+ visible: (text, record) =>
+ ['BIGINT', 'DATE', 'TIMESTAMP'].includes(record.fieldType as string),
+ },
+ {
+ title:
i18n.t('components.AccessHelper.StorageMetaData.Oracle.FieldDescription'),
+ dataIndex: 'fieldComment',
+ initialValue: '',
+ },
+ ] as ColumnsItemProps[];
+};
+
+const tableColumns = getForm('col') as ColumnsType;
+
+export const StorageOracle = {
+ getForm,
+ getFieldListColumns,
+ tableColumns,
+};
diff --git a/inlong-dashboard/src/components/MetaData/index.ts
b/inlong-dashboard/src/components/MetaData/index.ts
index 87d9ec9a7..a502e3738 100644
--- a/inlong-dashboard/src/components/MetaData/index.ts
+++ b/inlong-dashboard/src/components/MetaData/index.ts
@@ -26,6 +26,7 @@ import { StorageIceberg } from './StorageIceberg';
import { StorageEs } from './StorageEs';
import { StorageGreenplum } from './StorageGreenplum';
import { StorageMySQL } from './StorageMySQL';
+import { StorageOracle } from './StorageOracle';
export interface StoragesType {
label: string;
@@ -78,4 +79,9 @@ export const Storages: StoragesType[] = [
value: 'MYSQL',
...StorageMySQL,
},
+ {
+ label: 'Oracle',
+ value: 'ORACLE',
+ ...StorageOracle,
+ },
];
diff --git a/inlong-dashboard/src/locales/cn.json
b/inlong-dashboard/src/locales/cn.json
index 74dcde9c2..172637529 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -141,6 +141,14 @@
"components.AccessHelper.StorageMetaData.MySQL.IsMetaField": "是否为元字段",
"components.AccessHelper.StorageMetaData.MySQL.FieldFormat": "字段格式",
"components.AccessHelper.StorageMetaData.MySQL.FieldDescription": "字段描述",
+ "components.AccessHelper.StorageMetaData.Oracle.TableName": "表名称",
+ "components.AccessHelper.StorageMetaData.Oracle.PrimaryKey": "主键",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldName": "字段名",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldNameRule":
"以英文字母或下划线开头,只能包含英文字母、数字、下划线",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldType": "字段类型",
+ "components.AccessHelper.StorageMetaData.Oracle.IsMetaField": "是否为元字段",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldFormat": "字段格式",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldDescription": "字段描述",
"components.AccessHelper.FieldsConfig.businessFields.Stripe/Second": "条/秒",
"components.AccessHelper.FieldsConfig.businessFields.MessageMiddleware":
"消息中间件",
"components.AccessHelper.FieldsConfig.businessFields.AccessSize": "按天接入大小",
diff --git a/inlong-dashboard/src/locales/en.json
b/inlong-dashboard/src/locales/en.json
index b0de10721..e623ac61b 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -141,6 +141,14 @@
"components.AccessHelper.StorageMetaData.MySQL.IsMetaField": "IsMetaField",
"components.AccessHelper.StorageMetaData.MySQL.FieldFormat": "FieldFormat",
"components.AccessHelper.StorageMetaData.MySQL.FieldDescription":
"FieldDescription",
+ "components.AccessHelper.StorageMetaData.Oracle.TableName": "TableName",
+ "components.AccessHelper.StorageMetaData.Oracle.PrimaryKey": "PrimaryKey",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldName": "FieldName",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldNameRule": "At the
beginning of English letters, only English letters, numbers, and underscores",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldType": "FieldType",
+ "components.AccessHelper.StorageMetaData.Oracle.IsMetaField": "IsMetaField",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldFormat": "FieldFormat",
+ "components.AccessHelper.StorageMetaData.Oracle.FieldDescription":
"FieldDescription",
"components.AccessHelper.FieldsConfig.businessFields.Stripe/Second": "Stripe
/ S",
"components.AccessHelper.FieldsConfig.businessFields.MessageMiddleware":
"Middleware",
"components.AccessHelper.FieldsConfig.businessFields.AccessSize": "Access
Size",