Sha256: afdb5dce34a57e0c40e5b2c3ab84d04ab1a2cfe8b4fdba083749c2a2b8af8702

Contents?: true

Size: 1.77 KB

Versions: 17

Compression:

Stored size: 1.77 KB

Contents

import React, { useState } from 'react';
import { ListView } from 'patternfly-react';
import PropTypes from 'prop-types';

import Pagination from 'foremanReact/components/Pagination';
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,
    per_page: 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}
        onChange={newPage => setPagination({ ...pagination, ...newPage })}
      />
    </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

17 entries across 17 versions & 1 rubygems

Version Path
foreman_leapp-1.2.3 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-2.0.3 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-2.0.2 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-1.2.2 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-2.0.1 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-2.0.0 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-1.2.1 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-1.2.0 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.15 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-1.1.1 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-1.1.0 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-1.0.0 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.14 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.13 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.12 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.11 webpack/components/PreupgradeReportsList/index.js
foreman_leapp-0.1.10 webpack/components/PreupgradeReportsList/index.js