Sha256: 664e9a19b09deaeb27124063fd81566e1b0855db9a183b81950ebcedf977284d

Contents?: true

Size: 1.03 KB

Versions: 38

Compression:

Stored size: 1.03 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { FlexItem } from '@patternfly/react-core';
import Pagination from 'foremanReact/components/Pagination';

import { getPageStats } from './helpers';

const PageControls = ({
  variant, total, page, perPage, onPaginationUpdate,
}) => {
  const { firstIndex, lastIndex } = getPageStats({ total, page, perPage });
  return (
    <FlexItem align={{ default: 'alignRight' }}>
      <Pagination
        ouiaId={`pagination-${variant}`}
        key={variant}
        itemCount={total}
        itemsStart={firstIndex}
        itemsEnd={lastIndex}
        page={page}
        perPage={perPage}
        onChange={onPaginationUpdate}
        variant={variant}
      />
    </FlexItem>
  );
};

export default PageControls;

PageControls.propTypes = {
  variant: PropTypes.string.isRequired,
  total: PropTypes.number,
  page: PropTypes.number,
  perPage: PropTypes.number,
  onPaginationUpdate: PropTypes.func.isRequired,
};

PageControls.defaultProps = {
  total: 0,
  page: 1,
  perPage: 20,
};

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
katello-4.14.0.rc1.1 webpack/components/Table/PageControls.js
katello-4.14.0.rc1 webpack/components/Table/PageControls.js
katello-4.13.1 webpack/components/Table/PageControls.js
katello-4.13.0 webpack/components/Table/PageControls.js
katello-4.12.1 webpack/components/Table/PageControls.js
katello-4.13.0.rc1 webpack/components/Table/PageControls.js
katello-4.12.0 webpack/components/Table/PageControls.js
katello-4.12.0.rc3 webpack/components/Table/PageControls.js
katello-4.12.0.rc2 webpack/components/Table/PageControls.js
katello-4.12.0.rc1 webpack/components/Table/PageControls.js
katello-4.11.1 webpack/components/Table/PageControls.js
katello-4.11.0 webpack/components/Table/PageControls.js
katello-4.11.0.rc2 webpack/components/Table/PageControls.js
katello-4.11.0.rc1 webpack/components/Table/PageControls.js
katello-4.10.0 webpack/components/Table/PageControls.js
katello-4.9.2 webpack/components/Table/PageControls.js
katello-4.10.0.rc2 webpack/components/Table/PageControls.js
katello-4.10.0.rc1 webpack/components/Table/PageControls.js
katello-4.8.4 webpack/components/Table/PageControls.js
katello-4.9.1 webpack/components/Table/PageControls.js