fix: HistoryRollback internationalization

This commit is contained in:
王彦民 2018-12-01 23:25:03 +08:00 committed by zhichen
parent 4f419b0058
commit d487f522b6
3 changed files with 52 additions and 35 deletions

View File

@ -143,5 +143,20 @@ const I18N_CONF = {
queryResultsQuery: 'Search Results: Found', queryResultsQuery: 'Search Results: Found',
articleMeetRequirementsConfiguration: 'configuration items.', articleMeetRequirementsConfiguration: 'configuration items.',
}, },
HistoryRollback: {
details: 'Details',
rollback: 'Roll Back',
pubNoData: 'No results found.',
toConfigure: 'Historical Versions (Configuration record is retained for 30 days.)',
dataId: 'Enter Data ID',
dataIdCanNotBeEmpty: 'Data ID cannot be empty',
group: 'Enter Group',
groupCanNotBeEmpty: 'Group cannot be empty',
query: 'Search',
queryResult: 'Search Results: Found',
articleMeet: 'configuration items.',
lastUpdateTime: 'Last Modified At',
operation: 'Operation',
},
}; };
export default I18N_CONF; export default I18N_CONF;

View File

@ -143,5 +143,20 @@ const I18N_CONF = {
queryResultsQuery: '查询结果:共查询到', queryResultsQuery: '查询结果:共查询到',
articleMeetRequirementsConfiguration: '条满足要求的配置。', articleMeetRequirementsConfiguration: '条满足要求的配置。',
}, },
HistoryRollback: {
details: '详情',
rollback: '回滚',
pubNoData: '没有数据',
toConfigure: '历史版本(保留30天)',
dataId: '请输入Data ID',
dataIdCanNotBeEmpty: 'Data ID不能为空',
group: '请输入Group',
groupCanNotBeEmpty: 'Group不能为空',
query: '查询',
queryResult: '查询结果:共查询到',
articleMeet: '条满足要求的配置。',
lastUpdateTime: '最后更新时间',
operation: '操作',
},
}; };
export default I18N_CONF; export default I18N_CONF;

View File

