diff --git a/awx/ui/src/screens/Credential/CredentialList/CredentialList.js b/awx/ui/src/screens/Credential/CredentialList/CredentialList.js index 4eff5f9439..30090f5d94 100644 --- a/awx/ui/src/screens/Credential/CredentialList/CredentialList.js +++ b/awx/ui/src/screens/Credential/CredentialList/CredentialList.js @@ -49,9 +49,8 @@ function CredentialList() { CredentialsAPI.readOptions(), ]); const searchKeys = getSearchableKeys(credActions.data.actions?.GET); - const item = searchKeys.indexOf('type'); - if (item) { - searchKeys[item] = 'credential_type__kind'; + if (credActions.data.actions?.GET.type) { + searchKeys.push({ key: 'credential_type__kind', type: 'string' }); } return { credentials: creds.data.results, diff --git a/awx/ui/src/screens/Inventory/InventorySources/InventorySourceList.js b/awx/ui/src/screens/Inventory/InventorySources/InventorySourceList.js index 52f24c678b..b83a72c055 100644 --- a/awx/ui/src/screens/Inventory/InventorySources/InventorySourceList.js +++ b/awx/ui/src/screens/Inventory/InventorySources/InventorySourceList.js @@ -14,6 +14,7 @@ import PaginatedTable, { ToolbarAddButton, ToolbarDeleteButton, ToolbarSyncSourceButton, + getSearchableKeys, } from 'components/PaginatedTable'; import useSelected from 'hooks/useSelected'; import DatalistToolbar from 'components/DataListToolbar'; @@ -57,9 +58,7 @@ function InventorySourceList() { sourceCount: results[0].data.count, sourceChoices: results[1].data.actions.GET.source.choices, sourceChoicesOptions: results[1].data.actions, - searchableKeys: Object.keys(results[1].data.actions?.GET || {}).filter( - (key) => results[1].data.actions?.GET[key].filterable - ), + searchableKeys: getSearchableKeys(results[1].data.actions?.GET), relatedSearchableKeys: ( results[1]?.data?.related_search_fields || [] ).map((val) => val.slice(0, -8)), diff --git a/awx/ui/src/screens/Job/JobOutput/JobOutput.js b/awx/ui/src/screens/Job/JobOutput/JobOutput.js index 87f900aee1..c8c8759941 100644 --- a/awx/ui/src/screens/Job/JobOutput/JobOutput.js +++ b/awx/ui/src/screens/Job/JobOutput/JobOutput.js @@ -115,8 +115,8 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) { const [jobStatus, setJobStatus] = useState(job.status ?? 'waiting'); const [forceFlatMode, setForceFlatMode] = useState(false); - const isFlatMode = isJobRunning(jobStatus) || location.search.length > 1; - + const isFlatMode = + isJobRunning(jobStatus) || location.search.length > 1 || job.type !== 'job'; const [isTreeReady, setIsTreeReady] = useState(false); const [onReadyEvents, setOnReadyEvents] = useState([]); diff --git a/awx/ui/src/screens/Job/JobOutput/useJobEvents.js b/awx/ui/src/screens/Job/JobOutput/useJobEvents.js index 5f2002912b..c3f894279e 100644 --- a/awx/ui/src/screens/Job/JobOutput/useJobEvents.js +++ b/awx/ui/src/screens/Job/JobOutput/useJobEvents.js @@ -49,6 +49,7 @@ export default function useJobEvents(callbacks, jobId, isFlatMode) { useEffect(() => { if (isFlatMode) { + callbacks.setJobTreeReady(); return; } diff --git a/awx/ui/src/screens/Job/JobOutput/useJobEvents.test.js b/awx/ui/src/screens/Job/JobOutput/useJobEvents.test.js index 1e398b7b3d..dd34ed4c85 100644 --- a/awx/ui/src/screens/Job/JobOutput/useJobEvents.test.js +++ b/awx/ui/src/screens/Job/JobOutput/useJobEvents.test.js @@ -5,7 +5,6 @@ import useJobEvents, { jobEventsReducer, ADD_EVENTS, TOGGLE_NODE_COLLAPSED, - SET_EVENT_NUM_CHILDREN, } from './useJobEvents'; function Child() { @@ -16,6 +15,7 @@ function HookTest({ fetchChildrenSummary = () => {}, setForceFlatMode = () => {}, setJobTreeReady = () => {}, + jobId = 1, isFlatMode = false, }) { const hookFuncs = useJobEvents( @@ -25,6 +25,7 @@ function HookTest({ setForceFlatMode, setJobTreeReady, }, + jobId, isFlatMode ); return ; @@ -1295,18 +1296,24 @@ describe('useJobEvents', () => { describe('getTotalNumChildren', () => { let wrapper; - beforeEach(() => { + + test('should not make call to get child events, because there are none for this job type', () => { wrapper = shallow(); wrapper.find('#test').prop('addEvents')(eventsList); + expect(callbacks.fetchChildrenSummary).not.toBeCalled(); }); test('should get basic number of children', () => { + wrapper = shallow(); + wrapper.find('#test').prop('addEvents')(eventsList); expect( wrapper.find('#test').prop('getTotalNumChildren')('abc-002') ).toEqual(3); }); test('should get total number of nested children', () => { + wrapper = shallow(); + wrapper.find('#test').prop('addEvents')(eventsList); expect( wrapper.find('#test').prop('getTotalNumChildren')('abc-001') ).toEqual(8); diff --git a/awx/ui/src/screens/User/UserOrganizations/UserOrganizationList.js b/awx/ui/src/screens/User/UserOrganizations/UserOrganizationList.js index a67ff5fa77..80519cbcbe 100644 --- a/awx/ui/src/screens/User/UserOrganizations/UserOrganizationList.js +++ b/awx/ui/src/screens/User/UserOrganizations/UserOrganizationList.js @@ -5,6 +5,7 @@ import { t } from '@lingui/macro'; import PaginatedTable, { HeaderRow, HeaderCell, + getSearchableKeys, } from 'components/PaginatedTable'; import useRequest from 'hooks/useRequest'; import { UsersAPI } from 'api'; @@ -40,9 +41,7 @@ function UserOrganizationList() { UsersAPI.readOrganizationOptions(id), ]); return { - searchableKeys: Object.keys(actions.data.actions?.GET || {}).filter( - (key) => actions.data.actions?.GET[key].filterable - ), + searchableKeys: getSearchableKeys(actions.data.actions?.GET), relatedSearchableKeys: (actions?.data?.related_search_fields || []).map( (val) => val.slice(0, -8) ),