mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-09 08:27:47 +08:00
V2.4.1 FE
This commit is contained in:
@@ -22,11 +22,11 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
|
||||
},
|
||||
{
|
||||
key: 'appId',
|
||||
label: '应用ID',
|
||||
label: '应用名称',
|
||||
type: 'select',
|
||||
options: app.adminAppData.map(item => {
|
||||
return {
|
||||
label: item.appId,
|
||||
label: item.name,
|
||||
value: item.appId,
|
||||
};
|
||||
}),
|
||||
@@ -61,6 +61,7 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
|
||||
attrs: {
|
||||
placeholder: '请输入保存时间',
|
||||
suffix: '小时',
|
||||
prompttype: '修改保存时间,预计一分钟左右生效!'
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -35,7 +35,6 @@ class CustomForm extends React.Component<IXFormProps> {
|
||||
this.props.form.validateFields((err: any, values: any) => {
|
||||
const deleteData = this.props.formData;
|
||||
if (!err) {
|
||||
// console.log('values', values);
|
||||
if (values.topicName !== this.props.formData.topicName) {
|
||||
notification.error({ message: 'topic名称不正确,请重新输入' });
|
||||
} else {
|
||||
@@ -77,7 +76,6 @@ class CustomForm extends React.Component<IXFormProps> {
|
||||
}
|
||||
|
||||
public render() {
|
||||
// console.log('props', this.props);
|
||||
const { formData = {} as any, visible } = this.props;
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
let metadata = [] as IBrokersMetadata[];
|
||||
|
||||
@@ -111,11 +111,11 @@ class CustomForm extends React.Component<IXFormProps> {
|
||||
})(<Input placeholder="请输入分区数" />)}
|
||||
</Form.Item>
|
||||
<Form.Item label="类型">
|
||||
{/* <Form.Item label={this.state.checked ? 'Region类型' : 'Borker类型'} > */}
|
||||
{/* <Form.Item label={this.state.checked ? 'Region类型' : 'Broker类型'} > */}
|
||||
{/* <Switch onChange={(checked) => this.onSwitchChange(checked)} /> */}
|
||||
<Radio.Group value={this.state.checked ? 'region' : 'broker'} onChange={(e) => { this.onSwitchChange(e.target.value === 'region' ? true : false); }}>
|
||||
<Radio.Button value="region">Region类型</Radio.Button>
|
||||
<Radio.Button value="broker">Borker类型</Radio.Button>
|
||||
<Radio.Button value="broker">Broker类型</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label="brokerIdList" style={{ display: this.state.checked ? 'none' : '' }}>
|
||||
|
||||
@@ -28,8 +28,8 @@ const updateInputModal = (status?: string) => {
|
||||
formMap[4].invisible = status === 'region';
|
||||
formMap[5].invisible = status !== 'region';
|
||||
|
||||
formMap[4].rules = [{required: status !== 'region'}];
|
||||
formMap[5].rules = [{required: status === 'region'}];
|
||||
formMap[4].rules = [{ required: status !== 'region' }];
|
||||
formMap[5].rules = [{ required: status === 'region' }];
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData);
|
||||
};
|
||||
@@ -103,7 +103,7 @@ export const createMigrationTasks = () => {
|
||||
label: 'Region',
|
||||
value: 'region',
|
||||
}, {
|
||||
label: 'Borker',
|
||||
label: 'Broker',
|
||||
value: 'broker',
|
||||
}],
|
||||
rules: [{
|
||||
@@ -141,7 +141,7 @@ export const createMigrationTasks = () => {
|
||||
placeholder: '请选择目标Region',
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
key: 'beginTime',
|
||||
label: '计划开始时间',
|
||||
@@ -158,26 +158,26 @@ export const createMigrationTasks = () => {
|
||||
},
|
||||
{
|
||||
key: 'originalRetentionTime',
|
||||
label: '原本保存时间',
|
||||
label: '原Topic保存时间',
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请输入原本保存时间',
|
||||
message: '请输入原Topic保存时间',
|
||||
}],
|
||||
attrs: {
|
||||
disabled: true,
|
||||
placeholder: '请输入原本保存时间',
|
||||
placeholder: '请输入原Topic保存时间',
|
||||
suffix: '小时',
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'reassignRetentionTime',
|
||||
label: '迁移保存时间',
|
||||
label: '迁移后Topic保存时间',
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请输入迁移保存时间',
|
||||
message: '请输入迁移后Topic保存时间',
|
||||
}],
|
||||
attrs: {
|
||||
placeholder: '请输入迁移保存时间',
|
||||
placeholder: '请输入迁移后Topic保存时间',
|
||||
suffix: '小时',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -24,26 +24,111 @@ export const showApplyModal = (record?: IUser) => {
|
||||
value: +item,
|
||||
})),
|
||||
rules: [{ required: true, message: '请选择角色' }],
|
||||
}, {
|
||||
key: 'password',
|
||||
label: '密码',
|
||||
type: FormItemType.inputPassword,
|
||||
rules: [{ required: !record, message: '请输入密码' }],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// key: 'password',
|
||||
// label: '密码',
|
||||
// type: FormItemType.inputPassword,
|
||||
// rules: [{ required: !record, message: '请输入密码' }],
|
||||
// },
|
||||
],
|
||||
formData: record || {},
|
||||
visible: true,
|
||||
title: record ? '修改用户' : '新增用户',
|
||||
onSubmit: (value: IUser) => {
|
||||
if (record) {
|
||||
return users.modfiyUser(value).then(() => {
|
||||
message.success('操作成功');
|
||||
});
|
||||
return users.modfiyUser(value)
|
||||
}
|
||||
return users.addUser(value).then(() => {
|
||||
message.success('操作成功');
|
||||
});
|
||||
},
|
||||
};
|
||||
if(!record){
|
||||
let formMap: any = xFormModal.formMap
|
||||
formMap.splice(2, 0,{
|
||||
key: 'password',
|
||||
label: '密码',
|
||||
type: FormItemType.inputPassword,
|
||||
rules: [{ required: !record, message: '请输入密码' }],
|
||||
},)
|
||||
}
|
||||
wrapper.open(xFormModal);
|
||||
};
|
||||
|
||||
// const handleCfPassword = (rule:any, value:any, callback:any)=>{
|
||||
// if()
|
||||
// }
|
||||
export const showApplyModalModifyPassword = (record: IUser) => {
|
||||
const xFormModal:any = {
|
||||
formMap: [
|
||||
// {
|
||||
// key: 'oldPassword',
|
||||
// label: '旧密码',
|
||||
// type: FormItemType.inputPassword,
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// message: '请输入旧密码',
|
||||
// }]
|
||||
// },
|
||||
{
|
||||
key: 'newPassword',
|
||||
label: '新密码',
|
||||
type: FormItemType.inputPassword,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入新密码',
|
||||
}
|
||||
],
|
||||
attrs:{
|
||||
onChange:(e:any)=>{
|
||||
users.setNewPassWord(e.target.value)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'confirmPassword',
|
||||
label: '确认密码',
|
||||
type: FormItemType.inputPassword,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请确认密码',
|
||||
validator:(rule:any, value:any, callback:any) => {
|
||||
// 验证新密码的一致性
|
||||
if(users.newPassWord){
|
||||
if(value!==users.newPassWord){
|
||||
rule.message = "两次密码输入不一致";
|
||||
callback('两次密码输入不一致')
|
||||
}else{
|
||||
callback()
|
||||
}
|
||||
}else if(!value){
|
||||
rule.message = "请确认密码";
|
||||
callback('请确认密码');
|
||||
}else{
|
||||
callback()
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
formData: record || {},
|
||||
visible: true,
|
||||
title: '修改密码',
|
||||
onSubmit: (value: IUser) => {
|
||||
let params:any = {
|
||||
username:record?.username,
|
||||
password:value.confirmPassword,
|
||||
role:record?.role,
|
||||
}
|
||||
return users.modfiyUser(params).then(() => {
|
||||
message.success('操作成功');
|
||||
});
|
||||
},
|
||||
}
|
||||
wrapper.open(xFormModal);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { notification } from 'component/antd';
|
||||
import { IUploadFile, IConfigure } from 'types/base-type';
|
||||
import { notification, Select } from 'component/antd';
|
||||
import { IUploadFile, IConfigure, IConfigGateway } from 'types/base-type';
|
||||
import { version } from 'store/version';
|
||||
import { admin } from 'store/admin';
|
||||
import { wrapper } from 'store';
|
||||
@@ -97,8 +97,8 @@ const updateFormModal = (type: number) => {
|
||||
formMap[2].attrs = {
|
||||
accept: version.fileSuffix,
|
||||
},
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData, true);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData, true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -157,8 +157,8 @@ export const showModifyModal = (record: IUploadFile) => {
|
||||
|
||||
export const showConfigureModal = async (record?: IConfigure) => {
|
||||
if (record) {
|
||||
const result:any = await format2json(record.configValue);
|
||||
record.configValue = result.result;
|
||||
const result: any = await format2json(record.configValue);
|
||||
record.configValue = result.result || record.configValue;
|
||||
}
|
||||
const xFormModal = {
|
||||
formMap: [
|
||||
@@ -193,10 +193,69 @@ export const showConfigureModal = async (record?: IConfigure) => {
|
||||
return admin.editConfigure(value).then(data => {
|
||||
notification.success({ message: '编辑配置成功' });
|
||||
});
|
||||
} else {
|
||||
return admin.addNewConfigure(value).then(data => {
|
||||
notification.success({ message: '新建配置成功' });
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
wrapper.open(xFormModal);
|
||||
};
|
||||
|
||||
export const showConfigGatewayModal = async (record?: IConfigGateway) => {
|
||||
const xFormModal = {
|
||||
formMap: [
|
||||
{
|
||||
key: 'type',
|
||||
label: '配置类型',
|
||||
rules: [{ required: true, message: '请选择配置类型' }],
|
||||
type: "select",
|
||||
options: admin.gatewayType.map((item: any, index: number) => ({
|
||||
key: index,
|
||||
label: item.configName,
|
||||
value: item.configType,
|
||||
})),
|
||||
attrs: {
|
||||
disabled: record ? true : false,
|
||||
}
|
||||
}, {
|
||||
key: 'name',
|
||||
label: '配置键',
|
||||
rules: [{ required: true, message: '请输入配置键' }],
|
||||
attrs: {
|
||||
disabled: record ? true : false,
|
||||
},
|
||||
}, {
|
||||
key: 'value',
|
||||
label: '配置值',
|
||||
type: 'text_area',
|
||||
rules: [{
|
||||
required: true,
|
||||
message: '请输入配置值',
|
||||
}],
|
||||
}, {
|
||||
key: 'description',
|
||||
label: '描述',
|
||||
type: 'text_area',
|
||||
rules: [{ required: true, message: '请输入备注' }],
|
||||
},
|
||||
],
|
||||
formData: record || {},
|
||||
visible: true,
|
||||
isWaitting: true,
|
||||
title: `${record ? '编辑配置' : '新建配置'}`,
|
||||
onSubmit: async (parmas: IConfigGateway) => {
|
||||
if (record) {
|
||||
parmas.id = record.id;
|
||||
return admin.editConfigGateway(parmas).then(data => {
|
||||
notification.success({ message: '编辑配置成功' });
|
||||
});
|
||||
} else {
|
||||
return admin.addNewConfigGateway(parmas).then(data => {
|
||||
notification.success({ message: '新建配置成功' });
|
||||
});
|
||||
}
|
||||
return admin.addNewConfigure(value).then(data => {
|
||||
notification.success({ message: '新建配置成功' });
|
||||
});
|
||||
},
|
||||
};
|
||||
wrapper.open(xFormModal);
|
||||
|
||||
Reference in New Issue
Block a user