Skip to content

Commit

Permalink
Merge branch 'monitoring/ecs_final_es' of github.com:elastic/kibana i…
Browse files Browse the repository at this point in the history
…nto monitoring/ecs_final_es
  • Loading branch information
jasonrhodes committed Apr 23, 2021
2 parents 73d4d9d + 8cf58fd commit 9e15b90
Show file tree
Hide file tree
Showing 58 changed files with 590 additions and 415 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_containment @elastic/kibana-gis
#CC# /src/plugins/maps_legacy/ @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis
/src/plugins/tile_map/ @elastic/kibana-gis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const AnalyticsTable: React.FC<Props> = ({ items, hasClicks, isSmall }) =
<h4>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.analytics.table.empty.noQueriesTitle',
{ defaultMessage: 'No queries' }
{ defaultMessage: 'No queries to display' }
)}
</h4>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('ApiLogsTable', () => {
const wrapper = mountWithIntl(<ApiLogsTable />);
const promptContent = wrapper.find(EuiEmptyPrompt).text();

expect(promptContent).toContain('No recent logs');
expect(promptContent).toContain('Perform your first API call');
});

describe('hasPagination', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const ApiLogsTable: React.FC<Props> = ({ hasPagination }) => {
title={
<h3>
{i18n.translate('xpack.enterpriseSearch.appSearch.engine.apiLogs.emptyTitle', {
defaultMessage: 'No recent logs',
defaultMessage: 'Perform your first API call',
})}
</h3>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const CredentialsList: React.FC = () => {
title={
<h2>
{i18n.translate('xpack.enterpriseSearch.appSearch.credentials.empty.title', {
defaultMessage: 'No API Keys have been created yet.',
defaultMessage: 'Create your first API key',
})}
</h2>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { shallow } from 'enzyme';

import { EuiEmptyPrompt, EuiButton } from '@elastic/eui';

import { EmptyState } from './';

describe('EmptyState', () => {
it('renders', () => {
const wrapper = shallow(<EmptyState />)
.find(EuiEmptyPrompt)
.dive();

expect(wrapper.find('h2').text()).toEqual('Create your first curation');
expect(wrapper.find(EuiButton).prop('href')).toEqual(
expect.stringContaining('/curations-guide.html')
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { EuiButton, EuiEmptyPrompt } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { DOCS_PREFIX } from '../../../routes';

export const EmptyState: React.FC = () => (
<EuiEmptyPrompt
data-test-subj="emptyCurationsPrompt"
iconType="pin"
title={
<h2>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.empty.noCurationsTitle',
{ defaultMessage: 'Create your first curation' }
)}
</h2>
}
body={
<p>
{i18n.translate('xpack.enterpriseSearch.appSearch.engine.curations.empty.description', {
defaultMessage:
'Use curations to promote and hide documents. Help people discover what you would most like them to discover.',
})}
</p>
}
actions={
<EuiButton
size="s"
target="_blank"
iconType="popout"
href={`${DOCS_PREFIX}/curations-guide.html`}
>
{i18n.translate('xpack.enterpriseSearch.appSearch.engine.curations.empty.buttonLabel', {
defaultMessage: 'Read the curations guide',
})}
</EuiButton>
}
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,4 @@
* 2.0.
*/

/**
* Empty/Error UI states
*/
.emptyState {
min-height: $euiSizeXXL * 11.25;
display: flex;
flex-direction: column;
justify-content: center;

&__prompt > .euiIcon {
margin-bottom: $euiSizeS;
}
}
export { EmptyState } from './empty_state';
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import React from 'react';

import { shallow, ReactWrapper } from 'enzyme';

import { EuiPageHeader, EuiBasicTable, EuiEmptyPrompt } from '@elastic/eui';
import { EuiPageHeader, EuiBasicTable } from '@elastic/eui';

import { Loading } from '../../../../shared/loading';
import { EmptyState } from '../components';

import { Curations, CurationsTable } from './curations';

Expand Down Expand Up @@ -82,11 +83,12 @@ describe('Curations', () => {
});

describe('CurationsTable', () => {
it('renders an EuiEmptyPrompt if curations is empty', () => {
it('renders an empty state', () => {
setMockValues({ ...values, curations: [] });
const wrapper = shallow(<CurationsTable />);
const table = shallow(<CurationsTable />).find(EuiBasicTable);
const noItemsMessage = table.prop('noItemsMessage') as React.ReactElement;

expect(wrapper.find(EuiBasicTable).prop('noItemsMessage').type).toEqual(EuiEmptyPrompt);
expect(noItemsMessage.type).toEqual(EmptyState);
});

it('passes loading prop based on dataLoading', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import React, { useEffect } from 'react';

import { useValues, useActions } from 'kea';

import {
EuiPageHeader,
EuiPageContent,
EuiBasicTable,
EuiBasicTableColumn,
EuiEmptyPrompt,
} from '@elastic/eui';
import { EuiBasicTable, EuiBasicTableColumn, EuiPageContent, EuiPageHeader } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { EDIT_BUTTON_LABEL, DELETE_BUTTON_LABEL } from '../../../../shared/constants';
Expand All @@ -29,6 +23,7 @@ import { ENGINE_CURATIONS_NEW_PATH, ENGINE_CURATION_PATH } from '../../../routes
import { FormattedDateTime } from '../../../utils/formatted_date_time';
import { generateEnginePath } from '../../engine';

import { EmptyState } from '../components';
import { CURATIONS_OVERVIEW_TITLE, CREATE_NEW_CURATION_TITLE } from '../constants';
import { CurationsLogic } from '../curations_logic';
import { Curation } from '../types';
Expand Down Expand Up @@ -144,19 +139,7 @@ export const CurationsTable: React.FC = () => {
responsive
hasActions
loading={dataLoading}
noItemsMessage={
<EuiEmptyPrompt
iconType="pin"
title={
<h4>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.table.empty.noCurationsTitle',
{ defaultMessage: 'No curations yet' }
)}
</h4>
}
/>
}
noItemsMessage={<EmptyState />}
pagination={{
...convertMetaToPagination(meta),
hidePerPageOptions: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* 2.0.
*/

import { setMockActions } from '../../../__mocks__/kea.mock';
import { setMockActions } from '../../../../__mocks__/kea.mock';

import React from 'react';

import { shallow, ShallowWrapper } from 'enzyme';

import { EuiButton } from '@elastic/eui';

import { DocumentCreationFlyout } from '../document_creation';
import { DocumentCreationFlyout } from '../../document_creation';

import { DocumentCreationButton } from './document_creation_button';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useActions } from 'kea';
import { EuiButton } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { DocumentCreationLogic, DocumentCreationFlyout } from '../document_creation';
import { DocumentCreationLogic, DocumentCreationFlyout } from '../../document_creation';

export const DocumentCreationButton: React.FC = () => {
const { showCreationModes } = useActions(DocumentCreationLogic);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { shallow } from 'enzyme';

import { EuiEmptyPrompt, EuiButton } from '@elastic/eui';

import { EmptyState } from './';

describe('EmptyState', () => {
it('renders', () => {
const wrapper = shallow(<EmptyState />)
.find(EuiEmptyPrompt)
.dive();

expect(wrapper.find('h2').text()).toEqual('Add your first documents');
expect(wrapper.find(EuiButton).prop('href')).toEqual(
expect.stringContaining('/indexing-documents-guide.html')
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { EuiButton, EuiEmptyPrompt, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { DOCS_PREFIX } from '../../../routes';

export const EmptyState = () => (
<EuiPanel color="subdued" grow={false}>
<EuiEmptyPrompt
data-test-subj="EmptyDocumentPrompt"
iconType="documents"
title={
<h2>
{i18n.translate('xpack.enterpriseSearch.appSearch.documents.empty.title', {
defaultMessage: 'Add your first documents',
})}
</h2>
}
body={
<p>
{i18n.translate('xpack.enterpriseSearch.appSearch.documents.empty.description', {
defaultMessage:
'You can index documents using the App Search Web Crawler, by uploading JSON, or by using the API.',
})}
</p>
}
actions={
<EuiButton
size="s"
target="_blank"
iconType="popout"
href={`${DOCS_PREFIX}/indexing-documents-guide.html`}
>
{i18n.translate('xpack.enterpriseSearch.appSearch.engine.documents.empty.buttonLabel', {
defaultMessage: 'Read the documents guide',
})}
</EuiButton>
}
/>
</EuiPanel>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { DocumentCreationButton } from './document_creation_button';
export { EmptyState } from './empty_state';
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { shallow, ShallowWrapper } from 'enzyme';

import { EuiPageHeader } from '@elastic/eui';

import { DocumentCreationButton } from './document_creation_button';
import { DocumentCreationButton } from './components';
import { SearchExperience } from './search_experience';

import { Documents } from '.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { SetAppSearchChrome as SetPageChrome } from '../../../shared/kibana_chro
import { AppLogic } from '../../app_logic';
import { EngineLogic, getEngineBreadcrumbs } from '../engine';

import { DocumentCreationButton } from './components';
import { DOCUMENTS_TITLE } from './constants';
import { DocumentCreationButton } from './document_creation_button';
import { SearchExperience } from './search_experience';

export const Documents: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jest.mock('../../../../shared/use_local_storage', () => ({
}));
import { useLocalStorage } from '../../../../shared/use_local_storage';

import { EmptyState } from '../components';

import { CustomizationCallout } from './customization_callout';
import { CustomizationModal } from './customization_modal';

import { SearchExperienceContent } from './search_experience_content';
import { Fields } from './types';

import { SearchExperience } from './';
Expand All @@ -32,6 +34,7 @@ describe('SearchExperience', () => {
engine: {
name: 'some-engine',
apiKey: '1234',
document_count: 50,
},
};
const mockSetFields = jest.fn();
Expand All @@ -50,7 +53,17 @@ describe('SearchExperience', () => {

it('renders', () => {
const wrapper = shallow(<SearchExperience />);
expect(wrapper.find(SearchProvider).length).toBe(1);

expect(wrapper.find(SearchProvider)).toHaveLength(1);
expect(wrapper.find(SearchExperienceContent)).toHaveLength(1);
});

it('renders an empty state when the engine does not have documents', () => {
setMockValues({ ...values, engine: { ...values.engine, document_count: 0 } });
const wrapper = shallow(<SearchExperience />);

expect(wrapper.find(EmptyState)).toHaveLength(1);
expect(wrapper.find(SearchExperienceContent)).toHaveLength(0);
});

describe('when there are no selected filter fields', () => {
Expand Down
Loading

0 comments on commit 9e15b90

Please sign in to comment.