import React, { useState } from 'react'; import { ListView } from 'patternfly-react'; import PropTypes from 'prop-types'; import Pagination from 'foremanReact/components/Pagination/PaginationWrapper'; import { useForemanSettings } from 'foremanReact/Root/Context/ForemanContext'; import PreupgradeReportEntry from './components/PreupgradeReportEntry'; import PreupgradeReportsListHeader from './components/PreupgradeReportsListHeader'; import { entriesPage } from '../PreupgradeReports/PreupgradeReportsHelpers'; import './PreupgradeReportList.scss'; const PreupgradeReportsList = ({ allEntries, isSelected, toggleSelected, sort, changeSort, toggleSelectAll, }) => { const { perPage, perPageOptions } = useForemanSettings(); const [pagination, setPagination] = useState({ page: 1, perPage, perPageOptions, }); return ( {entriesPage(allEntries, pagination).map((entry, idx) => ( ))} setPagination({ ...pagination, ...newPage })} dropdownButtonId="preupgrade-report-entries-pagination-dropdown" /> ); }; PreupgradeReportsList.propTypes = { allEntries: PropTypes.array.isRequired, isSelected: PropTypes.func.isRequired, toggleSelected: PropTypes.func.isRequired, sort: PropTypes.object.isRequired, changeSort: PropTypes.func.isRequired, toggleSelectAll: PropTypes.func.isRequired, }; export default PreupgradeReportsList;