-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #34816 - Add Installed Products card (#10075)
- Loading branch information
1 parent
ffda83f
commit a26097c
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 | ||
overrideGridProps={{ rowSpan: 2 }} | ||
header={__('Installed products')} | ||
expandable | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters