Fix the locales of field Action Type don't take effect in config history detail page (#5664)

* fix #5623, the locale issue in config rollback page

* build the change
This commit is contained in:
brotherlu-xcq 2021-05-10 20:18:34 -05:00 committed by GitHub
parent 639297372e
commit 9300c39375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 27 deletions

View File

@ -86,7 +86,7 @@ class ConfigRollback extends React.Component {
self.field.setValue('dataId', data.dataId);
self.field.setValue('content', data.content);
self.field.setValue('appName', data.appName);
self.field.setValue('opType', self.typeMapName[data.opType.trim()]);
self.field.setValue('opType', data.opType.trim());
self.opType = data.opType; // 当前回滚类型I:插入,D:删除,U:'更新'
self.field.setValue('group', data.group);
self.field.setValue('md5', data.md5);
@ -168,6 +168,18 @@ class ConfigRollback extends React.Component {
});
}
getOpType(type, locale) {
if (type) {
const typeMap = {
U: locale.update,
I: locale.insert,
D: locale.deleteAction,
};
return typeMap[type];
}
return '';
}
render() {
const { locale = {} } = this.props;
const { init } = this.field;
@ -179,6 +191,7 @@ class ConfigRollback extends React.Component {
span: 18,
},
};
const { getOpType } = this;
return (
<div style={{ padding: 10 }}>
<h1>{locale.configurationRollback}</h1>
@ -200,7 +213,7 @@ class ConfigRollback extends React.Component {
</FormItem>
</div>
<FormItem label={locale.actionType} required {...formItemLayout}>
<Input htmlType="text" readOnly {...init('opType')} />
<Input htmlType="text" readOnly value={getOpType(init('opType').value, locale)} />
</FormItem>
<FormItem label="MD5:" required {...formItemLayout}>
<Input htmlType="text" readOnly {...init('md5')} />

View File

@ -60,11 +60,6 @@ class HistoryDetail extends React.Component {
getDataDetail() {
const { locale = {} } = this.props;
const self = this;
const typeMap = {
U: locale.update,
I: locale.insert,
D: locale.deleteAction,
};
request({
url: `v1/cs/history?dataId=${this.dataId}&group=${this.group}&nid=${this.nid}`,
success(result) {
@ -76,7 +71,7 @@ class HistoryDetail extends React.Component {
self.field.setValue('envs', self.serverId);
self.field.setValue('srcUser', data.srcUser);
self.field.setValue('srcIp', data.srcIp);
self.field.setValue('opType', typeMap[data.opType.trim()]);
self.field.setValue('opType', data.opType.trim());
self.field.setValue('group', data.group);
self.field.setValue('md5', data.md5);
}
@ -90,6 +85,18 @@ class HistoryDetail extends React.Component {
);
}
getOpType(type, locale) {
if (type) {
const typeMap = {
U: locale.update,
I: locale.insert,
D: locale.deleteAction,
};
return typeMap[type];
}
return '';
}
render() {
const { locale = {} } = this.props;
const { init } = this.field;
@ -101,6 +108,7 @@ class HistoryDetail extends React.Component {
span: 18,
},
};
const { getOpType } = this;
return (
<div style={{ padding: 10 }}>
<h1>{locale.historyDetails}</h1>
@ -128,7 +136,7 @@ class HistoryDetail extends React.Component {
<Input htmlType="text" readOnly {...init('srcIp')} />
</Form.Item>
<Form.Item label={locale.actionType} required {...formItemLayout}>
<Input htmlType="text" readOnly {...init('opType')} />
<Input htmlType="text" readOnly value={getOpType(init('opType').value, locale)} />
</Form.Item>
<Form.Item label="MD5:" required {...formItemLayout}>
<Input htmlType="text" readOnly {...init('md5')} />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long