From 70141f3d771031861bc6b098afe593a9593897b6 Mon Sep 17 00:00:00 2001 From: Adrian Sorge Date: Sun, 4 Oct 2020 15:17:25 +0100 Subject: [PATCH 1/4] Added Groups/Hosts/Sources count to inventory list rows #7674 --- .../InventoryList/InventoryListItem.jsx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx index 1974827032..5c6add4b21 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx @@ -10,6 +10,7 @@ import { DataListItemRow, Label, Tooltip, + Badge as PFBadge, } from '@patternfly/react-core'; import { PencilAltIcon } from '@patternfly/react-icons'; import { t } from '@lingui/macro'; @@ -29,6 +30,18 @@ const DataListAction = styled(_DataListAction)` 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({ inventory, isSelected, @@ -97,11 +110,33 @@ function InventoryListItem({ )} , + {inventory.kind === 'smart' ? i18n._(t`Smart Inventory`) : i18n._(t`Inventory`)} , + + + {i18n._(t`Groups`)} + + {inventory.total_groups} + + + + {i18n._(t`Hosts`)} + + {inventory.total_hosts} + + + + {i18n._(t`Sources`)} + + {inventory.total_inventory_sources} + + + , + inventory.pending_deletion && ( From 7b13a42daad5e1315454b3b92b041b1cde687602 Mon Sep 17 00:00:00 2001 From: Adrian Sorge Date: Mon, 5 Oct 2020 17:49:21 +0100 Subject: [PATCH 2/4] Fixed Suggestions from Code Review --- .../screens/Inventory/InventoryList/InventoryListItem.jsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx index 5c6add4b21..936103c72f 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx @@ -36,10 +36,6 @@ const Badge = styled(PFBadge)` const ListGroup = styled.span` margin-left: 24px; - - &:first-of-type { - margin-left: 0; - } `; function InventoryListItem({ @@ -110,7 +106,6 @@ function InventoryListItem({ )} , - {inventory.kind === 'smart' ? i18n._(t`Smart Inventory`) @@ -136,7 +131,6 @@ function InventoryListItem({ , - inventory.pending_deletion && ( From d4e4e3020c62b99df7d3002d689a30da21d324c2 Mon Sep 17 00:00:00 2001 From: Adrian Sorge Date: Mon, 5 Oct 2020 18:02:54 +0100 Subject: [PATCH 3/4] changes of npm run prettier --- .../Inventory/InventoryList/InventoryListItem.jsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx index 936103c72f..2513e471b6 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx @@ -114,21 +114,15 @@ function InventoryListItem({ {i18n._(t`Groups`)} - - {inventory.total_groups} - + {inventory.total_groups} {i18n._(t`Hosts`)} - - {inventory.total_hosts} - + {inventory.total_hosts} {i18n._(t`Sources`)} - - {inventory.total_inventory_sources} - + {inventory.total_inventory_sources} , inventory.pending_deletion && ( From 8f37afeec45ff8f587898ee2aea076ffd86be8ea Mon Sep 17 00:00:00 2001 From: Adrian Sorge Date: Sat, 10 Oct 2020 14:21:19 +0100 Subject: [PATCH 4/4] Changed Listgroup to div --- .../screens/Inventory/InventoryList/InventoryListItem.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx index 2513e471b6..6d18102d40 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx @@ -34,8 +34,9 @@ const Badge = styled(PFBadge)` margin-left: 8px; `; -const ListGroup = styled.span` - margin-left: 24px; +const ListGroup = styled.div` + margin-left: 8px; + display: inline-block; `; function InventoryListItem({