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 ( {listItems.map(({ index, title, availableContent, }) => ( {availableContent.map(content => ( ))} ))} ); } return (
{ __('No products are enabled.') }
); }; 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;