This commit is contained in:
zengqiao
2020-12-19 00:40:52 +08:00
parent 49280a8617
commit 447a575f4f
83 changed files with 1578 additions and 559 deletions

View File

@@ -29,6 +29,7 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
}],
attrs: {
placeholder: '请输入应用ID',
disabled: true,
},
},
{
@@ -57,7 +58,7 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
key: 'properties',
label: 'Topic属性列表',
type: 'text_area',
rules: [{ required: false}],
rules: [{ required: false }],
attrs: {
placeholder: '请输入Topic属性列表',
},
@@ -78,7 +79,7 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
clusterName: item.clusterName,
appId: item.appId,
topicName: item.topicName,
retentionTime: transMSecondToHour(item.retentionTime),
retentionTime: transMSecondToHour(item.retentionTime),
properties: JSON.stringify(item.properties, null, 4),
description: item.description,
},
@@ -97,18 +98,13 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
};
export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCluster) => {
let clusterModes = [] as IConfigInfo[];
clusterModes = cluster.clusterModes ? cluster.clusterModes : clusterModes;
const xFormModal = {
formMap: [
{
key: 'logicalClusterName',
label: '逻辑集群名称',
rules: [{ required: true, message: '请输入逻辑集群名称' }],
attrs: {
disabled: record ? true : false,
},
},
let isShow = false;
if (record && record.mode != 0) {
isShow = true;
}
const updateFormModal = (isShow: boolean) => {
const formMap = wrapper.xFormWrapper.formMap;
isShow ? formMap.splice(2, 0,
{
key: 'appId',
label: '所属应用',
@@ -123,6 +119,41 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
attrs: {
placeholder: '请选择所属应用',
},
}) : formMap.splice(2, 1);
const formData = wrapper.xFormWrapper.formData;
wrapper.ref && wrapper.ref.updateFormMap$(formMap, formData || {});
};
let clusterModes = [] as IConfigInfo[];
clusterModes = cluster.clusterModes ? cluster.clusterModes : clusterModes;
let xFormModal = {
formMap: [
{
key: 'logicalClusterName',
label: '逻辑集群中文名称',
// defaultValue:'',
rules: [{
required: true,
message: '请输入逻辑集群中文名称,支持中文、字母、数字、下划线(_)和短划线(-)组成长度在3-128字符之间', // 不能以下划线_和短划线(-)开头和结尾
pattern: /^[a-zA-Z0-9_\-\u4e00-\u9fa5]{3,128}$/g, //(?!(_|\-))(?!.*?(_|\-)$)
}],
attrs: {
// disabled: record ? true : false,
placeholder:'请输入逻辑集群中文名称'
},
},
{
key: 'logicalClusterName1',
label: '逻辑集群英文名称',
// defaultValue:'',
rules: [{
required: true,
message: '请输入逻辑集群英文名称,支持字母、数字、下划线(_)和短划线(-)组成长度在3-128字符之间', //不能以下划线_和短划线(-)开头和结尾
pattern:/^[a-zA-Z0-9_\-]{3,128}$/g, //(?!(_|\-))(?!.*?(_|\-)$)
}],
attrs: {
disabled: record ? true : false,
placeholder:'请输入逻辑集群英文名称,创建后无法修改'
},
},
{
key: 'mode',
@@ -136,8 +167,32 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
};
}),
attrs: {
onChange(item: any) {
if (isShow && item == 0) {
updateFormModal(false);
isShow = false;
} else if (!isShow && (item == 1 || item == 2)) {
updateFormModal(true);
isShow = true;
}
},
},
},
// {
// key: 'appId',
// label: '所属应用',
// rules: [{ required: true , message: '请选择所属应用' }],
// type: 'select',
// options: app.adminAppData.map(item => {
// return {
// label: item.name,
// value: item.appId,
// };
// }),
// attrs: {
// placeholder: '请选择所属应用',
// },
// },
{
key: 'regionIdList',
label: 'RegionIdList',
@@ -149,10 +204,10 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
value: item.id,
};
}),
rules: [{ required: true, message: '请选择BrokerIdList' }],
rules: [{ required: true, message: '请选择RegionIdList' }],
attrs: {
mode: 'multiple',
placeholder: '请选择BrokerIdList',
placeholder: '请选择RegionIdList',
},
},
{
@@ -169,7 +224,7 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
],
formData: record,
visible: true,
title: '新增逻辑集群',
title: record ? '编辑逻辑集群' : '新增逻辑集群',
onSubmit: (value: INewLogical) => {
const params = {
appId: value.appId,
@@ -178,6 +233,7 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
id: record ? record.logicalClusterId : '',
mode: value.mode,
name: value.logicalClusterName,
englishName:value.logicalClusterEName, // 存储逻辑集群英文名称
regionIdList: value.regionIdList,
} as INewLogical;
if (record) {
@@ -190,11 +246,12 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
});
},
};
wrapper.open(xFormModal);
};
export const showClusterRegionOpModal = (clusterId: number, content: IMetaData, record?: IBrokersRegions) => {
const xFormModal = {
const xFormModal = {
formMap: [
{
key: 'name',
@@ -216,9 +273,9 @@ export const showClusterRegionOpModal = (clusterId: number, content: IMetaData,
key: 'brokerIdList',
label: 'Broker列表',
defaultValue: record ? record.brokerIdList.join(',') : [] as any,
rules: [{ required: true, message: '请输入BrokerIdList' }],
rules: [{ required: true, message: '请输入BrokerID,多个BrokerID用半角逗号分隔' }],
attrs: {
placeholder: '请输入BrokerIdList',
placeholder: '请输入BrokerID,多个BrokerID用半角逗号分隔',
},
},
{
@@ -274,5 +331,5 @@ export const showClusterRegionOpModal = (clusterId: number, content: IMetaData,
});
},
};
wrapper.open(xFormModal);
wrapper.open(xFormModal);
};

View File

@@ -0,0 +1,173 @@
import * as React from 'react';
import { admin } from 'store/admin';
import { notification, Modal, Form, Input, Switch, Select, Tooltip, Radio } from 'antd';
import { IBrokersMetadata, IBrokersRegions, IExpand } from 'types/base-type';
import { searchProps } from 'constants/table';
import { expandPartition } from 'lib/api';
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 15 },
};
interface IXFormProps {
form: any;
formData?: any;
visible?: boolean;
handleVisible?: any;
clusterId?: number;
deleteTopic?: any;
}
class CustomForm extends React.Component<IXFormProps> {
// public state = {
// checked: false,
// };
// public onSwitchChange(checked: boolean) {
// this.setState({ checked });
// this.props.form.validateFields((err: any, values: any) => {
// checked ? values.brokerIdList = [] : values.regionId = '';
// });
// }
public handleExpandOk() {
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 {
this.props.handleVisible(false);
// 调用删除接口
this.props.deleteTopic(deleteData);
}
}
// if (!err) {
// this.props.handleVisible(false);
// const params = {
// topicName: values.topicName,
// clusterId: this.props.clusterId,
// partitionNum: values.partitionNum,
// } as IExpand;
// if (values.brokerIdList) {
// params.brokerIdList = values.brokerIdList;
// } else {
// params.regionId = values.regionId;
// }
// const valueParams = [] as IExpand[];
// valueParams.push(params);
// expandPartition(valueParams).then(data => {
// notification.success({ message: '扩分成功' });
// this.props.form.resetFields();
// admin.getClusterTopics(this.props.clusterId);
// });
});
}
public handleExpandCancel() {
this.props.handleVisible(false);
this.props.form.resetFields();
}
public componentDidMount() {
admin.getBrokersMetadata(this.props.clusterId);
admin.getBrokersRegions(this.props.clusterId);
}
public render() {
// console.log('props', this.props);
const { formData = {} as any, visible } = this.props;
const { getFieldDecorator } = this.props.form;
let metadata = [] as IBrokersMetadata[];
metadata = admin.brokersMetadata ? admin.brokersMetadata : metadata;
let regions = [] as IBrokersRegions[];
regions = admin.brokersRegions ? admin.brokersRegions : regions;
return (
<Modal
title="提示"
visible={visible}
onOk={() => this.handleExpandOk()}
onCancel={() => this.handleExpandCancel()}
maskClosable={false}
okText="确认"
cancelText="取消"
>
<Form {...layout} name="basic" onSubmit={() => ({})} >
{/* <Form.Item label="Topic名称" >
{getFieldDecorator('topicName', {
initialValue: formData.topicName,
rules: [{ required: true, message: '请输入Topic名称' }],
})(<Input disabled={true} placeholder="请输入Topic名称" />)}
</Form.Item> */}
{/* 运维管控-topic信息-扩分区操作 */}
{/* <Form.Item label="所属region" >
{getFieldDecorator('topicName', {
initialValue: formData.topicName,
rules: [{ required: true, message: '请输入所属region' }],
})(<Input disabled={true} placeholder="请输入所属region" />)}
</Form.Item> */}
{/* 运维管控-topic信息-扩分区操作 */}
<div style={{ textAlign: 'center', padding: '10px 0', fontSize: '13px', fontWeight: 'bold', color: 'red' }}>
<span>Topic是高危操作,Topic名称进行确认</span>
</div>
<Form.Item label="Topic名称" >
{getFieldDecorator('topicName', {
rules: [{
required: true,
message: 'topic名称错误',
}],
})(<Input />)}
</Form.Item>
{/* <Form.Item label="brokerIdList" style={{ display: this.state.checked ? 'none' : '' }}>
{getFieldDecorator('brokerIdList', {
initialValue: formData.brokerIdList,
rules: [{ required: !this.state.checked, message: '请输入brokerIdList' }],
})(
<Select
mode="multiple"
{...searchProps}
>
{metadata.map((v, index) => (
<Select.Option
key={v.brokerId || v.key || index}
value={v.brokerId}
>
{v.host.length > 16 ?
<Tooltip placement="bottomLeft" title={v.host}> {v.host} </Tooltip>
: v.host}
</Select.Option>
))}
</Select>,
)}
</Form.Item>*/}
{/* <Form.Item label="regionId" style={{ display: this.state.checked ? '' : 'none' }} >
{getFieldDecorator('regionId', {
initialValue: formData.regionId,
rules: [{ required: this.state.checked, message: '请选择regionId' }],
})(
<Select {...searchProps}>
{regions.map((v, index) => (
<Select.Option
key={v.id || v.key || index}
value={v.id}
>
{v.name.length > 16 ?
<Tooltip placement="bottomLeft" title={v.name}> {v.name} </Tooltip>
: v.name}
</Select.Option>
))}
</Select>,
)}
</Form.Item> */}
</Form>
</Modal>
);
}
}
export const ConfirmDetailTopicFormWrapper = Form.create<IXFormProps>()(CustomForm);

