Sha256: d2dc3d306839bab64f30b1585723958a3600d10e0eae9357f635833a8a524ab7

Contents?: true

Size: 1.28 KB

Versions: 49

Compression:

Stored size: 1.28 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { translate as __ } from 'foremanReact/common/I18n';
import { List, ListItem } from '@patternfly/react-core';
import CardTemplate from 'foremanReact/components/HostDetails/Templates/CardItem/CardTemplate';

const InstalledProductsCard = ({ isExpandedGlobal, hostDetails }) => {
  const installedProducts = hostDetails?.subscription_facet_attributes?.installed_products;
  if (!installedProducts?.length) return null;
  return (
    <CardTemplate
      header={__('Installed products')}
      expandable
      masonryLayout
      isExpandedGlobal={isExpandedGlobal}
    >
      <List isPlain>
        {installedProducts.map(product => (
          <ListItem key={product.productId}>
            {product.productName}
          </ListItem>
        ))}
      </List>
    </CardTemplate>
  );
};

InstalledProductsCard.propTypes = {
  isExpandedGlobal: PropTypes.bool,
  hostDetails: PropTypes.shape({
    subscription_facet_attributes: PropTypes.shape({
      installed_products: PropTypes.arrayOf(PropTypes.shape({
        productId: PropTypes.string,
        productName: PropTypes.string,
      })),
    }),
  }),
};

InstalledProductsCard.defaultProps = {
  isExpandedGlobal: false,
  hostDetails: {},
};

export default InstalledProductsCard;

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
katello-4.15.0.rc2 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.15.0.rc1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.14.1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.14.0 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.14.0.rc3 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.14.0.rc2 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.14.0.rc1.1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.14.0.rc1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.13.1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.13.0 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.12.1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.13.0.rc1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.12.0 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.12.0.rc3 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.12.0.rc2 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.12.0.rc1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.11.1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.11.0 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.11.0.rc2 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
katello-4.11.0.rc1 webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js