Sha256: eea5bccc83b06f0dfe9d1a3796427a4bff8d68a6761f3d7a086e3ba64a04b440

Contents?: true

Size: 1.54 KB

Versions: 68

Compression:

Stored size: 1.54 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Col, ListView } from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';
import SubscriptionDetailProduct from './SubscriptionDetailProduct';

const SubscriptionDetailProductContent = ({ productContent }) => {
  const listItems = productContent.results.map(product => ({
    index: product.id,
    title: product.name,
    availableContent: (
      product.available_content.map(c => (
        {
          enabled: c.enabled,
          ...c.content,
        }
      ))
    ),
  }));

  if (listItems.length > 0) {
    return (
      <ListView>
        {listItems.map(({
              index,
              title,
              availableContent,
            }) => (
              <ListView.Item
                key={index}
                heading={title}
                hideCloseIcon
              >

                <Col sm={12}>
                  {availableContent.map(content => (
                    <SubscriptionDetailProduct key={content.id} content={content} />
                  ))}
                </Col>
              </ListView.Item>
        ))}
      </ListView>
    );
  }

  return (
    <div>{ __('No products are enabled.') }</div>
  );
};

SubscriptionDetailProductContent.propTypes = {
  productContent: PropTypes.shape({
    // Disabling rule as existing code failed due to an eslint-plugin-react update
    // eslint-disable-next-line react/forbid-prop-types
    results: PropTypes.array,
  }).isRequired,
};

export default SubscriptionDetailProductContent;

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
katello-4.3.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.4.0.rc1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.2 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.3.0 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.3.0.rc4 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.3.0.rc3 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.3.0.rc2.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.3.0.rc2 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.3.0.rc1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.0.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.1.4 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.0.3 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.0.1.rc3 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-3.18.5 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.0.1.rc2 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.0.rc2 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.1.3 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.2.0.rc1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js
katello-4.0.2.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js