Skip to content

Commit

Permalink
[INLONG-7499][Dashboard] Support redis node management (#7500)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluewang authored Mar 3, 2023
1 parent 25b4221 commit 2929e65
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 64 deletions.
3 changes: 3 additions & 0 deletions inlong-dashboard/src/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@
"meta.Nodes.Hudi.Url": "地址",
"meta.Nodes.Hudi.CatalogType": "目录类型",
"meta.Nodes.Hudi.Warehouse": "仓库路径",
"meta.Nodes.Redis.Username": "用户名",
"meta.Nodes.Redis.Password": "密码",
"meta.Nodes.Redis.Url": "地址",
"components.EditableTable.NewLine": "新增一行",
"components.FormGenerator.plugins.PleaseChoose": "请选择",
"components.FormGenerator.plugins.PleaseInput": "请输入",
Expand Down
3 changes: 3 additions & 0 deletions inlong-dashboard/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@
"meta.Nodes.StarRocks.Username": "Username",
"meta.Nodes.StarRocks.Password": "Password",
"meta.Nodes.StarRocks.Url": "URL",
"meta.Nodes.Redis.Username": "Username",
"meta.Nodes.Redis.Password": "Password",
"meta.Nodes.Redis.Url": "URL",
"meta.Nodes.Hudi.Username": "Username",
"meta.Nodes.Hudi.Password": "Password",
"meta.Nodes.Hudi.Url": "URL",
Expand Down
53 changes: 53 additions & 0 deletions inlong-dashboard/src/metas/nodes/defaults/Redis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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 { NodeInfo } from '../common/NodeInfo';

const { I18n } = DataWithBackend;
const { FieldDecorator } = RenderRow;

export default class RedisNode extends NodeInfo implements DataWithBackend, RenderRow, RenderList {
@FieldDecorator({
type: 'input',
rules: [{ required: true }],
})
@I18n('meta.Nodes.Redis.Username')
username: string;

@FieldDecorator({
type: 'password',
rules: [{ required: true }],
})
@I18n('meta.Nodes.Redis.Password')
token: string;

@FieldDecorator({
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
placeholder: '127.0.0.1:6379,127.0.0.1:6378',
}),
})
@I18n('meta.Nodes.Redis.Url')
url: string;
}
5 changes: 5 additions & 0 deletions inlong-dashboard/src/metas/nodes/defaults/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export const allDefaultNodes: MetaExportWithBackendList<NodeMetaType> = [
value: 'MYSQL',
LoadEntity: () => import('./MySQL'),
},
{
label: 'Redis',
value: 'REDIS',
LoadEntity: () => import('./Redis'),
},
{
label: 'StarRocks',
value: 'STARROCKS',
Expand Down
70 changes: 6 additions & 64 deletions inlong-dashboard/src/metas/sinks/defaults/Redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import i18n from '@/i18n';
import EditableTable from '@/components/EditableTable';
import { sourceFields } from '../common/sourceFields';
import { SinkInfo } from '../common/SinkInfo';
import NodeSelect from '@/components/NodeSelect';

const { I18n } = DataWithBackend;
const { FieldDecorator } = RenderRow;
Expand Down Expand Up @@ -95,34 +96,15 @@ export default class RedisSink extends SinkInfo implements DataWithBackend, Rend
clusterMode: string;

@FieldDecorator({
type: 'input',
initialValue: '127.0.0.1',
rules: [{ required: false }],
props: values => ({
disabled: [110, 130].includes(values?.status),
placeholder: '127.0.0.1',
}),
visible: values => values!.clusterMode == 'standalone',
})
@ColumnDecorator()
@I18n('meta.Sinks.Redis.Host')
host: String;

@FieldDecorator({
type: 'inputnumber',
rules: [{ required: false }],
initialValue: 6379,
type: NodeSelect,
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
min: 1,
max: 65535,
placeholder: i18n.t('meta.Sinks.Redis.PortHelper'),
nodeType: 'Redis',
}),
visible: values => values!.clusterMode == 'standalone',
})
@ColumnDecorator()
@I18n('meta.Sinks.Redis.Port')
port: number;
@I18n('meta.Sinks.DataNodeName')
dataNodeName: string;

@FieldDecorator({
type: 'input',
Expand All @@ -137,34 +119,6 @@ export default class RedisSink extends SinkInfo implements DataWithBackend, Rend
@I18n('meta.Sinks.Redis.SentinelMasterName')
sentinelMasterName: String;

@FieldDecorator({
type: 'input',
initialValue: '',
rules: [{ required: false }],
props: values => ({
disabled: [110, 130].includes(values?.status),
placeholder: '127.0.0.1:6379,127.0.0.1:6378',
}),
visible: values => values!.clusterMode == 'sentinel',
})
@ColumnDecorator()
@I18n('meta.Sinks.Redis.SentinelsInfo')
sentinelsInfo: String;

@FieldDecorator({
type: 'input',
initialValue: '',
rules: [{ required: false }],
props: values => ({
disabled: [110, 130].includes(values?.status),
placeholder: '127.0.0.1:6379,127.0.0.1:6378',
}),
visible: values => values!.clusterMode == 'cluster',
})
@ColumnDecorator()
@I18n('meta.Sinks.Redis.ClusterNodes')
clusterNodes: String;

@FieldDecorator({
type: 'select',
rules: [{ required: true }],
Expand Down Expand Up @@ -342,18 +296,6 @@ export default class RedisSink extends SinkInfo implements DataWithBackend, Rend
@I18n('meta.Sinks.Redis.Database')
database: number;

@FieldDecorator({
type: 'password',
rules: [{ required: false }],
initialValue: '',
props: values => ({
disabled: [110, 130].includes(values?.status),
}),
})
@ColumnDecorator()
@I18n('meta.Sinks.Redis.Password')
password: string;

@FieldDecorator({
type: 'inputnumber',
initialValue: 0,
Expand Down

0 comments on commit 2929e65

Please sign in to comment.