fix config list sort and search problem (#5223)

This commit is contained in:
haoyann 2021-03-29 12:02:37 +08:00 committed by GitHub
parent 5146fad227
commit 6ce150371d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 20 deletions

View File

@ -223,11 +223,25 @@ class ConfigurationManagement extends React.Component {
navTo(url, record) {
this.serverId = getParams('serverId') || '';
this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数
this.props.history.push(
`${url}?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${
record.group
}&namespace=${this.tenant}`
);
switch (url) {
case '/historyRollback':
url = `${url}?historyServerId=${this.serverId || ''}&historyDataId=${
record.dataId
}&historyGroup=${record.group}&namespace=${this.tenant}`;
break;
case '/listeningToQuery':
url = `${url}?listeningServerId=${this.serverId || ''}&listeningDataId=${
record.dataId
}&listeningGroup=${record.group}&namespace=${this.tenant}`;
break;
case '/pushTrajectory':
url = `${url}?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${
record.group
}&namespace=${this.tenant}`;
break;
default:
}
this.props.history.push(url);
}
openLoading() {
@ -442,12 +456,14 @@ class ConfigurationManagement extends React.Component {
}
onChangeSort(dataIndex, order) {
this.dataSource.sort(function(a, b) {
const { configurations = {} } = this.props;
configurations.pageItems.sort(function(a, b) {
if (order === 'asc') {
return (a[dataIndex] + '').localeCompare(b[dataIndex] + '');
}
return (b[dataIndex] + '').localeCompare(a[dataIndex] + '');
});
this.forceUpdate();
}
handlePageSizeChange(pageSize) {
@ -1411,7 +1427,7 @@ class ConfigurationManagement extends React.Component {
ref="dataTable"
loading={this.state.loading}
rowSelection={this.state.rowSelection}
onSort={this.onChangeSort}
onSort={this.onChangeSort.bind(this)}
>
<Table.Column sortable={true} title={'Data Id'} dataIndex={'dataId'} />
<Table.Column sortable={true} title={'Group'} dataIndex={'group'} />

View File

@ -37,12 +37,12 @@ class HistoryRollback extends React.Component {
this.field = new Field(this);
this.appName = getParams('appName') || '';
this.preAppName = this.appName;
this.group = getParams('group') || '';
this.group = getParams('historyGroup') || '';
this.preGroup = this.group;
this.dataId = getParams('dataId') || '';
this.dataId = getParams('historyDataId') || '';
this.preDataId = this.dataId;
this.serverId = getParams('serverId') || '';
this.serverId = getParams('historyServerId') || '';
this.state = {
value: '',
visible: false,
@ -59,13 +59,6 @@ class HistoryRollback extends React.Component {
selectValue: [],
loading: false,
};
const obj = {
dataId: this.dataId || '',
group: this.preGroup || '',
appName: this.appName || '',
serverId: this.serverId || '',
};
setParams(obj);
}
componentDidMount() {

View File

@ -55,9 +55,9 @@ class ListeningToQuery extends React.Component {
dataSource: [],
};
this.field = new Field(this);
this.group = getParams('group') || '';
this.dataId = getParams('dataId') || '';
this.serverId = getParams('serverId') || '';
this.group = getParams('listeningGroup') || '';
this.dataId = getParams('listeningDataId') || '';
this.serverId = getParams('listeningServerId') || '';
this.tenant = getParams('namespace') || '';
}