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

This commit is contained in:
Adrian Sorge
2020-10-04 15:17:25 +01:00
parent bd224a75db
commit 70141f3d77

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,18 @@ 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.span`
margin-left: 24px;
&:first-of-type {
margin-left: 0;
}
`;
function InventoryListItem({ function InventoryListItem({
inventory, inventory,
isSelected, isSelected,
@@ -97,11 +110,33 @@ function InventoryListItem({
</Link> </Link>
)} )}
</DataListCell>, </DataListCell>,
<DataListCell key="kind"> <DataListCell key="kind">
{inventory.kind === 'smart' {inventory.kind === 'smart'
? 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>