From 01ff5c9306e168f22b0e995ed1ba8e00bc65c15c Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Mon, 22 Aug 2022 09:36:47 +0800 Subject: [PATCH] refactor: update the List component prop Change the name of the List component's property isCourier to ableSkipPageByBackend, which is used when backend paging supports page jumping. Change-Id: I1222cc3cafd49f329a47b1a23bbdf3716ceab537 --- src/components/Tables/Base/index.jsx | 12 +++++++----- src/containers/List/index.jsx | 12 ++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/Tables/Base/index.jsx b/src/components/Tables/Base/index.jsx index 1a1d8bcd..7c9821de 100644 --- a/src/components/Tables/Base/index.jsx +++ b/src/components/Tables/Base/index.jsx @@ -82,6 +82,7 @@ export class BaseTable extends React.Component { timeFilter: PropTypes.any, isPageByBack: PropTypes.bool, isSortByBack: PropTypes.bool, + ableSkipPageByBackend: PropTypes.bool, autoRefresh: PropTypes.bool, hideRefresh: PropTypes.bool, hideAutoRefresh: PropTypes.bool, @@ -120,6 +121,7 @@ export class BaseTable extends React.Component { hideDownload: false, primaryActionsExtra: null, isAdminPage: false, + ableSkipPageByBackend: false, }; constructor(props) { @@ -199,9 +201,9 @@ export class BaseTable extends React.Component { sortOrder: sorter.order, ...filters, }; - const { isCourier, isPageByBack } = this.props; + const { ableSkipPageByBackend, isPageByBack } = this.props; if (action === 'sort') { - if (!(isCourier || !isPageByBack)) { + if (isPageByBack && !ableSkipPageByBackend) { const { pagination: propsPagination } = this.props; params = { ...params, @@ -866,7 +868,7 @@ export class BaseTable extends React.Component { scrollY, expandable, isPageByBack = true, - isCourier, + ableSkipPageByBackend, childrenColumnName, // scrollX, } = this.props; @@ -875,7 +877,7 @@ export class BaseTable extends React.Component { const props = {}; const newPagination = - isCourier || !isPageByBack + ableSkipPageByBackend || !isPageByBack ? { ...pagination, size: 'small', @@ -885,7 +887,7 @@ export class BaseTable extends React.Component { if (!hideHeader) { props.title = this.renderTableTitle; } - const footer = !(isCourier || !isPageByBack) + const footer = !(ableSkipPageByBackend || !isPageByBack) ? this.renderTableFooter : null; diff --git a/src/containers/List/index.jsx b/src/containers/List/index.jsx index 6b7af294..bbe958ff 100644 --- a/src/containers/List/index.jsx +++ b/src/containers/List/index.jsx @@ -306,11 +306,11 @@ export default class BaseList extends React.Component { return false; } - get isCourier() { - /* If it is courier and it is back-end paging, - then a page footer with a number is required, - because Courier has its own paging and can jump pages, - while openstack does not support page jumping. */ + get ableSkipPageByBackend() { + /* If th back-end api can skip page and it is back-end paging, + then a page footer with a number is required, the front-end can + show all pages and can skip to any page number, + while most openstack api does not support page jumping. */ return false; } @@ -527,7 +527,7 @@ export default class BaseList extends React.Component { filterTimeDefaultValue: this.filterTimeDefaultValue, isPageByBack: this.isFilterByBackend, isSortByBack: this.isSortByBackend, - isCourier: this.isCourier, + ableSkipPageByBackend: this.ableSkipPageByBackend, autoRefresh, startRefreshAuto: this.startRefreshAuto, stopRefreshAuto: this.onStopRefreshAuto,