refactor: NameSpaceList i18n #474
This commit is contained in:
parent
33e5e47832
commit
fa57fa053d
@ -13,14 +13,18 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { ConfigProvider, Dialog } from '@alifd/next';
|
||||||
|
import { getParams, setParams, request } from '../../globalLib';
|
||||||
|
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import { Dialog } from '@alifd/next';
|
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../globalLib';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命名空间列表
|
* 命名空间列表
|
||||||
*/
|
*/
|
||||||
|
@ConfigProvider.config
|
||||||
class NameSpaceList extends React.Component {
|
class NameSpaceList extends React.Component {
|
||||||
|
static displayName = 'NameSpaceList';
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
setNowNameSpace: PropTypes.func,
|
setNowNameSpace: PropTypes.func,
|
||||||
namespaceCallBack: PropTypes.func,
|
namespaceCallBack: PropTypes.func,
|
||||||
@ -67,6 +71,7 @@ class NameSpaceList extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!this.state.namespaceList || this.state.namespaceList.length === 0) {
|
// if (!this.state.namespaceList || this.state.namespaceList.length === 0) {
|
||||||
// this.getNameSpaces();
|
// this.getNameSpaces();
|
||||||
// } else {
|
// } else {
|
||||||
@ -74,8 +79,8 @@ class NameSpaceList extends React.Component {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
切换namespace
|
切换namespace
|
||||||
* */
|
* */
|
||||||
changeNameSpace(ns, nsName) {
|
changeNameSpace(ns, nsName) {
|
||||||
this.setnamespace(ns || '');
|
this.setnamespace(ns || '');
|
||||||
setParams({
|
setParams({
|
||||||
@ -94,6 +99,7 @@ class NameSpaceList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getNameSpaces() {
|
getNameSpaces() {
|
||||||
|
const { locale = {} } = this.props;
|
||||||
if (window.namespaceList) {
|
if (window.namespaceList) {
|
||||||
this.handleNameSpaces(window.namespaceList);
|
this.handleNameSpaces(window.namespaceList);
|
||||||
} else {
|
} else {
|
||||||
@ -105,8 +111,7 @@ class NameSpaceList extends React.Component {
|
|||||||
this.handleNameSpaces(res.data);
|
this.handleNameSpaces(res.data);
|
||||||
} else {
|
} else {
|
||||||
Dialog.alert({
|
Dialog.alert({
|
||||||
language: aliwareIntl.currentLanguageCode || 'zh-cn',
|
title: locale.notice,
|
||||||
title: aliwareIntl.get('com.alibaba.nacos.component.NameSpaceList.Prompt'),
|
|
||||||
content: res.message,
|
content: res.message,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,11 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button } from '@alifd/next';
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
import { Button } from '@alifd/next';
|
||||||
import NameSpaceList from '../NameSpaceList';
|
import NameSpaceList from '../NameSpaceList';
|
||||||
import { setParams, request } from '../../globalLib';
|
import { setParams, request } from '../../globalLib';
|
||||||
|
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
class RegionGroup extends React.Component {
|
class RegionGroup extends React.Component {
|
||||||
@ -53,7 +54,7 @@ class RegionGroup extends React.Component {
|
|||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.nameSpaceList = null;
|
this.nameSpaceList = React.createRef();
|
||||||
this.mainRef = null;
|
this.mainRef = null;
|
||||||
this.titleRef = null;
|
this.titleRef = null;
|
||||||
this.regionRef = null;
|
this.regionRef = null;
|
||||||
@ -76,7 +77,7 @@ class RegionGroup extends React.Component {
|
|||||||
// this.setRegionWidth();
|
// this.setRegionWidth();
|
||||||
// this.handleRegionListStatus();
|
// this.handleRegionListStatus();
|
||||||
// });
|
// });
|
||||||
this.nameSpaceList && this.nameSpaceList.getNameSpaces();
|
this.nameSpaceList.current.getInstance().getNameSpaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@ -151,7 +152,7 @@ class RegionGroup extends React.Component {
|
|||||||
this.handleRegionList(window._regionList);
|
this.handleRegionList(window._regionList);
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
// TODO
|
||||||
this.nameSpaceList && this.nameSpaceList.getNameSpaces();
|
this.nameSpaceList.current.getInstance().getNameSpaces();
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: this.state.url,
|
url: this.state.url,
|
||||||
@ -188,7 +189,7 @@ class RegionGroup extends React.Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.changeRegionBarRegionId(this.currRegionId);
|
this.changeRegionBarRegionId(this.currRegionId);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this.nameSpaceList && this.nameSpaceList.getNameSpaces();
|
this.nameSpaceList.current.getInstance().getNameSpaces();
|
||||||
this.setState({
|
this.setState({
|
||||||
currRegionId: envcontent,
|
currRegionId: envcontent,
|
||||||
instanceData,
|
instanceData,
|
||||||
@ -302,15 +303,15 @@ class RegionGroup extends React.Component {
|
|||||||
: this.state.right}
|
: this.state.right}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.props.namespaceCallBack ? (
|
{this.props.namespaceCallBack && (
|
||||||
<div>
|
<div>
|
||||||
<NameSpaceList
|
<NameSpaceList
|
||||||
ref={ref => (this.nameSpaceList = ref)}
|
ref={this.nameSpaceList}
|
||||||
namespaceCallBack={this.props.namespaceCallBack}
|
namespaceCallBack={this.props.namespaceCallBack}
|
||||||
setNowNameSpace={this.props.setNowNameSpace}
|
setNowNameSpace={this.props.setNowNameSpace}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -355,6 +355,9 @@ const I18N_CONF = {
|
|||||||
namespacenotnull: 'Namespace cannot be empty',
|
namespacenotnull: 'Namespace cannot be empty',
|
||||||
description: 'Description:',
|
description: 'Description:',
|
||||||
},
|
},
|
||||||
|
NameSpaceList: {
|
||||||
|
notice: 'Notice',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default I18N_CONF;
|
export default I18N_CONF;
|
||||||
|
@ -354,6 +354,9 @@ const I18N_CONF = {
|
|||||||
namespacenotnull: '命名空间不能为空',
|
namespacenotnull: '命名空间不能为空',
|
||||||
description: '描述:',
|
description: '描述:',
|
||||||
},
|
},
|
||||||
|
NameSpaceList: {
|
||||||
|
notice: '提示',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default I18N_CONF;
|
export default I18N_CONF;
|
||||||
|
@ -300,10 +300,6 @@ class HistoryRollback extends React.Component {
|
|||||||
left={locale.toConfigure}
|
left={locale.toConfigure}
|
||||||
namespaceCallBack={this.cleanAndGetData.bind(this)}
|
namespaceCallBack={this.cleanAndGetData.bind(this)}
|
||||||
/>
|
/>
|
||||||
{/** <div className={'namespacewrapper'}>
|
|
||||||
<NameSpaceList namespaceCallBack={this.cleanAndGetData.bind(this)} />
|
|
||||||
</div>* */}
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Form inline field={this.field}>
|
<Form inline field={this.field}>
|
||||||
<Form.Item label="Data ID:" required>
|
<Form.Item label="Data ID:" required>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user