Sha256: 3f73d49ef3bbb2579dda5162e4a88c7048f8bed1e5ddcac25a776c0cb8ba2f49

Contents?: true

Size: 1.88 KB

Versions: 10

Compression:

Stored size: 1.88 KB

Contents

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 (
    <ListView id="preupgrade-report-entries-list-view">
      <PreupgradeReportsListHeader
        sort={sort}
        changeSort={changeSort}
        toggleSelectAll={toggleSelectAll}
      />
      {entriesPage(allEntries, pagination).map((entry, idx) => (
        <PreupgradeReportEntry
          entry={entry}
          key={idx}
          isEntrySelected={isSelected(entry)}
          toggleSelected={toggleSelected}
        />
      ))}
      <Pagination
        viewType="list"
        itemCount={allEntries.length}
        pagination={pagination}
        onChange={newPage => setPagination({ ...pagination, ...newPage })}
        dropdownButtonId="preupgrade-report-entries-pagination-dropdown"
      />
    </ListView>
  );
};

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;

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_leapp-0.1.9 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.8 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.7 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.6 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.5 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.4 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.3 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.2 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.1 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.0 webpack/components/PreupgradeReportsList/index.js