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, timeFilter: PropTypes.any,
isPageByBack: PropTypes.bool, isPageByBack: PropTypes.bool,
isSortByBack: PropTypes.bool, isSortByBack: PropTypes.bool,
ableSkipPageByBackend: PropTypes.bool,
autoRefresh: PropTypes.bool, autoRefresh: PropTypes.bool,
hideRefresh: PropTypes.bool, hideRefresh: PropTypes.bool,
hideAutoRefresh: PropTypes.bool, hideAutoRefresh: PropTypes.bool,
@ -120,6 +121,7 @@ export class BaseTable extends React.Component {
hideDownload: false, hideDownload: false,
primaryActionsExtra: null, primaryActionsExtra: null,
isAdminPage: false, isAdminPage: false,
ableSkipPageByBackend: false,
}; };
constructor(props) { constructor(props) {
@ -199,9 +201,9 @@ export class BaseTable extends React.Component {
sortOrder: sorter.order, sortOrder: sorter.order,
...filters, ...filters,
}; };
const { isCourier, isPageByBack } = this.props; const { ableSkipPageByBackend, isPageByBack } = this.props;
if (action === 'sort') { if (action === 'sort') {
if (!(isCourier || !isPageByBack)) { if (isPageByBack && !ableSkipPageByBackend) {
const { pagination: propsPagination } = this.props; const { pagination: propsPagination } = this.props;
params = { params = {
...params, ...params,
@ -866,7 +868,7 @@ export class BaseTable extends React.Component {
scrollY, scrollY,
expandable, expandable,
isPageByBack = true, isPageByBack = true,
isCourier, ableSkipPageByBackend,
childrenColumnName, childrenColumnName,
// scrollX, // scrollX,
} = this.props; } = this.props;
@ -875,7 +877,7 @@ export class BaseTable extends React.Component {
const props = {}; const props = {};
const newPagination = const newPagination =
isCourier || !isPageByBack ableSkipPageByBackend || !isPageByBack
? { ? {
...pagination, ...pagination,
size: 'small', size: 'small',
@ -885,7 +887,7 @@ export class BaseTable extends React.Component {
if (!hideHeader) { if (!hideHeader) {
props.title = this.renderTableTitle; props.title = this.renderTableTitle;
} }
const footer = !(isCourier || !isPageByBack) const footer = !(ableSkipPageByBackend || !isPageByBack)
? this.renderTableFooter ? this.renderTableFooter
: null; : null;

View File

@ -306,11 +306,11 @@ export default class BaseList extends React.Component {
return false; return false;
} }
get isCourier() { get ableSkipPageByBackend() {
/* If it is courier and it is back-end paging, /* If th back-end api can skip page and it is back-end paging,
then a page footer with a number is required, then a page footer with a number is required, the front-end can
because Courier has its own paging and can jump pages, show all pages and can skip to any page number,
while openstack does not support page jumping. */ while most openstack api does not support page jumping. */
return false; return false;
} }
@ -527,7 +527,7 @@ export default class BaseList extends React.Component {
filterTimeDefaultValue: this.filterTimeDefaultValue, filterTimeDefaultValue: this.filterTimeDefaultValue,
isPageByBack: this.isFilterByBackend, isPageByBack: this.isFilterByBackend,
isSortByBack: this.isSortByBackend, isSortByBack: this.isSortByBackend,
isCourier: this.isCourier, ableSkipPageByBackend: this.ableSkipPageByBackend,
autoRefresh, autoRefresh,
startRefreshAuto: this.startRefreshAuto, startRefreshAuto: this.startRefreshAuto,
stopRefreshAuto: this.onStopRefreshAuto, stopRefreshAuto: this.onStopRefreshAuto,