From e4fdc3820f6bfb5280c81a37224085f4cede1da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZZQ=E7=9A=84?= <33930711+zzq1314zll@users.noreply.github.com> Date: Tue, 4 Aug 2020 11:12:27 +0800 Subject: [PATCH] [ISSUE #3439] Increment console config page size (#3507) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 配置pageSize列表 #3439 * Service List Page Increase the number of pages switching function is the same as the configuration management page #3500 --- .../static/console-fe/src/constants.js | 2 + .../ConfigurationManagement.js | 4 +- .../ServiceList/ServiceList.js | 279 +++++++++--------- 3 files changed, 141 insertions(+), 144 deletions(-) diff --git a/console/src/main/resources/static/console-fe/src/constants.js b/console/src/main/resources/static/console-fe/src/constants.js index a6d112201..2dd94bd0a 100644 --- a/console/src/main/resources/static/console-fe/src/constants.js +++ b/console/src/main/resources/static/console-fe/src/constants.js @@ -38,3 +38,5 @@ export const PERMISSIONS_LIST = 'PERMISSIONS_LIST'; export const GET_NAMESPACES = 'GET_NAMESPACES'; export const GET_CONFIGURATION = 'GET_CONFIGURATION'; + +export const GLOBAL_PAGE_SIZE_LIST = [10, 20, 30, 50, 100]; diff --git a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js index 79695ffa1..4780fa99d 100644 --- a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js +++ b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js @@ -46,7 +46,7 @@ import { connect } from 'react-redux'; import { getConfigs } from '../../../reducers/configuration'; import './index.scss'; -import { LANGUAGE_KEY } from '../../../constants'; +import { LANGUAGE_KEY, GLOBAL_PAGE_SIZE_LIST } from '../../../constants'; const { Panel } = Collapse; const configsTableSelected = new Map(); @@ -1384,7 +1384,7 @@ class ConfigurationManagement extends React.Component { { this.setState({ dataSource: serviceList, total: count, + loading: false, }); }, error: () => @@ -107,6 +110,7 @@ class ServiceList extends React.Component { dataSource: [], total: 0, currentPage: 0, + loading: false, }), }); } @@ -129,6 +133,10 @@ class ServiceList extends React.Component { this.showcode.current.getInstance().openDialog(record); } + handlePageSizeChange(pageSize) { + this.setState({ pageSize }, () => this.queryServiceList()); + } + deleteService(service) { const { locale = {} } = this.props; const { prompt, promptDelete } = locale; @@ -187,156 +195,143 @@ class ServiceList extends React.Component { return (
- + +
+

+ {serviceList} + | + {nowNamespaceName} + {nowNamespaceId} +

+ -
- -
-

- {serviceList} - | - {nowNamespaceName} - {nowNamespaceId} -

- - -
- - this.setState({ search: { ...search, serviceName } })} - onPressEnter={() => - this.setState({ currentPage: 1 }, () => this.queryServiceList()) - } - /> - - - this.setState({ search: { ...search, groupName } })} - onPressEnter={() => - this.setState({ currentPage: 1 }, () => this.queryServiceList()) - } - /> - - - - this.setState({ hasIpCount, currentPage: 1 }, () => { - localStorage.setItem('hasIpCount', hasIpCount); - this.queryServiceList(); - }) - } - /> - - - - - - - -
- -
- - - this.rowColor(row)} - > - - - - - +
+ + this.setState({ search: { ...search, serviceName } })} + onPressEnter={() => + this.setState({ currentPage: 1 }, () => this.queryServiceList()) + } /> - - ( - // @author yongchao9 #2019年05月18日 下午5:46:28 - /* Add a link to view "sample code" + + + this.setState({ search: { ...search, groupName } })} + onPressEnter={() => + this.setState({ currentPage: 1 }, () => this.queryServiceList()) + } + /> + + + + this.setState({ hasIpCount, currentPage: 1 }, () => { + localStorage.setItem('hasIpCount', hasIpCount); + this.queryServiceList(); + }) + } + /> + + + + + + + + + + + +
+
this.rowColor(row)} + loading={this.state.loading} + > + + + + + + + ( + // @author yongchao9 #2019年05月18日 下午5:46:28 + /* Add a link to view "sample code" replace the original button with a label, which is consistent with the operation style in configuration management. */ - - )} - /> -
- -
- {this.state.total > this.state.pageSize && ( -
- - this.setState({ currentPage }, () => this.queryServiceList()) - } +
+ { + const { name, groupName } = record; + this.props.history.push(generateUrl('/serviceDetail', { name, groupName })); + }} + style={{ marginRight: 5 }} + > + {detail} + + | + this.showSampleCode(record)}> + {sampleCode} + + | + this.deleteService(record)} style={{ marginRight: 5 }}> + {deleteAction} + +
+ )} /> -
- )} - + + +
+
+ this.handlePageSizeChange(pageSize)} + onChange={currentPage => this.setState({ currentPage }, () => this.queryServiceList())} + /> +
+