feat(ui) - pagination limit set
This commit is contained in:
parent
45857a804b
commit
7e29cde06f
4 changed files with 8 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ import SessionListHeader from './SessionListHeader';
|
|||
import { FilterKey } from 'Types/filter/filterType';
|
||||
|
||||
const ALL = 'all';
|
||||
const PER_PAGE = 5;
|
||||
const PER_PAGE = 10;
|
||||
const AUTOREFRESH_INTERVAL = 3 * 60 * 1000;
|
||||
var timeoutId;
|
||||
|
||||
|
|
@ -136,6 +136,7 @@ export default class SessionList extends React.PureComponent {
|
|||
totalPages={Math.ceil(total / PER_PAGE)}
|
||||
onPageChange={(page) => this.props.updateCurrentPage(page)}
|
||||
limit={PER_PAGE}
|
||||
debounceRequest={1000}
|
||||
/>
|
||||
</div>
|
||||
{/* <LoadMoreButton
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { capitalize, sliceListPerPage } from 'App/utils';
|
|||
import LiveSessionReloadButton from 'Shared/LiveSessionReloadButton';
|
||||
|
||||
const AUTOREFRESH_INTERVAL = .5 * 60 * 1000
|
||||
const PER_PAGE = 20;
|
||||
const PER_PAGE = 10;
|
||||
|
||||
interface Props {
|
||||
loading: Boolean,
|
||||
|
|
@ -165,6 +165,7 @@ function LiveSessionList(props: Props) {
|
|||
page={currentPage}
|
||||
totalPages={Math.ceil(sessions.size / PER_PAGE)}
|
||||
onPageChange={(page) => props.updateCurrentPage(page)}
|
||||
limit={PER_PAGE}
|
||||
/>
|
||||
</div>
|
||||
</Loader>
|
||||
|
|
|
|||
|
|
@ -8,16 +8,17 @@ interface Props {
|
|||
totalPages: number
|
||||
onPageChange: (page: number) => void
|
||||
limit?: number
|
||||
debounceRequest?: number
|
||||
}
|
||||
export default function Pagination(props: Props) {
|
||||
const { page, totalPages, onPageChange, limit = 5 } = props;
|
||||
const { page, totalPages, onPageChange, limit = 5, debounceRequest = 0 } = props;
|
||||
const [currentPage, setCurrentPage] = React.useState(page);
|
||||
React.useMemo(
|
||||
() => setCurrentPage(page),
|
||||
[page],
|
||||
);
|
||||
|
||||
const debounceChange = React.useCallback(debounce(onPageChange, 1000), []);
|
||||
const debounceChange = React.useCallback(debounce(onPageChange, debounceRequest), []);
|
||||
|
||||
const changePage = (page: number) => {
|
||||
if (page > 0 && page <= totalPages) {
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ const reduceThenFetchResource = actionCreator => (...args) => (dispatch, getStat
|
|||
}
|
||||
|
||||
filter.filters = filter.filters.map(filterMap);
|
||||
filter.limit = 5;
|
||||
filter.limit = 10;
|
||||
filter.page = getState().getIn([ 'search', 'currentPage']);
|
||||
|
||||
return isRoute(ERRORS_ROUTE, window.location.pathname)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue