Skip to content

Commit

Permalink
[INLONG-9497][Dashboard] Support Pulsar source management
Browse files Browse the repository at this point in the history
  • Loading branch information
bluewang committed Dec 19, 2023
1 parent 5c367a7 commit d258808
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 0 deletions.
172 changes: 172 additions & 0 deletions inlong-dashboard/src/plugins/sources/defaults/Pulsar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* 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 '@/plugins/DataWithBackend';
import { RenderRow } from '@/plugins/RenderRow';
import { RenderList } from '@/plugins/RenderList';
import { SourceInfo } from '../common/SourceInfo';

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

export default class PulsarSource
extends SourceInfo
implements DataWithBackend, RenderRow, RenderList
{
@FieldDecorator({
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: values?.status === 101,
}),
})
@ColumnDecorator()
@SyncField()
@I18n('meta.Sources.Pulsar.PulsarTenant')
pulsarTenant: string;

@FieldDecorator({
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: values?.status === 101,
}),
})
@SyncField()
@I18n('meta.Sources.Pulsar.Namespace')
namespace: string;

@FieldDecorator({
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: values?.status === 101,
}),
})
@SyncField()
@I18n('Admin url')
adminUrl: string;

@FieldDecorator({
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: values?.status === 101,
}),
})
@SyncField()
@I18n('Service url')
serviceUrl: string;

@FieldDecorator({
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: values?.status === 101,
}),
})
@SyncField()
@I18n('Pulsar topic')
topic: string;

@FieldDecorator({
type: 'input',
props: values => ({
disabled: values?.status === 101,
}),
})
@ColumnDecorator()
@SyncField()
@I18n('meta.Sources.Pulsar.PrimaryKey')
primaryKey: string;

@FieldDecorator({
type: 'radio',
initialValue: 'UTF-8',
props: values => ({
disabled: values?.status === 101,
options: [
{
label: 'UTF-8',
value: 'UTF-8',
},
{
label: 'GBK',
value: 'GBK',
},
],
}),
})
@ColumnDecorator()
@SyncField()
@I18n('meta.Sources.Pulsar.DataEncoding')
dataEncoding: string;

@FieldDecorator({
type: 'input',
props: values => ({
disabled: values?.status === 101,
}),
})
@ColumnDecorator()
@SyncField()
@I18n('meta.Sources.Pulsar.DataSeparator')
dataSeparator: string;

@FieldDecorator({
type: 'input',
props: values => ({
disabled: values?.status === 101,
}),
})
@ColumnDecorator()
@SyncField()
@I18n('meta.Sources.Pulsar.DataEscapeChar')
dataEscapeChar: string;

@FieldDecorator({
type: 'radio',
initialValue: 'INLONG_MSG_V0',
props: values => ({
disabled: values?.status === 101,
options: [
{
label: 'InLongMsg V0',
value: 'INLONG_MSG_V0',
},
{
label: 'InLongMsg V1',
value: 'INLONG_MSG_V1',
},
{
label: 'Raw',
value: 'RAW',
},
{
label: 'Etc',
value: 'etc',
},
],
}),
})
@SyncField()
@I18n('meta.Sources.Pulsar.WrapType')
wrapType: string;
}
5 changes: 5 additions & 0 deletions inlong-dashboard/src/plugins/sources/defaults/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export const allDefaultSources: MetaExportWithBackendList<SourceMetaType> = [
value: 'POSTGRESQL',
LoadEntity: () => import('./PostgreSQL'),
},
{
label: 'Pulsar',
value: 'PULSAR',
LoadEntity: () => import('./Pulsar'),
},
{
label: 'Redis',
value: 'REDIS',
Expand Down
7 changes: 7 additions & 0 deletions inlong-dashboard/src/ui/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
"meta.Sources.Iceberg.TableName": "表格名称",
"meta.Sources.Iceberg.PrimaryKey": "主键",
"meta.Sources.Iceberg.Warehouse": "仓库路径",
"meta.Sources.Pulsar.PulsarTenant": "Pulsar 租户",
"meta.Sources.Pulsar.Namespace": "命名空间",
"meta.Sources.Pulsar.PrimaryKey": "主键",
"meta.Sources.Pulsar.DataEncoding": "数据编码",
"meta.Sources.Pulsar.DataSeparator": "数据分隔符",
"meta.Sources.Pulsar.DataEscapeChar": "数据转义符",
"meta.Sources.Pulsar.WrapType": "消息打包格式",
"meta.Sinks.SinkName": "名称",
"meta.Sinks.SinkNameRule": "只能包含英文字母、数字、点号(.)、中划线(-)、下划线(_)",
"meta.Sinks.SinkType": "类型",
Expand Down
7 changes: 7 additions & 0 deletions inlong-dashboard/src/ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
"meta.Sources.Iceberg.TableName": "TableName",
"meta.Sources.Iceberg.PrimaryKey": "Primary key",
"meta.Sources.Iceberg.Warehouse": "Warehouse",
"meta.Sources.Pulsar.PulsarTenant": "Pulsar tenant",
"meta.Sources.Pulsar.Namespace": "Namespace",
"meta.Sources.Pulsar.PrimaryKey": "Primary key",
"meta.Sources.Pulsar.DataEncoding": "Data encoding",
"meta.Sources.Pulsar.DataSeparator": "Data separator",
"meta.Sources.Pulsar.DataEscapeChar": "Data escape char",
"meta.Sources.Pulsar.WrapType": "Wrap type",
"meta.Sinks.SinkName": "Name",
"meta.Sinks.SinkNameRule": "Only English letters, numbers, dots(.), minus(-), and underscores(_)",
"meta.Sinks.SinkType": "Type",
Expand Down

0 comments on commit d258808

Please sign in to comment.