fix: closes #2457
This commit is contained in:
parent
51ce42593b
commit
9c01fd3814
@ -201,25 +201,6 @@ class ConfigurationManagement extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 回车事件
|
|
||||||
*/
|
|
||||||
keyDownSearch(e) {
|
|
||||||
const theEvent = e || window.event;
|
|
||||||
const code = theEvent.keyCode || theEvent.which || theEvent.charCode;
|
|
||||||
if (this.state.isPageEnter) {
|
|
||||||
this.setState({
|
|
||||||
isPageEnter: false,
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (code === 13) {
|
|
||||||
this.getData();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
navTo(url, record) {
|
navTo(url, record) {
|
||||||
this.serverId = getParams('serverId') || '';
|
this.serverId = getParams('serverId') || '';
|
||||||
this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数
|
this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数
|
||||||
@ -242,18 +223,6 @@ class ConfigurationManagement extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
|
||||||
window.addEventListener('keydown', this.keyDownSearch.bind(this), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
window.removeEventListener('keydown', this.keyDownSearch.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
onSearch() {}
|
|
||||||
|
|
||||||
onChange() {}
|
|
||||||
|
|
||||||
cleanAndGetData(needclean = false) {
|
cleanAndGetData(needclean = false) {
|
||||||
if (needclean) {
|
if (needclean) {
|
||||||
this.dataId = '';
|
this.dataId = '';
|
||||||
@ -275,7 +244,9 @@ class ConfigurationManagement extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getData(pageNo = 1, clearSelect = true) {
|
getData(pageNo = 1, clearSelect = true) {
|
||||||
const self = this;
|
if (this.state.loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数
|
this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数
|
||||||
this.serverId = getParams('serverId') || '';
|
this.serverId = getParams('serverId') || '';
|
||||||
const params = {
|
const params = {
|
||||||
@ -286,47 +257,20 @@ class ConfigurationManagement extends React.Component {
|
|||||||
pageNo,
|
pageNo,
|
||||||
pageSize: this.state.pageSize,
|
pageSize: this.state.pageSize,
|
||||||
};
|
};
|
||||||
let urlPrefix = '';
|
|
||||||
if (this.dataId.indexOf('*') !== -1 || this.group.indexOf('*') !== -1) {
|
if (this.dataId.indexOf('*') !== -1 || this.group.indexOf('*') !== -1) {
|
||||||
params.search = 'blur';
|
params.search = 'blur';
|
||||||
} else {
|
} else {
|
||||||
params.search = 'accurate';
|
params.search = 'accurate';
|
||||||
}
|
}
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
this.props.getConfigs(params).then(() => this.setState({ loading: false }));
|
this.props.getConfigs(params).then(() =>
|
||||||
|
this.setState({
|
||||||
request({
|
loading: false,
|
||||||
url: `${urlPrefix}&dataId=${this.dataId}&group=${this.group}&appName=${
|
selectedRecord: [],
|
||||||
this.appName
|
selectedKeys: [],
|
||||||
}&config_tags=${this.state.config_tags || ''}&pageNo=${pageNo}&pageSize=${
|
tenant: this.tenant,
|
||||||
this.state.pageSize
|
})
|
||||||
}`,
|
);
|
||||||
success(data) {
|
|
||||||
if (data != null) {
|
|
||||||
self.setState({
|
|
||||||
dataSource: data.pageItems,
|
|
||||||
total: data.totalCount,
|
|
||||||
currentPage: data.pageNumber,
|
|
||||||
});
|
|
||||||
if (clearSelect) {
|
|
||||||
self.setState({
|
|
||||||
selectedRecord: [],
|
|
||||||
selectedKeys: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.setState({
|
|
||||||
tenant: self.tenant,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error(data) {
|
|
||||||
self.setState({
|
|
||||||
dataSource: [],
|
|
||||||
total: 0,
|
|
||||||
currentPage: 0,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showMore() {}
|
showMore() {}
|
||||||
@ -456,8 +400,6 @@ class ConfigurationManagement extends React.Component {
|
|||||||
this.setState({ pageSize }, () => this.changePage(1));
|
this.setState({ pageSize }, () => this.changePage(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
onInputUpdate() {}
|
|
||||||
|
|
||||||
chooseFieldChange(fieldValue) {
|
chooseFieldChange(fieldValue) {
|
||||||
this.setState({
|
this.setState({
|
||||||
fieldValue,
|
fieldValue,
|
||||||
@ -503,16 +445,9 @@ class ConfigurationManagement extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataId(value) {
|
|
||||||
this.dataId = value;
|
|
||||||
this.setState({
|
|
||||||
dataId: value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setConfigTags(value) {
|
setConfigTags(value) {
|
||||||
this.setState({
|
this.setState({
|
||||||
config_tags: value,
|
config_tags: value || [],
|
||||||
tagLst: value,
|
tagLst: value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -620,8 +555,6 @@ class ConfigurationManagement extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageSelectAll(selected, records) {}
|
|
||||||
|
|
||||||
getBatchFailedContent(res) {
|
getBatchFailedContent(res) {
|
||||||
const { locale = {} } = this.props;
|
const { locale = {} } = this.props;
|
||||||
return (
|
return (
|
||||||
@ -1241,17 +1174,20 @@ class ConfigurationManagement extends React.Component {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Form inline>
|
<Form inline>
|
||||||
<Form.Item label={'Data ID:'}>
|
<Form.Item label="Data ID:">
|
||||||
<Input
|
<Input
|
||||||
htmlType={'text'}
|
htmlType="text"
|
||||||
placeholder={locale.fuzzyd}
|
placeholder={locale.fuzzyd}
|
||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
value={this.state.dataId}
|
onChange={dataId => {
|
||||||
onChange={this.getDataId.bind(this)}
|
this.dataId = dataId;
|
||||||
|
this.setState({ dataId });
|
||||||
|
}}
|
||||||
|
onPressEnter={() => this.getData()}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={'Group:'}>
|
<Form.Item label="Group:">
|
||||||
<Select.AutoComplete
|
<Select.AutoComplete
|
||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
size={'medium'}
|
size={'medium'}
|
||||||
@ -1259,6 +1195,7 @@ class ConfigurationManagement extends React.Component {
|
|||||||
dataSource={this.state.groups}
|
dataSource={this.state.groups}
|
||||||
value={this.state.group}
|
value={this.state.group}
|
||||||
onChange={this.setGroup.bind(this)}
|
onChange={this.setGroup.bind(this)}
|
||||||
|
onPressEnter={() => this.getData()}
|
||||||
hasClear
|
hasClear
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -1323,6 +1260,7 @@ class ConfigurationManagement extends React.Component {
|
|||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
value={this.state.appName}
|
value={this.state.appName}
|
||||||
onChange={this.setAppName.bind(this)}
|
onChange={this.setAppName.bind(this)}
|
||||||
|
onPressEnter={() => this.getData()}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={locale.tags}>
|
<Form.Item label={locale.tags}>
|
||||||
@ -1379,31 +1317,34 @@ class ConfigurationManagement extends React.Component {
|
|||||||
{configurations.totalCount && (
|
{configurations.totalCount && (
|
||||||
<>
|
<>
|
||||||
<div style={{ float: 'left' }}>
|
<div style={{ float: 'left' }}>
|
||||||
<Button
|
{[
|
||||||
type={'primary'}
|
{
|
||||||
warning
|
warning: true,
|
||||||
style={{ marginRight: 10 }}
|
text: locale.deleteAction,
|
||||||
onClick={this.multipleSelectionDeletion.bind(this)}
|
locaid: 'configsDelete',
|
||||||
data-spm-click={'gostr=/aliyun;locaid=configsDelete'}
|
onClick: () => this.multipleSelectionDeletion(),
|
||||||
>
|
},
|
||||||
{locale.deleteAction}
|
{
|
||||||
</Button>
|
text: locale.exportSelected,
|
||||||
<Button
|
locaid: 'configsExport',
|
||||||
type={'primary'}
|
onClick: () => this.exportSelectedData(),
|
||||||
style={{ marginRight: 10 }}
|
},
|
||||||
onClick={this.exportSelectedData.bind(this)}
|
{
|
||||||
data-spm-click={'gostr=/aliyun;locaid=configsExport'}
|
text: locale.clone,
|
||||||
>
|
locaid: 'configsDelete',
|
||||||
{locale.exportSelected}
|
onClick: () => this.cloneSelectedDataConfirm(),
|
||||||
</Button>
|
},
|
||||||
<Button
|
].map(item => (
|
||||||
type={'primary'}
|
<Button
|
||||||
style={{ marginRight: 10 }}
|
warning={item.warning}
|
||||||
onClick={this.cloneSelectedDataConfirm.bind(this)}
|
type="primary"
|
||||||
data-spm-click={'gostr=/aliyun;locaid=configsClone'}
|
style={{ marginRight: 10 }}
|
||||||
>
|
onClick={item.onClick}
|
||||||
{locale.clone}
|
data-spm-click={`gostr=/aliyun;locaid=${item.locaid}`}
|
||||||
</Button>
|
>
|
||||||
|
{item.text}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<Pagination
|
<Pagination
|
||||||
style={{ float: 'right' }}
|
style={{ float: 'right' }}
|
||||||
@ -1412,7 +1353,7 @@ class ConfigurationManagement extends React.Component {
|
|||||||
pageSizeSelector="dropdown"
|
pageSizeSelector="dropdown"
|
||||||
popupProps={{ align: 'bl tl' }}
|
popupProps={{ align: 'bl tl' }}
|
||||||
onPageSizeChange={val => this.handlePageSizeChange(val)}
|
onPageSizeChange={val => this.handlePageSizeChange(val)}
|
||||||
current={this.state.currentPage}
|
current={configurations.pageNumber}
|
||||||
total={configurations.totalCount}
|
total={configurations.totalCount}
|
||||||
pageSize={this.state.pageSize}
|
pageSize={this.state.pageSize}
|
||||||
onChange={this.changePage.bind(this)}
|
onChange={this.changePage.bind(this)}
|
||||||
|
Loading…
Reference in New Issue
Block a user