Merge pull request #8319 from asohh/devel

Added Groups/Hosts/Sources count to inventory list rows #7674

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-10-13 15:10:36 +00:00
committed by GitHub

View File

@@ -10,6 +10,7 @@ import {
DataListItemRow, DataListItemRow,
Label, Label,
Tooltip, Tooltip,
Badge as PFBadge,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import { PencilAltIcon } from '@patternfly/react-icons'; import { PencilAltIcon } from '@patternfly/react-icons';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
@@ -29,6 +30,15 @@ const DataListAction = styled(_DataListAction)`
grid-template-columns: repeat(2, 40px); grid-template-columns: repeat(2, 40px);
`; `;
const Badge = styled(PFBadge)`
margin-left: 8px;
`;
const ListGroup = styled.div`
margin-left: 8px;
display: inline-block;
`;
function InventoryListItem({ function InventoryListItem({
inventory, inventory,
isSelected, isSelected,
@@ -102,6 +112,20 @@ function InventoryListItem({
? i18n._(t`Smart Inventory`) ? i18n._(t`Smart Inventory`)
: i18n._(t`Inventory`)} : i18n._(t`Inventory`)}
</DataListCell>, </DataListCell>,
<DataListCell key="groups-hosts-sources-counts">
<ListGroup>
{i18n._(t`Groups`)}
<Badge isRead>{inventory.total_groups}</Badge>
</ListGroup>
<ListGroup>
{i18n._(t`Hosts`)}
<Badge isRead>{inventory.total_hosts}</Badge>
</ListGroup>
<ListGroup>
{i18n._(t`Sources`)}
<Badge isRead>{inventory.total_inventory_sources}</Badge>
</ListGroup>
</DataListCell>,
inventory.pending_deletion && ( inventory.pending_deletion && (
<DataListCell alignRight isFilled={false} key="pending-delete"> <DataListCell alignRight isFilled={false} key="pending-delete">
<Label color="red">{i18n._(t`Pending delete`)}</Label> <Label color="red">{i18n._(t`Pending delete`)}</Label>