Sha256: bf80b9003607666adc9c3dc91d15b6d99eb0bc55a41e8622c775d59dca952999

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { translate as __ } from 'foremanReact/common/I18n';

import { Table } from '../../move_to_foreman/components/common/table';
import { LoadingState } from '../../move_to_pf/LoadingState';

const ContentTable = ({ content, tableSchema, onPaginationChange }) => {
  const {
    loading, results, pagination, itemCount,
  } = content;

  const emptyStateData = {
    header: __('No Content found'),
  };

  return (
    <LoadingState
      loading={!results || loading}
      loadingText={__('Loading')}
    >
      <Table
        columns={tableSchema}
        rows={results}
        pagination={pagination}
        onPaginationChange={onPaginationChange}
        itemCount={itemCount}
        emptyState={emptyStateData}
      />
    </LoadingState>
  );
};

ContentTable.propTypes = {
  content: PropTypes.shape({
    loading: PropTypes.bool,
    // Disabling rule as existing code failed due to an eslint-plugin-react update
    // eslint-disable-next-line react/forbid-prop-types
    results: PropTypes.array,
    pagination: PropTypes.shape({}),
    itemCount: PropTypes.number,
  }).isRequired,
  onPaginationChange: PropTypes.func.isRequired,
  tableSchema: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
};


export default ContentTable;

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
katello-3.16.2 webpack/components/Content/ContentTable.js
katello-3.16.1.2 webpack/components/Content/ContentTable.js
katello-3.16.1.1 webpack/components/Content/ContentTable.js
katello-3.16.1 webpack/components/Content/ContentTable.js
katello-3.16.0 webpack/components/Content/ContentTable.js
katello-3.16.0.rc5.1 webpack/components/Content/ContentTable.js
katello-3.16.0.rc5 webpack/components/Content/ContentTable.js
katello-3.16.0.rc4.1 webpack/components/Content/ContentTable.js
katello-3.15.3.1 webpack/components/Content/ContentTable.js
katello-3.15.3 webpack/components/Content/ContentTable.js
katello-3.16.0.rc4 webpack/components/Content/ContentTable.js