View File

@@ -1,6 +1,6 @@
import * as React from 'react';
import { admin } from 'store/admin';
import { notification, Modal, Form, Input, Switch, Select, Tooltip } from 'antd';
import { notification, Modal, Form, Input, Switch, Select, Tooltip, Radio } from 'antd';
import { IBrokersMetadata, IBrokersRegions, IExpand } from 'types/base-type';
import { searchProps } from 'constants/table';
import { expandPartition } from 'lib/api';
@@ -89,14 +89,31 @@ class CustomForm extends React.Component<IXFormProps> {
rules: [{ required: true, message: '请输入Topic名称' }],
})(<Input disabled={true} placeholder="请输入Topic名称" />)}
</Form.Item>
{/* 运维管控-topic信息-扩分区操作 */}
<Form.Item label="所属region" >
{getFieldDecorator('regionNameList', {
initialValue: admin.topicsBasic ? admin.topicsBasic.regionNameList : '',
rules: [{ required: true, message: '请输入所属region' }],
})(<Input disabled={true} />)}
</Form.Item>
{/* 运维管控-topic信息-扩分区操作 */}
<Form.Item label="分区数" >
{getFieldDecorator('partitionNum', {
rules: [{ required: true,
message: '请输入分区数' }],
rules: [{
required: true,
message: '请输入分区数',
}],
})(<Input placeholder="请输入分区数" />)}
</Form.Item>
<Form.Item label={this.state.checked ? 'Region类型' : 'Borker类型'} >
<Switch onChange={(checked) => this.onSwitchChange(checked)} />
<Form.Item label="类型">
{/* <Form.Item label={this.state.checked ? 'Region类型' : 'Borker类型'} > */}
{/* <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.Group>
</Form.Item>
<Form.Item label="brokerIdList" style={{ display: this.state.checked ? 'none' : '' }}>
{getFieldDecorator('brokerIdList', {
@@ -107,14 +124,14 @@ class CustomForm extends React.Component<IXFormProps> {
mode="multiple"
{...searchProps}
>
{ metadata.map((v, index) => (
{metadata.map((v, index) => (
<Select.Option
key={v.brokerId || v.key || index}
value={v.brokerId}
>
{v.host.length > 16 ?
<Tooltip placement="bottomLeft" title={v.host}> {v.host} </Tooltip>
: v.host}
{v.host.length > 16 ?
<Tooltip placement="bottomLeft" title={v.host}> {v.host} </Tooltip>
: v.host}
</Select.Option>
))}
</Select>,
@@ -127,7 +144,7 @@ class CustomForm extends React.Component<IXFormProps> {
rules: [{ required: this.state.checked, message: '请选择regionId' }],
})(
<Select {...searchProps}>
{ regions.map((v, index) => (
{regions.map((v, index) => (
<Select.Option
key={v.id || v.key || index}
value={v.id}

View File

@@ -1,5 +1,5 @@
import * as React from 'react';
import { Table, notification, Button, Modal, Input, Form, Select, message, Tooltip } from 'component/antd';
import { Table, notification, Button, Modal, Input, Form, Select, message, Tooltip, Icon, Spin } from 'component/antd';
import { IBrokersMetadata, IRebalance } from 'types/base-type';
import { admin } from 'store/admin';
import { implementRegions, rebalanceStatus } from 'lib/api';
@@ -27,6 +27,7 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
public state = {
imVisible: false,
status: '',
isExecutionBtn: false
};
public handleRebalanceCancel() {
@@ -48,6 +49,7 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
public handleSubmit = (e: any) => {
e.preventDefault();
this.props.form.validateFields((err: any, values: any) => {
values.brokerId && this.setState({ isExecutionBtn: true })
if (!err) {
let params = {} as IRebalance;
params = {
@@ -58,12 +60,19 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
topicName: '',
};
implementRegions(params).then(data => {
message.success('获取成功');
// message.success('获取成功');
this.getStatus();
this.setState({
imVisible: true,
isExecutionBtn: false
});
});
}).catch((err) => {
message.error('获取失败')
this.setState({
imVisible: true,
isExecutionBtn: false
});
})
}
});
}
@@ -77,7 +86,7 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
public getStatus() {
rebalanceStatus(this.props.clusterId).then((data: any) => {
message.success('状态更新成功');
// message.success('状态更新成功');
if (data.code === 30) { // code -1 未知 101 成功 30 运行中
setTimeout(this.iTimer, 0);
} else {
@@ -91,6 +100,8 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
public componentWillUnmount() {
clearInterval(this.timer);
}
// 执行加载图标
public antIcon = <Icon type="loading" style={{ fontSize: 12, color: '#cccccc' }} spin />
public render() {
const { visible } = this.props;
@@ -140,21 +151,21 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
{getFieldDecorator('brokerId', {
rules: [{ required: true, message: '请输入Broker' }],
})(
<Select
onChange={(value: number) => this.onMetaChange(value)}
{...searchProps}
>
{this.metadata.map((v, index) => (
<Select.Option
key={v.brokerId || v.key || index}
value={v.brokerId}
>
{v.host.length > 16 ?
<Tooltip placement="bottomLeft" title={v.host}> {v.host} </Tooltip>
: v.host}
</Select.Option>
))}
</Select>)}
<Select
onChange={(value: number) => this.onMetaChange(value)}
{...searchProps}
>
{this.metadata.map((v, index) => (
<Select.Option
key={v.brokerId || v.key || index}
value={v.brokerId}
>
{v.host.length > 16 ?
<Tooltip placement="bottomLeft" title={v.host}> {v.host} </Tooltip>
: v.host}
</Select.Option>
))}
</Select>)}
</Form.Item>
<Form.Item label="" >
{getFieldDecorator('submit')(
@@ -162,8 +173,9 @@ class LeaderRebalanceModal extends React.Component<IXFormProps> {
htmlType="submit"
type="primary"
className="implement-button"
disabled={this.state.isExecutionBtn}
>
{this.state.isExecutionBtn ? (<span><Spin indicator={this.antIcon} size="small" /></span>) : '执行'}
</Button>,
)}
</Form.Item>

View File

@@ -19,42 +19,42 @@ export const startMigrationTask = (item: IReassignTasks, action: string) => {
};
export const modifyMigrationTask = (item: IReassignTasks, action: string) => {
const status: number = item.status;
const xFormModal = {
formMap: [
{
key: 'beginTime',
label: '计划开始时间',
type: 'date_picker',
rules: [{
required: status === 0,
message: '请输入计划开始时间',
}],
attrs: {
placeholder: '请输入计划开始时间',
format: timeFormat,
showTime: true,
disabled: status !== 0,
},
const status: number = item.status;
const xFormModal = {
formMap: [
{
key: 'beginTime',
label: '计划开始时间',
type: 'date_picker',
rules: [{
required: status === 0,
message: '请输入计划开始时间',
}],
attrs: {
placeholder: '请输入计划开始时间',
format: timeFormat,
showTime: true,
disabled: status !== 0,
},
],
formData: {
beginTime: moment(item.beginTime),
},
visible: true,
title: '操作迁移任务',
onSubmit: (value: IExecute) => {
const params = {
action,
beginTime: +moment(value.beginTime).format('x'),
taskId: item.taskId,
} as IExecute;
expert.getExecuteTask(params).then(data => {
notification.success({ message: '操作成功' });
});
},
};
wrapper.open(xFormModal);
],
formData: {
beginTime: moment(item.beginTime),
},
visible: true,
title: '操作迁移任务',
onSubmit: (value: IExecute) => {
const params = {
action,
beginTime: +moment(value.beginTime).format('x'),
taskId: item.taskId,
} as IExecute;
expert.getExecuteTask(params).then(data => {
notification.success({ message: '操作成功' });
});
},
};
wrapper.open(xFormModal);
};
export const modifyTransferTask = (item: IReassign, action: string, taskId: number) => {
@@ -287,6 +287,7 @@ export const addMigrationTask = () => {
formData: {},
visible: true,
title: '新建集群任务',
isWaitting: true,
onSubmit: (value: INewBulidEnums) => {
value.kafkaPackageName = value.kafkafileNameMd5.split(',')[0];
value.kafkaPackageMd5 = value.kafkafileNameMd5.split(',')[1];
@@ -294,10 +295,21 @@ export const addMigrationTask = () => {
value.serverPropertiesMd5 = value.serverfileNameMd5.split(',')[1];
delete value.kafkafileNameMd5;
delete value.serverfileNameMd5;
admin.addMigrationTask(value).then(data => {
return admin.addMigrationTask(value).then(data => {
notification.success({ message: '新建集群任务成功' });
});
},
onSubmitFaild: (err: any, ref: any, formData: any, formMap: any) => {
if (err.message === '主机列表错误,请检查主机列表') {
const hostList = ref.getFieldValue('hostList');
ref.setFields({
hostList: {
value: hostList,
errors: [new Error('主机列表错误,请检查主机列表')],
}
})
}
}
};
wrapper.open(xFormModal);
};

View File

@@ -12,12 +12,12 @@ const updateFormModal = (topicName?: string) => {
const formMap = wrapper.xFormWrapper.formMap;
const formData = wrapper.xFormWrapper.formData;
if (topicName) {
formMap[5].options = expert.partitionIdMap[topicName]; // 3
formMap[2].options = expert.partitionIdMap[topicName]; // 3
formData.originalRetentionTime = transMSecondToHour(admin.topicsBasic.retentionTime);
} else {
formMap[1].options = expert.taskTopicMetadata;
formMap[3].options = admin.brokersMetadata; // 2
formMap[4].options = admin.brokersRegions;
formMap[4].options = admin.brokersMetadata; // 2
formMap[5].options = admin.brokersRegions;
}
// tslint:disable-next-line:no-unused-expression
wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData, !!topicName, ['partitionIdList']);
@@ -25,11 +25,11 @@ const updateFormModal = (topicName?: string) => {
const updateInputModal = (status?: string) => {
const formMap = wrapper.xFormWrapper.formMap;
formMap[3].invisible = status === 'region';
formMap[4].invisible = status !== 'region';
formMap[4].invisible = status === 'region';
formMap[5].invisible = status !== 'region';
formMap[3].rules = [{required: status !== 'region'}];
formMap[4].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);
};
@@ -81,6 +81,19 @@ export const createMigrationTasks = () => {
},
},
},
{
key: 'partitionIdList',
label: '分区ID',
type: 'select',
defaultValue: [] as any,
rules: [{
required: false,
}],
attrs: {
mode: 'tags',
placeholder: '请选择PartitionIdList',
},
},
{
key: 'species',
label: '类型',
@@ -110,10 +123,10 @@ export const createMigrationTasks = () => {
defaultValue: [] as any,
invisible: false,
options: admin.brokersMetadata,
rules: [{ required: true, message: '请选择Broker' }],
rules: [{ required: true, message: '请选择目标Broker,Broker数量需大于等于副本数量' }],
attrs: {
mode: 'multiple',
placeholder: '请选择Broker',
placeholder: '请选择目标Broker,Broker数量需大于等于副本数量',
},
},
{
@@ -123,24 +136,12 @@ export const createMigrationTasks = () => {
defaultValue: [] as any,
invisible: true,
options: admin.brokersRegions,
rules: [{ required: false, message: '请选择Region' }],
rules: [{ required: false, message: '请选择目标Region' }],
attrs: {
placeholder: '请选择Region',
},
},
{
key: 'partitionIdList',
label: '分区ID',
type: 'select',
defaultValue: [] as any,
rules: [{
required: false,
}],
attrs: {
mode: 'tags',
placeholder: '请选择PartitionIdList',
placeholder: '请选择目标Region',
},
},
{
key: 'beginTime',
label: '计划开始时间',

View File

@@ -12,6 +12,9 @@ export const showApplyModal = (record?: IUser) => {
key: 'username',
label: '用户名',
rules: [{ required: true, message: '请输入用户名' }],
attrs: {
disabled: record ? true : false
}
}, {
key: 'role',
label: '角色',

View File

@@ -1,10 +1,15 @@
import * as React from 'react';
import { notification } from 'component/antd';
import { IUploadFile, IConfigure } from 'types/base-type';
import { version } from 'store/version';
import { admin } from 'store/admin';
import { wrapper } from 'store';
import { computeChecksumMd5 } from 'lib/utils';
import format2json from 'format-to-json';
interface ISearchAndFilterState {
[filter: string]: boolean | string | number | any[];
}
const handleSelectChange = (e: number) => {
version.setAcceptFileType(e);
updateFormModal(e);
@@ -150,7 +155,11 @@ export const showModifyModal = (record: IUploadFile) => {
wrapper.open(xFormModal);
};
export const showConfigureModal = (record?: IConfigure) => {
export const showConfigureModal = async (record?: IConfigure) => {
if (record) {
const result:any = await format2json(record.configValue);
record.configValue = result.result;
}
const xFormModal = {
formMap: [
{
@@ -163,8 +172,11 @@ export const showConfigureModal = (record?: IConfigure) => {
}, {
key: 'configValue',
label: '配置值',
type: 'text_area',
rules: [{ required: true, message: '请输入配置值' }],
type: 'monaco_editor',
rules: [{
required: true,
message: '请输入配置值',
}],
}, {
key: 'configDescription',
label: '备注',