diff --git a/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx b/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx index 7db0bae778..cc4b44dc72 100644 --- a/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx +++ b/awx/ui_next/src/components/DataListToolbar/DataListToolbar.jsx @@ -20,6 +20,7 @@ import { SearchColumns, SortColumns, QSConfig } from '../../types'; class DataListToolbar extends React.Component { render() { const { + itemCount, clearAllFilters, searchColumns, sortColumns, @@ -36,6 +37,7 @@ class DataListToolbar extends React.Component { additionalControls, i18n, qsConfig, + pagination, } = this.props; const showExpandCollapse = onCompact && onExpand; @@ -90,6 +92,9 @@ class DataListToolbar extends React.Component { {control} ))} + {pagination && itemCount > 0 && ( + {pagination} + )} ); @@ -97,6 +102,7 @@ class DataListToolbar extends React.Component { } DataListToolbar.propTypes = { + itemCount: PropTypes.number, clearAllFilters: PropTypes.func, qsConfig: QSConfig.isRequired, searchColumns: SearchColumns.isRequired, @@ -114,6 +120,7 @@ DataListToolbar.propTypes = { }; DataListToolbar.defaultProps = { + itemCount: 0, clearAllFilters: null, showSelectAll: false, isAllSelected: false, diff --git a/awx/ui_next/src/components/ListHeader/ListHeader.jsx b/awx/ui_next/src/components/ListHeader/ListHeader.jsx index f1ac2a5ae8..305c741a47 100644 --- a/awx/ui_next/src/components/ListHeader/ListHeader.jsx +++ b/awx/ui_next/src/components/ListHeader/ListHeader.jsx @@ -98,6 +98,7 @@ class ListHeader extends React.Component { renderToolbar, qsConfig, location, + pagination, } = this.props; const params = parseQueryString(qsConfig, location.search); const isEmpty = itemCount === 0 && Object.keys(params).length === 0; @@ -118,6 +119,7 @@ class ListHeader extends React.Component { ) : ( {renderToolbar({ + itemCount, searchColumns, sortColumns, onSearch: this.handleSearch, @@ -126,6 +128,7 @@ class ListHeader extends React.Component { onRemove: this.handleRemove, clearAllFilters: this.handleRemoveAll, qsConfig, + pagination, })} )} diff --git a/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.jsx b/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.jsx index e69775fd6f..d25ad79e6b 100644 --- a/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.jsx +++ b/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.jsx @@ -121,6 +121,28 @@ class PaginatedDataList extends React.Component { ); } + const ToolbarPagination = ( + + ); + return ( {Content} {items.length ? ( diff --git a/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.test.jsx b/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.test.jsx index b3a60aa2da..fe4b85b0b0 100644 --- a/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.test.jsx +++ b/awx/ui_next/src/components/PaginatedDataList/PaginatedDataList.test.jsx @@ -55,7 +55,7 @@ describe('', () => { { context: { router: { history } } } ); - const pagination = wrapper.find('Pagination'); + const pagination = wrapper.find('Pagination').at(1); pagination.prop('onSetPage')(null, 2); expect(history.location.search).toEqual('?item.page=2'); wrapper.update(); @@ -82,7 +82,7 @@ describe('', () => { { context: { router: { history } } } ); - const pagination = wrapper.find('Pagination'); + const pagination = wrapper.find('Pagination').at(1); pagination.prop('onPerPageSelect')(null, 25, 2); expect(history.location.search).toEqual('?item.page=2&item.page_size=25'); wrapper.update();