@ -12,12 +12,16 @@
*/ */
import React from 'react'; import React from 'react';
import { Field, Form, Input, Loading, Pagination, Table } from '@alifd/next'; import { ConfigProvider, Field, Form, Input, Loading, Pagination, Table } from '@alifd/next';
import RegionGroup from '../../../components/RegionGroup'; import RegionGroup from 'components/RegionGroup';
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib'; import { getParams, setParams, request, aliwareIntl } from '@/globalLib';
import './index.scss'; import './index.scss';
@ConfigProvider.config
class HistoryRollback extends React.Component { class HistoryRollback extends React.Component {
static displayName = 'HistoryRollback';
constructor(props) { constructor(props) {
super(props); super(props);
@ -144,14 +148,15 @@ class HistoryRollback extends React.Component {
showMore() {} showMore() {}
renderCol(value, index, record) { renderCol(value, index, record) {
const { locale = {} } = this.props;
return ( return (
<div> <div>
<a onClick={this.goDetail.bind(this, record)} style={{ marginRight: 5 }}> <a onClick={this.goDetail.bind(this, record)} style={{ marginRight: 5 }}>
{aliwareIntl.get('com.alibaba.nacos.page.historyRollback.details')} {locale.details}
</a> </a>
<span style={{ marginRight: 5 }}>|</span> <span style={{ marginRight: 5 }}>|</span>
<a style={{ marginRight: 5 }} onClick={this.goRollBack.bind(this, record)}> <a style={{ marginRight: 5 }} onClick={this.goRollBack.bind(this, record)}>
{aliwareIntl.get('com.alibaba.nacos.page.historyRollback.rollback')} {locale.rollback}
</a> </a>
</div> </div>
); );
@ -279,15 +284,9 @@ class HistoryRollback extends React.Component {
} }
render() { render() {
const pubnodedata = aliwareIntl.get('pubnodata'); const { locale = {} } = this.props;
const locale = {
empty: pubnodedata,
};
const { init } = this.field; const { init } = this.field;
this.init = init; this.init = init;
return ( return (
<div style={{ padding: 10 }}> <div style={{ padding: 10 }}>
<Loading <Loading
@ -298,7 +297,7 @@ class HistoryRollback extends React.Component {
color="#333" color="#333"
> >
<RegionGroup <RegionGroup
left={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.to_configure')} left={locale.toConfigure}
namespaceCallBack={this.cleanAndGetData.bind(this)} namespaceCallBack={this.cleanAndGetData.bind(this)}
/> />
{/** <div className={'namespacewrapper'}> {/** <div className={'namespacewrapper'}>
@ -309,15 +308,13 @@ class HistoryRollback extends React.Component {
<Form inline field={this.field}> <Form inline field={this.field}>
<Form.Item label="Data ID:" required> <Form.Item label="Data ID:" required>
<Input <Input
placeholder={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.dataid')} placeholder={locale.dataId}
style={{ width: 200 }} style={{ width: 200 }}
{...this.init('dataId', { {...this.init('dataId', {
rules: [ rules: [
{ {
required: true, required: true,
message: aliwareIntl.get( message: locale.dataIdCanNotBeEmpty,
'com.alibaba.nacos.page.form.Data_Id_can_not_be_empty'
),
}, },
], ],
})} })}
@ -325,15 +322,13 @@ class HistoryRollback extends React.Component {
</Form.Item> </Form.Item>
<Form.Item label="Group:" required> <Form.Item label="Group:" required>
<Input <Input
placeholder={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.group')} placeholder={locale.group}
style={{ width: 200 }} style={{ width: 200 }}
{...this.init('group', { {...this.init('group', {
rules: [ rules: [
{ {
required: true, required: true,
message: aliwareIntl.get( message: locale.groupCanNotBeEmpty,
'com.alibaba.nacos.page.listeningToQuery.group_can_not_be_empty'
),
}, },
], ],
})} })}
@ -347,7 +342,7 @@ class HistoryRollback extends React.Component {
onClick={this.selectAll.bind(this)} onClick={this.selectAll.bind(this)}
style={{ marginRight: 10 }} style={{ marginRight: 10 }}
> >
{aliwareIntl.get('com.alibaba.nacos.page.historyrollback.query')} {locale.query}
</Form.Submit> </Form.Submit>
</Form.Item> </Form.Item>
</Form> </Form>
@ -365,34 +360,26 @@ class HistoryRollback extends React.Component {
fontSize: 16, fontSize: 16,
}} }}
> >
{aliwareIntl.get('com.alibaba.nacos.page.historyRollback.queryresult')} {locale.queryResult}
<strong style={{ fontWeight: 'bold' }}> {this.state.total} </strong> <strong style={{ fontWeight: 'bold' }}> {this.state.total} </strong>
{aliwareIntl.get('com.alibaba.nacos.page.historyRollback.article_meet')} {locale.articleMeet}
</h3> </h3>
</div> </div>
<div> <div>
<Table <Table dataSource={this.state.dataSource} locale={{ empty: locale.pubNoData }}>
dataSource={this.state.dataSource}
locale={locale}
language={aliwareIntl.currentLanguageCode}
>
<Table.Column title="Data ID" dataIndex="dataId" /> <Table.Column title="Data ID" dataIndex="dataId" />
<Table.Column title="Group" dataIndex="group" /> <Table.Column title="Group" dataIndex="group" />
<Table.Column <Table.Column
title={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.last_update_time')} title={locale.lastUpdateTime}
dataIndex="time" dataIndex="time"
cell={this.renderLastTime.bind(this)} cell={this.renderLastTime.bind(this)}
/> />
<Table.Column <Table.Column title={locale.operation} cell={this.renderCol.bind(this)} />
title={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.operation')}
cell={this.renderCol.bind(this)}
/>
</Table> </Table>
</div> </div>
<div style={{ marginTop: 10, textAlign: 'right' }}> <div style={{ marginTop: 10, textAlign: 'right' }}>
<Pagination <Pagination
current={this.state.currentPage} current={this.state.currentPage}
language={aliwareIntl.currentLanguageCode}
total={this.state.total} total={this.state.total}
pageSize={this.state.pageSize} pageSize={this.state.pageSize}
onChange={this.changePage.bind(this)} onChange={this.changePage.bind(this)}