diff --git a/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx b/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx index bddd591274227..d568af5774e5e 100644 --- a/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx +++ b/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx @@ -25,6 +25,8 @@ import { useShowTimeline } from '../../../common/utils/timeline/use_show_timelin import { gutterTimeline } from '../../../common/lib/helpers'; import { useSourcererScope } from '../../../common/containers/sourcerer'; import { OverviewEmpty } from '../../../overview/components/overview_empty'; +import { ENDPOINT_METADATA_INDEX } from '../../../../common/constants'; +import { useFetchIndex } from '../../../common/containers/source'; /* eslint-disable react/display-name */ @@ -76,13 +78,17 @@ export const SecuritySolutionTemplateWrapper: React.FC getTimelineShowStatus(state, TimelineId.active) ); - + const endpointMetadataIndex = useMemo(() => { + return [ENDPOINT_METADATA_INDEX]; + }, []); + const [, { indexExists: metadataIndexExists }] = useFetchIndex(endpointMetadataIndex, true); const { indicesExist } = useSourcererScope(); + const securityIndicesExist = indicesExist || metadataIndexExists; /* StyledKibanaPageTemplate is a styled EuiPageTemplate. Security solution currently passes the header and page content as the children of StyledKibanaPageTemplate, as opposed to using the pageHeader prop, which may account for any style discrepancies, such as the bottom border not extending the full width of the page, between EuiPageTemplate and the security solution pages. */ - return indicesExist ? ( + return securityIndicesExist ? ( { const pageObjects = getPageObjects(['common', 'endpoint', 'header', 'endpointPageUtils']); const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); + const browser = getService('browser'); const expectedData = [ [ @@ -84,10 +85,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('finds data after load and polling', async () => { + await esArchiver.load('x-pack/test/functional/es_archives/endpoint/metadata/api_feature', { + useCreate: true, + }); await esArchiver.load( 'x-pack/test/functional/es_archives/endpoint/metadata/destination_index', { useCreate: true } ); + await browser.refresh(); await pageObjects.endpoint.waitForTableToHaveData('endpointListTable', 1100); const tableData = await pageObjects.endpointPageUtils.tableData('endpointListTable'); expect(tableData).to.eql(expectedData); @@ -96,11 +101,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('when there is data,', () => { before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/endpoint/metadata/api_feature', { + useCreate: true, + }); await esArchiver.load( 'x-pack/test/functional/es_archives/endpoint/metadata/destination_index', { useCreate: true } ); await pageObjects.endpoint.navigateToEndpointList(); + await browser.refresh(); }); after(async () => { await deleteMetadataStream(getService); @@ -215,11 +224,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('displays the correct table data for the kql queries', () => { before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/endpoint/metadata/api_feature', { + useCreate: true, + }); await esArchiver.load( 'x-pack/test/functional/es_archives/endpoint/metadata/destination_index', { useCreate: true } ); await pageObjects.endpoint.navigateToEndpointList(); + await browser.refresh(); }); after(async () => { await deleteMetadataStream(getService);