diff --git a/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx b/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx index d75fca31ce4d8..2082689cb6e1a 100644 --- a/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx @@ -8,10 +8,9 @@ import React from 'react'; import { EuiBasicTable } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { NoData } from '../../../../components/empty_states'; +import { EuiEmptyPrompt } from '@elastic/eui'; import { HostNodeRow, useHostsTableContext } from '../hooks/use_hosts_table'; import { useHostsViewContext } from '../hooks/use_hosts_view'; -import { useUnifiedSearchContext } from '../hooks/use_unified_search'; import { FlyoutWrapper } from './host_details_flyout/flyout_wrapper'; import { DEFAULT_PAGE_SIZE } from '../constants'; import { FilterAction } from './table/filter_action'; @@ -20,7 +19,6 @@ const PAGE_SIZE_OPTIONS = [5, 10, 20]; export const HostsTable = () => { const { loading } = useHostsViewContext(); - const { onSubmit } = useUnifiedSearchContext(); const { columns, @@ -75,18 +73,21 @@ export const HostsTable = () => { defaultMessage: 'Loading data', }) ) : ( - onSubmit()} - testString="noMetricsDataPrompt" + data-test-subj="hostsViewTableNoData" + layout="vertical" + title={ +

+ {i18n.translate('xpack.infra.waffle.noDataTitle', { + defaultMessage: 'There is no data to display.', + })} +

+ } + hasBorder={false} + titleSize="m" /> ) } diff --git a/x-pack/test/functional/apps/infra/hosts_view.ts b/x-pack/test/functional/apps/infra/hosts_view.ts index a7c0ba54298fc..3a5b5a0156d5e 100644 --- a/x-pack/test/functional/apps/infra/hosts_view.ts +++ b/x-pack/test/functional/apps/infra/hosts_view.ts @@ -587,6 +587,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.infraHostsView.submitQuery('cloud.provider="gcp" A'); await testSubjects.existOrFail('hostsViewErrorCallout'); }); + + it('should show no data message in the table content', async () => { + await pageObjects.infraHostsView.submitQuery('host.name : "foo"'); + + await waitForPageToLoad(); + + await retry.try(async () => { + await testSubjects.exists('hostsViewTableNoData'); + }); + }); }); describe('Pagination and Sorting', () => {