diff --git a/awx/ui_next/src/components/HostToggle/HostToggle.jsx b/awx/ui_next/src/components/HostToggle/HostToggle.jsx index 4a7b03d55a..4212fa5bdc 100644 --- a/awx/ui_next/src/components/HostToggle/HostToggle.jsx +++ b/awx/ui_next/src/components/HostToggle/HostToggle.jsx @@ -47,7 +47,11 @@ function HostToggle({ return ( - + - ( @@ -188,7 +175,15 @@ function ResourceAccessList({ apiModel, resource }) { } /> )} - renderItem={accessRecord => ( + headerRow={ + + {t`Username`} + {t`First name`} + {t`Last name`} + {t`Roles`} + + } + renderRow={(accessRecord, index) => ( )} /> diff --git a/awx/ui_next/src/components/ResourceAccessList/ResourceAccessListItem.jsx b/awx/ui_next/src/components/ResourceAccessList/ResourceAccessListItem.jsx index 24b9f11fd4..9c913df54d 100644 --- a/awx/ui_next/src/components/ResourceAccessList/ResourceAccessListItem.jsx +++ b/awx/ui_next/src/components/ResourceAccessList/ResourceAccessListItem.jsx @@ -3,27 +3,14 @@ import React from 'react'; import { func } from 'prop-types'; import { t } from '@lingui/macro'; -import { - Chip, - DataListItem, - DataListItemRow, - DataListItemCells as PFDataListItemCells, - Text, - TextContent, - TextVariants, -} from '@patternfly/react-core'; +import { Chip } from '@patternfly/react-core'; +import { Tr, Td } from '@patternfly/react-table'; import { Link } from 'react-router-dom'; -import styled from 'styled-components'; -import DataListCell from '../DataListCell'; import ChipGroup from '../ChipGroup'; import { DetailList, Detail } from '../DetailList'; import { AccessRecord } from '../../types'; -const DataListItemCells = styled(PFDataListItemCells)` - align-items: start; -`; - function ResourceAccessListItem({ accessRecord, onRoleDelete }) { ResourceAccessListItem.propTypes = { accessRecord: AccessRecord.isRequired, @@ -67,70 +54,43 @@ function ResourceAccessListItem({ accessRecord, onRoleDelete }) { const [teamRoles, userRoles] = getRoleLists(); return ( - - - - {accessRecord.username && ( - - {accessRecord.id ? ( - - - {accessRecord.username} - - - ) : ( - - {accessRecord.username} - - )} - - )} - {accessRecord.first_name || accessRecord.last_name ? ( - - - - ) : null} - , - - - {userRoles.length > 0 && ( - - {userRoles.map(renderChip)} - - } - /> - )} - {teamRoles.length > 0 && ( - - {teamRoles.map(renderChip)} - - } - /> - )} - - , - ]} - /> - - + + + {accessRecord.id ? ( + + {accessRecord.username} + + ) : ( + accessRecord.username + )} + + {accessRecord.first_name} + {accessRecord.first_name} + + + {userRoles.length > 0 && ( + + {userRoles.map(renderChip)} + + } + /> + )} + {teamRoles.length > 0 && ( + + {teamRoles.map(renderChip)} + + } + /> + )} + + + ); } diff --git a/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx index ee75b8cf1c..5b821f80f6 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx @@ -2,83 +2,55 @@ import React from 'react'; import { string, bool, func } from 'prop-types'; import { t } from '@lingui/macro'; -import { - Button, - DataListAction as _DataListAction, - DataListCheck, - DataListItem, - DataListItemCells, - DataListItemRow, - Tooltip, -} from '@patternfly/react-core'; +import { Button, Tooltip } from '@patternfly/react-core'; +import { Tr, Td } from '@patternfly/react-table'; import { Link } from 'react-router-dom'; import { PencilAltIcon } from '@patternfly/react-icons'; -import styled from 'styled-components'; -import DataListCell from '../../../components/DataListCell'; +import { ActionsTd } from '../../../components/PaginatedTable'; import HostToggle from '../../../components/HostToggle'; -import Sparkline from '../../../components/Sparkline'; import { Host } from '../../../types'; -const DataListAction = styled(_DataListAction)` - align-items: center; - display: grid; - grid-gap: 24px; - grid-template-columns: min-content 40px; -`; - -function InventoryHostItem(props) { - const { detailUrl, editUrl, host, isSelected, onSelect } = props; - - const recentPlaybookJobs = host.summary_fields.recent_jobs.map(job => ({ - ...job, - type: 'job', - })); - +function InventoryHostItem({ + detailUrl, + editUrl, + host, + isSelected, + onSelect, + rowIndex, +}) { const labelId = `check-action-${host.id}`; return ( - - - - - - {host.name} - - , - - - , - ]} - /> - - - {host.summary_fields.user_capabilities?.edit && ( - - - - )} - - - + + + + + {host.name} + + + + + {host.summary_fields.user_capabilities?.edit && ( + + + + )} + + ); } diff --git a/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostList.jsx b/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostList.jsx index da1ccef87b..75eac089b6 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostList.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostList.jsx @@ -8,7 +8,11 @@ import useRequest, { useDeleteItems } from '../../../util/useRequest'; import AlertModal from '../../../components/AlertModal'; import DataListToolbar from '../../../components/DataListToolbar'; import ErrorDetail from '../../../components/ErrorDetail'; -import PaginatedDataList, { +import PaginatedTable, { + HeaderRow, + HeaderCell, +} from '../../../components/PaginatedTable'; +import { ToolbarAddButton, ToolbarDeleteButton, } from '../../../components/PaginatedDataList'; @@ -105,35 +109,21 @@ function InventoryHostList() { return ( <> - + {t`Name`} + {t`Actions`} + + } renderToolbar={props => ( )} - renderItem={o => ( + renderRow={(host, index) => ( row.id === o.id)} - onSelect={() => handleSelect(o)} + key={host.id} + host={host} + detailUrl={`/inventories/inventory/${id}/hosts/${host.id}/details`} + editUrl={`/inventories/inventory/${id}/hosts/${host.id}/edit`} + isSelected={selected.some(row => row.id === host.id)} + onSelect={() => handleSelect(host)} + rowIndex={index} /> )} emptyStateControls={