Merge "refactor: update the List component prop"

This commit is contained in:
Zuul 2022-08-22 08:48:32 +00:00 committed by Gerrit Code Review
commit 62ed058ebf
2 changed files with 13 additions and 11 deletions

View File

@ -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;

View File

@ -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,