diff --git a/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.js b/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.js index 4aba6622aa..a2eda32946 100644 --- a/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.js +++ b/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.js @@ -93,9 +93,12 @@ function JobOutputSearch({ key: 'stdout__icontains', isDefault: true, }, - { + ]; + + if (job.type !== 'system_job' && job.type !== 'inventory_update') { + columns.push({ name: t`Event`, - key: 'event', + key: 'or__event', options: [ ['runner_on_failed', t`Host Failed`], ['runner_on_start', t`Host Started`], @@ -129,9 +132,9 @@ function JobOutputSearch({ ['system_warning', t`System Warning`], ['error', t`Error`], ], - }, - { name: t`Advanced`, key: 'advanced' }, - ]; + }); + } + columns.push({ name: t`Advanced`, key: 'advanced' }); const isDisabled = isJobRunning(job.status); return ( diff --git a/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.test.js b/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.test.js index e06b575749..4b345a7e73 100644 --- a/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.test.js +++ b/awx/ui/src/screens/Job/JobOutput/JobOutputSearch.test.js @@ -23,6 +23,7 @@ describe('JobOutputSearch', () => { { await act(async () => { wrapper.find(searchBtn).simulate('click'); }); - + expect(wrapper.find('Search').prop('columns')).toHaveLength(3); + expect(wrapper.find('Search').prop('columns').at(0).name).toBe('Stdout'); + expect(wrapper.find('Search').prop('columns').at(1).name).toBe('Event'); + expect(wrapper.find('Search').prop('columns').at(2).name).toBe('Advanced'); expect(history.location.search).toEqual('?stdout__icontains=99'); }); + test('Should not have Event key in search drop down for system job', () => { + const history = createMemoryHistory({ + initialEntries: ['/jobs/playbook/1/output'], + }); + + const wrapper = mountWithContexts( + , + { + context: { router: { history } }, + } + ); + expect(wrapper.find('Search').prop('columns')).toHaveLength(2); + expect(wrapper.find('Search').prop('columns').at(0).name).toBe('Stdout'); + expect(wrapper.find('Search').prop('columns').at(1).name).toBe('Advanced'); + }); + + test('Should not have Event key in search drop down for inventory update job', () => { + const history = createMemoryHistory({ + initialEntries: ['/jobs/playbook/1/output'], + }); + + const wrapper = mountWithContexts( + , + { + context: { router: { history } }, + } + ); + expect(wrapper.find('Search').prop('columns')).toHaveLength(2); + expect(wrapper.find('Search').prop('columns').at(0).name).toBe('Stdout'); + expect(wrapper.find('Search').prop('columns').at(1).name).toBe('Advanced'); + }); });