diff --git a/awx/ui_next/src/screens/Host/HostDetail/HostDetail.jsx b/awx/ui_next/src/screens/Host/HostDetail/HostDetail.jsx index 8f402ead06..a705c87bdc 100644 --- a/awx/ui_next/src/screens/Host/HostDetail/HostDetail.jsx +++ b/awx/ui_next/src/screens/Host/HostDetail/HostDetail.jsx @@ -40,6 +40,8 @@ function HostDetail({ host, i18n, onUpdateHost }) { const [toggleLoading, setToggleLoading] = useState(false); const [toggleError, setToggleError] = useState(false); + const recentPlaybookJobs = recent_jobs.map(job => ({ ...job, type: 'job' })); + const handleHostToggle = async () => { setToggleLoading(true); try { @@ -107,7 +109,7 @@ function HostDetail({ host, i18n, onUpdateHost }) { } + value={} label={i18n._(t`Activity`)} /> diff --git a/awx/ui_next/src/screens/Host/HostDetail/HostDetail.test.jsx b/awx/ui_next/src/screens/Host/HostDetail/HostDetail.test.jsx index 5562a5cc05..0f1ccc037a 100644 --- a/awx/ui_next/src/screens/Host/HostDetail/HostDetail.test.jsx +++ b/awx/ui_next/src/screens/Host/HostDetail/HostDetail.test.jsx @@ -23,6 +23,7 @@ describe('', () => { user_capabilities: { edit: true, }, + recent_jobs: [], }, }; diff --git a/awx/ui_next/src/screens/Host/HostList/HostList.test.jsx b/awx/ui_next/src/screens/Host/HostList/HostList.test.jsx index e4b7060152..7328b31c9c 100644 --- a/awx/ui_next/src/screens/Host/HostList/HostList.test.jsx +++ b/awx/ui_next/src/screens/Host/HostList/HostList.test.jsx @@ -22,6 +22,7 @@ const mockHosts = [ delete: true, update: true, }, + recent_jobs: [], }, }, { @@ -38,6 +39,7 @@ const mockHosts = [ delete: true, update: true, }, + recent_jobs: [], }, }, { @@ -50,6 +52,14 @@ const mockHosts = [ id: 1, name: 'inv 1', }, + recent_jobs: [ + { + id: 123, + name: 'Bibbity Bop', + status: 'success', + finished: '2020-01-27T19:40:36.208728Z', + }, + ], user_capabilities: { delete: false, update: false, diff --git a/awx/ui_next/src/screens/Host/HostList/HostListItem.jsx b/awx/ui_next/src/screens/Host/HostList/HostListItem.jsx index 6e74f9da3b..d5523d74ff 100644 --- a/awx/ui_next/src/screens/Host/HostList/HostListItem.jsx +++ b/awx/ui_next/src/screens/Host/HostList/HostListItem.jsx @@ -38,6 +38,12 @@ class HostListItem extends React.Component { toggleLoading, i18n, } = this.props; + + const recentPlaybookJobs = host.summary_fields.recent_jobs.map(job => ({ + ...job, + type: 'job', + })); + const labelId = `check-action-${host.id}`; return ( @@ -57,7 +63,7 @@ class HostListItem extends React.Component { , - + , {host.summary_fields.inventory && ( diff --git a/awx/ui_next/src/screens/Host/HostList/HostListItem.test.jsx b/awx/ui_next/src/screens/Host/HostList/HostListItem.test.jsx index 285f71fba4..7b7b7f4385 100644 --- a/awx/ui_next/src/screens/Host/HostList/HostListItem.test.jsx +++ b/awx/ui_next/src/screens/Host/HostList/HostListItem.test.jsx @@ -19,6 +19,7 @@ const mockHost = { user_capabilities: { edit: true, }, + recent_jobs: [], }, }; diff --git a/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx index 5064ebe45b..439da004c6 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryHosts/InventoryHostItem.jsx @@ -32,6 +32,11 @@ function InventoryHostItem(props) { toggleLoading, } = props; + const recentPlaybookJobs = host.summary_fields.recent_jobs.map(job => ({ + ...job, + type: 'job', + })); + const labelId = `check-action-${host.id}`; return ( @@ -52,7 +57,7 @@ function InventoryHostItem(props) { , - + , toggleHost(host)} aria-label={i18n._(t`Toggle host`)} /> - {host.summary_fields.user_capabilities.edit && ( + {host.summary_fields.user_capabilities?.edit && (