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) { navTo(url, record) {
this.serverId = getParams('serverId') || ''; this.serverId = getParams('serverId') || '';
this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数 this.tenant = getParams('namespace') || ''; // 为当前实例保存tenant参数
this.props.history.push( switch (url) {
`${url}?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${ case '/historyRollback':
record.group url = `${url}?historyServerId=${this.serverId || ''}&historyDataId=${
}&namespace=${this.tenant}` 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() { openLoading() {
@ -442,12 +456,14 @@ class ConfigurationManagement extends React.Component {
} }
onChangeSort(dataIndex, order) { onChangeSort(dataIndex, order) {
this.dataSource.sort(function(a, b) { const { configurations = {} } = this.props;
configurations.pageItems.sort(function(a, b) {
if (order === 'asc') { if (order === 'asc') {
return (a[dataIndex] + '').localeCompare(b[dataIndex] + ''); return (a[dataIndex] + '').localeCompare(b[dataIndex] + '');
} }
return (b[dataIndex] + '').localeCompare(a[dataIndex] + ''); return (b[dataIndex] + '').localeCompare(a[dataIndex] + '');
}); });
this.forceUpdate();
} }
handlePageSizeChange(pageSize) { handlePageSizeChange(pageSize) {
@ -1411,7 +1427,7 @@ class ConfigurationManagement extends React.Component {
ref="dataTable" ref="dataTable"
loading={this.state.loading} loading={this.state.loading}
rowSelection={this.state.rowSelection} 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={'Data Id'} dataIndex={'dataId'} />
<Table.Column sortable={true} title={'Group'} dataIndex={'group'} /> <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.field = new Field(this);
this.appName = getParams('appName') || ''; this.appName = getParams('appName') || '';
this.preAppName = this.appName; this.preAppName = this.appName;
this.group = getParams('group') || ''; this.group = getParams('historyGroup') || '';
this.preGroup = this.group; this.preGroup = this.group;
this.dataId = getParams('dataId') || ''; this.dataId = getParams('historyDataId') || '';
this.preDataId = this.dataId; this.preDataId = this.dataId;
this.serverId = getParams('serverId') || ''; this.serverId = getParams('historyServerId') || '';
this.state = { this.state = {
value: '', value: '',
visible: false, visible: false,
@ -59,13 +59,6 @@ class HistoryRollback extends React.Component {
selectValue: [], selectValue: [],
loading: false, loading: false,
}; };
const obj = {
dataId: this.dataId || '',
group: this.preGroup || '',
appName: this.appName || '',
serverId: this.serverId || '',
};
setParams(obj);
} }
componentDidMount() { componentDidMount() {

View File

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