Skip to content

Commit

Permalink
[INLONG-9663][Dashboard] Data synchronization doris sink supports app…
Browse files Browse the repository at this point in the history
…end Mode (#9665)
  • Loading branch information
bluewang authored Feb 2, 2024
1 parent 7945f24 commit cc0c941
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class SinkDefaultInfo implements DataWithBackend, RenderRow, RenderList {
disabled: Boolean(values.id),
dropdownMatchSelectWidth: false,
options: sinks
.filter(item => item.value === 'ICEBERG')
.filter(item => item.value === 'ICEBERG' || item.value === 'DORIS')
.map(item => ({
label: item.label,
value: item.value,
Expand Down
83 changes: 74 additions & 9 deletions inlong-dashboard/src/plugins/sinks/defaults/Doris.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import i18n from '@/i18n';
import EditableTable from '@/ui/components/EditableTable';
import { SinkInfo } from '../common/SinkInfo';
import { sourceFields } from '../common/sourceFields';
import NodeSelect from '@/ui/components/NodeSelect';

const { I18n } = DataWithBackend;
const { FieldDecorator, SyncField, IngestionField } = RenderRow;
const { FieldDecorator, SyncField, IngestionField, SyncMoveDbField } = RenderRow;
const { ColumnDecorator } = RenderList;

const dorisTargetTypes = [
Expand Down Expand Up @@ -64,31 +65,95 @@ export default class DorisSink extends SinkInfo implements DataWithBackend, Rend
@I18n('meta.Sinks.Doris.HttpAddress')
@SyncField()
@IngestionField()
@SyncMoveDbField()
feNodes: string;

@FieldDecorator({
type: 'input',
type: NodeSelect,
rules: [{ required: true }],
props: values => ({
disabled: [110].includes(values?.status),
nodeType: 'DORIS',
}),
})
@I18n('meta.Sinks.Username')
@I18n('meta.Sinks.DataNodeName')
@SyncField()
@IngestionField()
username: string;
@SyncMoveDbField()
dataNodeName: string;

@FieldDecorator({
type: 'password',
type: 'radiobutton',
initialValue: '${database}',
tooltip: i18n.t('meta.Sinks.Doris.PatternHelp'),
rules: [{ required: true }],
props: values => ({
size: 'middle',
disabled: [110].includes(values?.status),
options: [
{
label: i18n.t('meta.Sinks.Doris.Options.DBSameName'),
value: '${database}',
disabled: Boolean(values.id),
},
{
label: i18n.t('meta.Sinks.Doris.Options.Customize'),
value: 'false',
disabled: Boolean(values.id),
},
],
}),
suffix: {
type: 'input',
name: 'databasePattern',
visible: values =>
values.backupDatabase === 'false' ||
(values.id !== undefined && values.databasePattern !== '${database}'),
props: values => ({
style: { width: 100 },
disabled: [110].includes(values?.status),
}),
},
})
@I18n('meta.Sinks.Password')
@SyncField()
@IngestionField()
password: string;
@SyncMoveDbField()
@I18n('meta.Sinks.Doris.DatabaseNamePattern')
backupDatabase: string;

@FieldDecorator({
type: 'radiobutton',
initialValue: '${table}',
rules: [{ required: true }],
tooltip: i18n.t('meta.Sinks.Doris.PatternHelp'),
props: values => ({
size: 'middle',
options: [
{
label: i18n.t('meta.Sinks.Doris.Options.TableSameName'),
value: '${table}',
disabled: Boolean(values.id),
},
{
label: i18n.t('meta.Sinks.Doris.Options.Customize'),
value: 'false',
disabled: Boolean(values.id),
},
],
}),
suffix: {
type: 'input',
name: 'tablePattern',
visible: values =>
values.backupTable === 'false' ||
(values.id !== undefined && values.tablePattern !== '${table}'),
props: values => ({
style: { width: 100 },
disabled: [110].includes(values?.status),
}),
},
})
@SyncMoveDbField()
@I18n('meta.Sinks.Doris.TableNamePattern')
backupTable: string;

@FieldDecorator({
type: 'input',
Expand Down
6 changes: 6 additions & 0 deletions inlong-dashboard/src/ui/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@
"meta.Sinks.Doris.TablePattern": "多表模式",
"meta.Sinks.Doris.IsMetaField": "是否为元字段",
"meta.Sinks.Doris.FieldFormat": "字段格式",
"meta.Sinks.Doris.DatabaseNamePattern": "库匹配策略",
"meta.Sinks.Doris.TableNamePattern": "表匹配策略",
"meta.Sinks.Doris.PatternHelp": "自定义配置说明:内置参数包括:1、来源库名:${database} 2、来源表名:${table} 【使用说明】:支持使用内置参数和字符串组合生成目标库表名称【示例】:如来源表名称为 table1,映射规则为 ${table}_inlong,则table1的数据将被最终映射写入至 table1_inlong 中。",
"meta.Sinks.Doris.Options.DBSameName": "与来源库同名",
"meta.Sinks.Doris.Options.TableSameName": "与来源表同名",
"meta.Sinks.Doris.Options.Customize": "自定义",
"meta.Sinks.HBase.Namespace": "命名空间",
"meta.Sinks.HBase.TableName": "表名称",
"meta.Sinks.HBase.RowKey": "RowKey",
Expand Down
6 changes: 6 additions & 0 deletions inlong-dashboard/src/ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@
"meta.Sinks.Doris.TablePattern": "Table pattern",
"meta.Sinks.Doris.IsMetaField": "Is meta field",
"meta.Sinks.Doris.FieldFormat": "Field format",
"meta.Sinks.Doris.DatabaseNamePattern": "Database name pattern",
"meta.Sinks.Doris.TableNamePattern": "Table name pattern",
"meta.Sinks.Doris.PatternHelp": "Custom configuration instructions: Built-in parameters include: 1. Source database name: ${database} 2. Source table name: ${table} [Usage Instructions]: Supports the use of built-in parameters and string combinations to generate target database table names [Example] : If the source table name is table1 and the mapping rule is ${table}_inlong, the data of table1 will be finally mapped and written to table1_inlong.",
"meta.Sinks.Doris.Options.DBSameName": "Same as source database",
"meta.Sinks.Doris.Options.TableSameName": "Same as source table",
"meta.Sinks.Doris.Options.Customize": "Customize",
"meta.Sinks.HBase.Namespace": "Namespace",
"meta.Sinks.HBase.TableName": "Table name",
"meta.Sinks.HBase.RowKey": "Row key",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

export const paramReplace = (sinkType, values) => {
const replaceValues = values;
if (sinkType === 'ICEBERG') {
if (sinkType === 'ICEBERG' || sinkType === 'DORIS') {
if (values.backupDatabase === '${database}') {
replaceValues.databasePattern = values.backupDatabase;
}
Expand All @@ -35,7 +35,7 @@ export const paramReplace = (sinkType, values) => {

export const dataToForm = (sinkType, data) => {
const sinkData = data;
if (sinkType === 'ICEBERG') {
if (sinkType === 'ICEBERG' || sinkType === 'DORIS') {
if (data.databasePattern !== '${database}') {
sinkData.backupDatabase = 'false';
}
Expand Down

0 comments on commit cc0c941

Please sign in to comment.