You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/01/07 09:55:55 UTC
[incubator-shenyu-dashboard] branch master updated: FIX some paging bugs in the addition and modification of the AppAuth (#175)
This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new f684a22 FIX some paging bugs in the addition and modification of the AppAuth (#175)
f684a22 is described below
commit f684a2257461b984a3839fdbe36df5aa39d89cf4
Author: 李宗洋 <41...@users.noreply.github.com>
AuthorDate: Fri Jan 7 17:55:48 2022 +0800
FIX some paging bugs in the addition and modification of the AppAuth (#175)
---
src/routes/System/AppAuth/AddModal.js | 19 +++++++++++++------
src/routes/System/AppAuth/AddTable.js | 13 ++++++++++---
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/routes/System/AppAuth/AddModal.js b/src/routes/System/AppAuth/AddModal.js
index 170f9cb..e8117f4 100644
--- a/src/routes/System/AppAuth/AddModal.js
+++ b/src/routes/System/AppAuth/AddModal.js
@@ -116,9 +116,9 @@ class AddModal extends Component {
};
handleDeletePath = (index) => {
- let { pathDatas } = this.state;
+ let { pathDatas, pagination } = this.state;
if (pathDatas && pathDatas.length > 1) {
- pathDatas.splice(index, 1);
+ pathDatas.splice(index + (pagination-1)*10, 1);
} else {
message.destroy();
message.error("At least one app path");
@@ -127,10 +127,16 @@ class AddModal extends Component {
};
handleTableInput = (value, index) => {
- let { pathDatas } = this.state;
- pathDatas[index].path = value;
+ let { pathDatas, pagination } = this.state;
+ pathDatas[index + (pagination-1)*10].path = value;
this.setState({ pathDatas });
- }
+ };
+
+ handleTableChange = paginationObj => {
+ this.setState({
+ pagination: paginationObj.current,
+ });
+ };
render() {
let {
@@ -282,8 +288,9 @@ class AddModal extends Component {
bordered
columns={columns}
dataSource={this.state.pathDatas}
+ onChange={this.handleTableChange}
rowKey={(record, index) => index}
- pagination={{ current: 1, pageSize: 10 }}
+ pagination={{ current: this.state.pagination, pageSize: 10 }}
/>
</div>
)}
diff --git a/src/routes/System/AppAuth/AddTable.js b/src/routes/System/AppAuth/AddTable.js
index b1d17ee..ab9133f 100644
--- a/src/routes/System/AppAuth/AddTable.js
+++ b/src/routes/System/AppAuth/AddTable.js
@@ -54,7 +54,7 @@ class AddTable extends Component {
dataIndex: 'operation',
render: (text, record) =>
this.state.allData.length > 1 ? (
- <Popconfirm title={getIntlContent("SHENYU.COMMON.DELETE")} onConfirm={() => this.handleDelete(record.key)}>
+ <Popconfirm title={getIntlContent("SHENYU.COMMON.DELETE")} onConfirm={() => this.handleDelete(record.path)}>
<a>{getIntlContent("SHENYU.COMMON.DELETE.NAME")}</a>
</Popconfirm>
) : null,
@@ -132,7 +132,7 @@ class AddTable extends Component {
handleDelete = (key) => {
// const allData = [...this.state.allData];
this.setState((prev) => ({
- allData: prev.allData.filter((item) => item.key !== key),
+ allData: prev.allData.filter((item) => item.path !== key),
}));
};
@@ -159,6 +159,12 @@ class AddTable extends Component {
this.setState({pathTableVisible: checked});
}
+ handleTableChange = paginationObj => {
+ this.setState({
+ pagination: paginationObj.current,
+ });
+ };
+
render() {
let {
handleCancel,
@@ -295,8 +301,9 @@ class AddTable extends Component {
bordered
columns={columns}
dataSource={data}
+ onChange={this.handleTableChange}
rowKey={record => record.id}
- pagination={{ current: 1, pageSize: 10 }}
+ pagination={{ current: this.state.pagination, pageSize: 10 }}
/>
</div>
)}