Skip to content

Commit

Permalink
Restore Host Activity to Host Lists
Browse files Browse the repository at this point in the history
  • Loading branch information
cigamit committed Mar 19, 2024
1 parent a39ac49 commit 70a5b02
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 33 deletions.
1 change: 1 addition & 0 deletions awx/ui/src/screens/Host/HostList/HostList.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ function HostList() {
headerRow={
<HeaderRow qsConfig={QS_CONFIG} isExpandable>
<HeaderCell sortKey="name">{t`Name`}</HeaderCell>
<HeaderCell>{t`Activity`}</HeaderCell>
<HeaderCell sortKey="description">{t`Description`}</HeaderCell>
<HeaderCell>{t`Inventory`}</HeaderCell>
<HeaderCell>{t`Actions`}</HeaderCell>
Expand Down
37 changes: 4 additions & 33 deletions awx/ui/src/screens/Host/HostList/HostListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { string, bool, func } from 'prop-types';

import { t } from '@lingui/macro';
import { Button } from '@patternfly/react-core';
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
import { Tr, Td } from '@patternfly/react-table';
import { Link } from 'react-router-dom';
import { PencilAltIcon } from '@patternfly/react-icons';
import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable';
import { Host } from 'types';
import HostToggle from 'components/HostToggle';
import { DetailList, Detail } from 'components/DetailList';
import Sparkline from 'components/Sparkline';

function HostListItem({
Expand All @@ -19,8 +18,6 @@ function HostListItem({
onSelect,
detailUrl,
rowIndex,
isExpanded,
onExpand,
}) {
const labelId = `check-action-${host.id}`;

Expand All @@ -29,15 +26,7 @@ function HostListItem({
} = host;

return (
<>
<Tr id={`host-row-${host.id}`} ouiaId={`host-row-${host.id}`}>
<Td
expand={{
rowIndex,
isExpanded,
onToggle: onExpand,
}}
/>
<Td
data-cy={labelId}
select={{
Expand All @@ -52,6 +41,9 @@ function HostListItem({
<b>{host.name}</b>
</Link>
</TdBreakWord>
<Td>
{recentJobs.length > 0 ? (<Sparkline jobs={recentJobs} />) : (t`No job data available`)}
</Td>
<TdBreakWord
id={`host-description-${host.id}}`}
dataLabel={t`Description`}
Expand Down Expand Up @@ -85,27 +77,6 @@ function HostListItem({
</ActionItem>
</ActionsTd>
</Tr>
<Tr ouiaId={`host-row-${host.id}-expanded`} isExpanded={isExpanded}>
<Td colSpan={2} />
<Td colSpan={4}>
<ExpandableRowContent>
<DetailList gutter="sm">
<Detail
dataCy={`${host.name}-activity`}
label={t`Activity`}
value={
recentJobs.length > 0 ? (
<Sparkline jobs={recentJobs} />
) : (
t`No job data available`
)
}
/>
</DetailList>
</ExpandableRowContent>
</Td>
</Tr>
</>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import HostToggle from 'components/HostToggle';
import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable';
import useRequest, { useDismissableError } from 'hooks/useRequest';
import { Host } from 'types';
import Sparkline from 'components/Sparkline';

function InventoryHostItem({
detailUrl,
Expand All @@ -28,6 +29,10 @@ function InventoryHostItem({
count: 0,
};

const {
summary_fields: { recent_jobs: recentJobs = [] },
} = host;

const {
error,
request: fetchRelatedGroups,
Expand Down Expand Up @@ -65,6 +70,9 @@ function InventoryHostItem({
<b>{host.name}</b>
</Link>
</TdBreakWord>
<Td>
{recentJobs.length > 0 ? (<Sparkline jobs={recentJobs} />) : (t`No job data available`)}
</Td>
<TdBreakWord
id={`host-description-${host.id}`}
dataLabel={t`Description`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function InventoryHostList() {
headerRow={
<HeaderRow qsConfig={QS_CONFIG}>
<HeaderCell sortKey="name">{t`Name`}</HeaderCell>
<HeaderCell>{t`Activity`}</HeaderCell>
<HeaderCell sortKey="description">{t`Description`}</HeaderCell>
<HeaderCell>{t`Related Groups`}</HeaderCell>
<HeaderCell>{t`Actions`}</HeaderCell>
Expand Down

0 comments on commit 70a5b02

Please sign in to comment.