mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Enterprise Search] Move Elasticsearch guide to a standalone app (#132750)
* Move the Elasticsearch guide to a standalone app * Add breadcumbs, title * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * Test fixes * Updated telemetry * Undo unintentional change Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b75896981b
commit
a6b394d557
42 changed files with 561 additions and 19 deletions
|
@ -135,6 +135,7 @@ export const applicationUsageSchema = {
|
|||
canvas: commonSchema,
|
||||
enterpriseSearch: commonSchema,
|
||||
enterpriseSearchContent: commonSchema,
|
||||
elasticsearch: commonSchema,
|
||||
appSearch: commonSchema,
|
||||
workplaceSearch: commonSchema,
|
||||
graph: commonSchema,
|
||||
|
|
|
@ -2354,6 +2354,137 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"elasticsearch": {
|
||||
"properties": {
|
||||
"appId": {
|
||||
"type": "keyword",
|
||||
"_meta": {
|
||||
"description": "The application being tracked"
|
||||
}
|
||||
},
|
||||
"viewId": {
|
||||
"type": "keyword",
|
||||
"_meta": {
|
||||
"description": "Always `main`"
|
||||
}
|
||||
},
|
||||
"clicks_total": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the application since we started counting them"
|
||||
}
|
||||
},
|
||||
"clicks_7_days": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the application over the last 7 days"
|
||||
}
|
||||
},
|
||||
"clicks_30_days": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the application over the last 30 days"
|
||||
}
|
||||
},
|
||||
"clicks_90_days": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the application over the last 90 days"
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_total": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen since we started counting them."
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_7_days": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen over the last 7 days"
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_30_days": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen over the last 30 days"
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_90_days": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen over the last 90 days"
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"properties": {
|
||||
"appId": {
|
||||
"type": "keyword",
|
||||
"_meta": {
|
||||
"description": "The application being tracked"
|
||||
}
|
||||
},
|
||||
"viewId": {
|
||||
"type": "keyword",
|
||||
"_meta": {
|
||||
"description": "The application view being tracked"
|
||||
}
|
||||
},
|
||||
"clicks_total": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the application sub view since we started counting them"
|
||||
}
|
||||
},
|
||||
"clicks_7_days": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the active application sub view over the last 7 days"
|
||||
}
|
||||
},
|
||||
"clicks_30_days": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the active application sub view over the last 30 days"
|
||||
}
|
||||
},
|
||||
"clicks_90_days": {
|
||||
"type": "long",
|
||||
"_meta": {
|
||||
"description": "General number of clicks in the active application sub view over the last 90 days"
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_total": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application sub view is active and on-screen since we started counting them."
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_7_days": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_30_days": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
|
||||
}
|
||||
},
|
||||
"minutes_on_screen_90_days": {
|
||||
"type": "float",
|
||||
"_meta": {
|
||||
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"appSearch": {
|
||||
"properties": {
|
||||
"appId": {
|
||||
|
|
|
@ -39,6 +39,22 @@ export const ENTERPRISE_SEARCH_CONTENT_PLUGIN = {
|
|||
SUPPORT_URL: 'https://discuss.elastic.co/c/enterprise-search/',
|
||||
};
|
||||
|
||||
export const ELASTICSEARCH_PLUGIN = {
|
||||
ID: 'elasticsearch',
|
||||
NAME: i18n.translate('xpack.enterpriseSearch.elasticsearch.productName', {
|
||||
defaultMessage: 'Elasticsearch',
|
||||
}),
|
||||
DESCRIPTION: i18n.translate('xpack.enterpriseSearch.elasticsearch.productDescription', {
|
||||
defaultMessage: 'Low-level tools for creating performant and relevant search experiences.',
|
||||
}),
|
||||
CARD_DESCRIPTION: i18n.translate('xpack.enterpriseSearch.elasticsearch.productCardDescription', {
|
||||
defaultMessage:
|
||||
'Design and build performant, relevant search-powered applications or large-scale search implementations directly in Elasticsearch.',
|
||||
}),
|
||||
URL: '/app/enterprise_search/elasticsearch',
|
||||
SUPPORT_URL: 'https://discuss.elastic.co/c/elastic-stack/elasticsearch/',
|
||||
};
|
||||
|
||||
export const APP_SEARCH_PLUGIN = {
|
||||
ID: 'appSearch',
|
||||
NAME: i18n.translate('xpack.enterpriseSearch.appSearch.productName', {
|
||||
|
|
|
@ -25,6 +25,7 @@ import { i18n } from '@kbn/i18n';
|
|||
|
||||
import { docLinks } from '../../../shared/doc_links';
|
||||
import { ElasticsearchResources } from '../../../shared/elasticsearch_resources';
|
||||
import { SetElasticsearchChrome as SetPageChrome } from '../../../shared/kibana_chrome';
|
||||
|
||||
import { ElasticsearchClientInstructions } from '../elasticsearch_client_instructions';
|
||||
import { ElasticsearchCloudId } from '../elasticsearch_cloud_id';
|
||||
|
@ -61,6 +62,7 @@ export const ElasticsearchGuide: React.FC = () => {
|
|||
|
||||
return (
|
||||
<EuiPageTemplate>
|
||||
<SetPageChrome />
|
||||
<EuiFlexGroup alignItems="flexStart">
|
||||
{/* maxWidth is needed to prevent code blocks with long unbreakable strings (Kibana PR Cloud ID) from stretching the column */}
|
||||
<EuiFlexItem grow={3} style={{ maxWidth: 800 }}>
|
|
@ -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 { useEnterpriseSearchElasticsearchNav } from './nav';
|
||||
export { EnterpriseSearchElasticsearchPageTemplate } from './page_template';
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
jest.mock('../../../shared/layout', () => ({
|
||||
generateNavLink: jest.fn(({ to, items }) => ({ href: to, items })),
|
||||
}));
|
||||
|
||||
import { useEnterpriseSearchElasticsearchNav } from '.';
|
||||
|
||||
describe('useEnterpriseSearchElasticsearchNav', () => {
|
||||
it('returns an array of top-level Enterprise Search nav items', () => {
|
||||
expect(useEnterpriseSearchElasticsearchNav()).toEqual([
|
||||
{
|
||||
id: 'es_overview',
|
||||
name: 'Overview',
|
||||
emphasize: true,
|
||||
isSelected: true,
|
||||
href: '/app/enterprise_search/overview',
|
||||
},
|
||||
{
|
||||
id: 'content',
|
||||
name: 'Content',
|
||||
emphasize: true,
|
||||
href: '/app/enterprise_search/content',
|
||||
},
|
||||
{
|
||||
id: 'elasticsearch',
|
||||
name: 'Elasticsearch',
|
||||
emphasize: true,
|
||||
href: '/app/enterprise_search/elasticsearch',
|
||||
},
|
||||
{
|
||||
id: 'app_search',
|
||||
name: 'App Search',
|
||||
emphasize: true,
|
||||
href: '/app/enterprise_search/app_search',
|
||||
},
|
||||
{
|
||||
id: 'workplace_search',
|
||||
name: 'Workplace Search',
|
||||
emphasize: true,
|
||||
href: '/app/enterprise_search/workplace_search',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* 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 { EuiSideNavItemType } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import {
|
||||
APP_SEARCH_PLUGIN,
|
||||
ELASTICSEARCH_PLUGIN,
|
||||
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN,
|
||||
ENTERPRISE_SEARCH_CONTENT_PLUGIN,
|
||||
WORKPLACE_SEARCH_PLUGIN,
|
||||
} from '../../../../../common/constants';
|
||||
import { generateNavLink } from '../../../shared/layout';
|
||||
|
||||
export const useEnterpriseSearchElasticsearchNav = () => {
|
||||
const navItems: Array<EuiSideNavItemType<unknown>> = [
|
||||
{
|
||||
id: 'es_overview',
|
||||
isSelected: true,
|
||||
emphasize: true,
|
||||
name: i18n.translate('xpack.enterpriseSearch.content.nav.enterpriseSearchOverviewTitle', {
|
||||
defaultMessage: 'Overview',
|
||||
}),
|
||||
href: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.URL,
|
||||
},
|
||||
{
|
||||
id: 'content',
|
||||
emphasize: true,
|
||||
name: i18n.translate('xpack.enterpriseSearch.content.nav.contentTitle', {
|
||||
defaultMessage: 'Content',
|
||||
}),
|
||||
...generateNavLink({
|
||||
to: ENTERPRISE_SEARCH_CONTENT_PLUGIN.URL,
|
||||
shouldNotCreateHref: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'elasticsearch',
|
||||
emphasize: true,
|
||||
name: i18n.translate('xpack.enterpriseSearch.elasticsearch.nav.contentTitle', {
|
||||
defaultMessage: 'Elasticsearch',
|
||||
}),
|
||||
...generateNavLink({
|
||||
to: ELASTICSEARCH_PLUGIN.URL,
|
||||
shouldNotCreateHref: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'app_search',
|
||||
emphasize: true,
|
||||
name: i18n.translate('xpack.enterpriseSearch.content.nav.appSearchTitle', {
|
||||
defaultMessage: 'App Search',
|
||||
}),
|
||||
...generateNavLink({
|
||||
to: APP_SEARCH_PLUGIN.URL,
|
||||
shouldNotCreateHref: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'workplace_search',
|
||||
emphasize: true,
|
||||
name: i18n.translate('xpack.enterpriseSearch.content.nav.workplaceSearchTitle', {
|
||||
defaultMessage: 'Workplace Search',
|
||||
}),
|
||||
...generateNavLink({
|
||||
to: WORKPLACE_SEARCH_PLUGIN.URL,
|
||||
shouldNotCreateHref: true,
|
||||
}),
|
||||
},
|
||||
];
|
||||
|
||||
return navItems;
|
||||
};
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
jest.mock('./nav', () => ({
|
||||
useEnterpriseSearchElasticsearchNav: () => [],
|
||||
}));
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { SetElasticsearchChrome } from '../../../shared/kibana_chrome';
|
||||
import { EnterpriseSearchPageTemplateWrapper } from '../../../shared/layout';
|
||||
import { SendEnterpriseSearchTelemetry } from '../../../shared/telemetry';
|
||||
|
||||
import { EnterpriseSearchElasticsearchPageTemplate } from './page_template';
|
||||
|
||||
describe('EnterpriseSearchElasticsearchPageTemplate', () => {
|
||||
it('renders', () => {
|
||||
const wrapper = shallow(
|
||||
<EnterpriseSearchElasticsearchPageTemplate>
|
||||
<div className="hello">world</div>
|
||||
</EnterpriseSearchElasticsearchPageTemplate>
|
||||
);
|
||||
|
||||
expect(wrapper.type()).toEqual(EnterpriseSearchPageTemplateWrapper);
|
||||
expect(wrapper.prop('solutionNav')).toEqual({ name: 'Elasticsearch', items: [] });
|
||||
expect(wrapper.find('.hello').text()).toEqual('world');
|
||||
});
|
||||
|
||||
describe('page chrome', () => {
|
||||
it('takes a breadcrumb array & renders a product-specific page chrome', () => {
|
||||
const wrapper = shallow(
|
||||
<EnterpriseSearchElasticsearchPageTemplate pageChrome={['Some page']} />
|
||||
);
|
||||
const setPageChrome = wrapper
|
||||
.find(EnterpriseSearchPageTemplateWrapper)
|
||||
.prop('setPageChrome') as any;
|
||||
|
||||
expect(setPageChrome.type).toEqual(SetElasticsearchChrome);
|
||||
expect(setPageChrome.props.trail).toEqual(['Some page']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('page telemetry', () => {
|
||||
it('takes a metric & renders product-specific telemetry viewed event', () => {
|
||||
const wrapper = shallow(
|
||||
<EnterpriseSearchElasticsearchPageTemplate pageViewTelemetry="some_page" />
|
||||
);
|
||||
|
||||
expect(wrapper.find(SendEnterpriseSearchTelemetry).prop('action')).toEqual('viewed');
|
||||
expect(wrapper.find(SendEnterpriseSearchTelemetry).prop('metric')).toEqual('some_page');
|
||||
});
|
||||
});
|
||||
|
||||
describe('props', () => {
|
||||
it('passes down any ...pageTemplateProps that EnterpriseSearchPageTemplateWrapper accepts', () => {
|
||||
const wrapper = shallow(
|
||||
<EnterpriseSearchElasticsearchPageTemplate
|
||||
pageHeader={{ pageTitle: 'hello world' }}
|
||||
isLoading={false}
|
||||
emptyState={<div />}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(
|
||||
wrapper.find(EnterpriseSearchPageTemplateWrapper).prop('pageHeader')!.pageTitle
|
||||
).toEqual('hello world');
|
||||
expect(wrapper.find(EnterpriseSearchPageTemplateWrapper).prop('isLoading')).toEqual(false);
|
||||
expect(wrapper.find(EnterpriseSearchPageTemplateWrapper).prop('emptyState')).toEqual(<div />);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 { ELASTICSEARCH_PLUGIN } from '../../../../../common/constants';
|
||||
import { SetElasticsearchChrome } from '../../../shared/kibana_chrome';
|
||||
import { EnterpriseSearchPageTemplateWrapper, PageTemplateProps } from '../../../shared/layout';
|
||||
import { SendEnterpriseSearchTelemetry } from '../../../shared/telemetry';
|
||||
|
||||
import { useEnterpriseSearchElasticsearchNav } from './nav';
|
||||
|
||||
export const EnterpriseSearchElasticsearchPageTemplate: React.FC<PageTemplateProps> = ({
|
||||
children,
|
||||
pageChrome,
|
||||
pageViewTelemetry,
|
||||
...pageTemplateProps
|
||||
}) => {
|
||||
return (
|
||||
<EnterpriseSearchPageTemplateWrapper
|
||||
{...pageTemplateProps}
|
||||
solutionNav={{
|
||||
name: ELASTICSEARCH_PLUGIN.NAME,
|
||||
items: useEnterpriseSearchElasticsearchNav(),
|
||||
}}
|
||||
setPageChrome={pageChrome && <SetElasticsearchChrome trail={pageChrome} />}
|
||||
>
|
||||
{pageViewTelemetry && (
|
||||
<SendEnterpriseSearchTelemetry action="viewed" metric={pageViewTelemetry} />
|
||||
)}
|
||||
{children}
|
||||
</EnterpriseSearchPageTemplateWrapper>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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 { setMockValues } from '../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { ElasticsearchGuide } from './components/elasticsearch_guide';
|
||||
|
||||
import { Elasticsearch } from '.';
|
||||
|
||||
describe('Elasticsearch', () => {
|
||||
it('renders the Elasticsearch setup guide', () => {
|
||||
setMockValues({
|
||||
errorConnectingMessage: '',
|
||||
config: { host: 'localhost' },
|
||||
});
|
||||
const wrapper = shallow(<Elasticsearch />);
|
||||
|
||||
expect(wrapper.find(ElasticsearchGuide)).toHaveLength(1);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 { Route, Switch } from 'react-router-dom';
|
||||
|
||||
import { isVersionMismatch } from '../../../common/is_version_mismatch';
|
||||
import { InitialAppData } from '../../../common/types';
|
||||
import { VersionMismatchPage } from '../shared/version_mismatch';
|
||||
|
||||
import { ElasticsearchGuide } from './components/elasticsearch_guide';
|
||||
|
||||
import { ROOT_PATH } from './routes';
|
||||
|
||||
export const Elasticsearch: React.FC<InitialAppData> = (props) => {
|
||||
const { enterpriseSearchVersion, kibanaVersion } = props;
|
||||
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);
|
||||
|
||||
const showView = () => {
|
||||
if (incompatibleVersions) {
|
||||
return (
|
||||
<VersionMismatchPage
|
||||
enterpriseSearchVersion={enterpriseSearchVersion}
|
||||
kibanaVersion={kibanaVersion}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <ElasticsearchGuide />;
|
||||
};
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
<Route exact path={ROOT_PATH}>
|
||||
{showView()}
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* 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 const ROOT_PATH = '/';
|
|
@ -11,9 +11,9 @@ import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle, EuiSpacer } fro
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { ELASTICSEARCH_PLUGIN } from '../../../../../common/constants';
|
||||
import { ElasticsearchResources } from '../../../shared/elasticsearch_resources';
|
||||
import { EuiButtonTo } from '../../../shared/react_router_helpers';
|
||||
import { ELASTICSEARCH_GUIDE_PATH } from '../../routes';
|
||||
|
||||
export const ElasticsearchCard: React.FC = () => {
|
||||
return (
|
||||
|
@ -38,7 +38,7 @@ export const ElasticsearchCard: React.FC = () => {
|
|||
<EuiSpacer size="xs" />
|
||||
{/* div is needed to prevent button from stretching */}
|
||||
<div>
|
||||
<EuiButtonTo to={ELASTICSEARCH_GUIDE_PATH}>
|
||||
<EuiButtonTo to={ELASTICSEARCH_PLUGIN.URL} shouldNotCreateHref>
|
||||
{i18n.translate('xpack.enterpriseSearch.overview.elasticsearchCard.button', {
|
||||
defaultMessage: 'Get started',
|
||||
})}
|
||||
|
|
|
@ -16,11 +16,10 @@ import { HttpLogic } from '../shared/http';
|
|||
import { KibanaLogic } from '../shared/kibana';
|
||||
import { VersionMismatchPage } from '../shared/version_mismatch';
|
||||
|
||||
import { ElasticsearchGuide } from './components/elasticsearch_guide';
|
||||
import { ErrorConnecting } from './components/error_connecting';
|
||||
import { ProductSelector } from './components/product_selector';
|
||||
import { SetupGuide } from './components/setup_guide';
|
||||
import { ROOT_PATH, SETUP_GUIDE_PATH, ELASTICSEARCH_GUIDE_PATH } from './routes';
|
||||
import { ROOT_PATH, SETUP_GUIDE_PATH } from './routes';
|
||||
|
||||
export const EnterpriseSearchOverview: React.FC<InitialAppData> = ({
|
||||
access = {},
|
||||
|
@ -57,9 +56,6 @@ export const EnterpriseSearchOverview: React.FC<InitialAppData> = ({
|
|||
<Route exact path={SETUP_GUIDE_PATH}>
|
||||
<SetupGuide />
|
||||
</Route>
|
||||
<Route exact path={ELASTICSEARCH_GUIDE_PATH}>
|
||||
<ElasticsearchGuide />
|
||||
</Route>
|
||||
<Route exact path={ROOT_PATH}>
|
||||
{showView()}
|
||||
</Route>
|
||||
|
|
|
@ -7,4 +7,3 @@
|
|||
|
||||
export const ROOT_PATH = '/';
|
||||
export const SETUP_GUIDE_PATH = '/setup_guide';
|
||||
export const ELASTICSEARCH_GUIDE_PATH = '/elasticsearch_guide';
|
||||
|
|
|
@ -18,7 +18,7 @@ import { shallow, ShallowWrapper } from 'enzyme';
|
|||
|
||||
import { EuiSteps } from '@elastic/eui';
|
||||
|
||||
import { ENTERPRISE_SEARCH_OVERVIEW_PLUGIN } from '../../../../common/constants';
|
||||
import { ELASTICSEARCH_PLUGIN } from '../../../../common/constants';
|
||||
|
||||
import { EuiLinkTo } from '../react_router_helpers';
|
||||
|
||||
|
@ -50,9 +50,7 @@ describe('GettingStartedSteps', () => {
|
|||
|
||||
expect(steps[1].title).toEqual('Build a search experience');
|
||||
expect(steps[1].status).toEqual('incomplete');
|
||||
expect(steps[1].children.find(EuiLinkTo).prop('to')).toEqual(
|
||||
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.URL + '/elasticsearch_guide'
|
||||
);
|
||||
expect(steps[1].children.find(EuiLinkTo).prop('to')).toEqual(ELASTICSEARCH_PLUGIN.URL);
|
||||
|
||||
expect(steps[2].title).toEqual('Tune your search relevance');
|
||||
expect(steps[2].status).toEqual('incomplete');
|
||||
|
|
|
@ -21,8 +21,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { ENTERPRISE_SEARCH_OVERVIEW_PLUGIN } from '../../../../common/constants';
|
||||
import { ELASTICSEARCH_GUIDE_PATH } from '../../enterprise_search_overview/routes';
|
||||
import { ELASTICSEARCH_PLUGIN } from '../../../../common/constants';
|
||||
|
||||
import { EuiLinkTo } from '../react_router_helpers';
|
||||
|
||||
|
@ -145,10 +144,7 @@ export const GettingStartedSteps: React.FC<GettingStartedStepsProps> = ({ step =
|
|||
</EuiPopover>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiLinkTo
|
||||
shouldNotCreateHref
|
||||
to={ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.URL + ELASTICSEARCH_GUIDE_PATH}
|
||||
>
|
||||
<EuiLinkTo shouldNotCreateHref to={ELASTICSEARCH_PLUGIN.URL}>
|
||||
<EuiIcon type="iInCircle" />
|
||||
|
||||
{i18n.translate(
|
||||
|
|
|
@ -104,6 +104,12 @@ export const useEnterpriseSearchBreadcrumbs = (breadcrumbs: Breadcrumbs = []) =>
|
|||
...breadcrumbs,
|
||||
]);
|
||||
|
||||
export const useElasticsearchBreadcrumbs = (breadcrumbs: Breadcrumbs = []) =>
|
||||
useEnterpriseSearchBreadcrumbs([
|
||||
{ text: 'Getting started with Elasticsearch', path: '/' },
|
||||
...breadcrumbs,
|
||||
]);
|
||||
|
||||
export const useAppSearchBreadcrumbs = (breadcrumbs: Breadcrumbs = []) =>
|
||||
useEnterpriseSearchBreadcrumbs([{ text: APP_SEARCH_PLUGIN.NAME, path: '/' }, ...breadcrumbs]);
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ export const generateTitle = (pages: Title) => pages.join(' - ');
|
|||
export const enterpriseSearchTitle = (page: Title = []) =>
|
||||
generateTitle([...page, ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.NAME]);
|
||||
|
||||
export const elasticsearchTitle = (page: Title = []) =>
|
||||
generateTitle([...page, 'Getting started with Elasticsearch']);
|
||||
|
||||
export const appSearchTitle = (page: Title = []) =>
|
||||
generateTitle([...page, APP_SEARCH_PLUGIN.NAME]);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
export {
|
||||
SetEnterpriseSearchChrome,
|
||||
SetElasticsearchChrome,
|
||||
SetAppSearchChrome,
|
||||
SetWorkplaceSearchChrome,
|
||||
} from './set_chrome';
|
||||
|
|
|
@ -14,11 +14,17 @@ import { KibanaLogic } from '../kibana';
|
|||
import {
|
||||
useGenerateBreadcrumbs,
|
||||
useEnterpriseSearchBreadcrumbs,
|
||||
useElasticsearchBreadcrumbs,
|
||||
useAppSearchBreadcrumbs,
|
||||
useWorkplaceSearchBreadcrumbs,
|
||||
BreadcrumbTrail,
|
||||
} from './generate_breadcrumbs';
|
||||
import { enterpriseSearchTitle, appSearchTitle, workplaceSearchTitle } from './generate_title';
|
||||
import {
|
||||
enterpriseSearchTitle,
|
||||
elasticsearchTitle,
|
||||
appSearchTitle,
|
||||
workplaceSearchTitle,
|
||||
} from './generate_title';
|
||||
|
||||
/**
|
||||
* Helpers for setting Kibana chrome (breadcrumbs, doc titles) on React view mount
|
||||
|
@ -56,6 +62,23 @@ export const SetEnterpriseSearchChrome: React.FC<SetChromeProps> = ({ trail = []
|
|||
return null;
|
||||
};
|
||||
|
||||
export const SetElasticsearchChrome: React.FC<SetChromeProps> = ({ trail = [] }) => {
|
||||
const { setBreadcrumbs, setDocTitle } = useValues(KibanaLogic);
|
||||
|
||||
const title = reverseArray(trail);
|
||||
const docTitle = elasticsearchTitle(title);
|
||||
|
||||
const crumbs = useGenerateBreadcrumbs(trail);
|
||||
const breadcrumbs = useElasticsearchBreadcrumbs(crumbs);
|
||||
|
||||
useEffect(() => {
|
||||
setBreadcrumbs(breadcrumbs);
|
||||
setDocTitle(docTitle);
|
||||
}, [trail]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const SetAppSearchChrome: React.FC<SetChromeProps> = ({ trail = [] }) => {
|
||||
const { setBreadcrumbs, setDocTitle } = useValues(KibanaLogic);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/p
|
|||
|
||||
import {
|
||||
APP_SEARCH_PLUGIN,
|
||||
ELASTICSEARCH_PLUGIN,
|
||||
ENTERPRISE_SEARCH_CONTENT_PLUGIN,
|
||||
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN,
|
||||
WORKPLACE_SEARCH_PLUGIN,
|
||||
|
@ -112,6 +113,27 @@ export class EnterpriseSearchPlugin implements Plugin {
|
|||
},
|
||||
});
|
||||
|
||||
core.application.register({
|
||||
id: ELASTICSEARCH_PLUGIN.ID,
|
||||
title: ELASTICSEARCH_PLUGIN.NAME,
|
||||
euiIconType: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.LOGO,
|
||||
appRoute: ELASTICSEARCH_PLUGIN.URL,
|
||||
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
|
||||
mount: async (params: AppMountParameters) => {
|
||||
const kibanaDeps = await this.getKibanaDeps(core, params, cloud);
|
||||
const { chrome, http } = kibanaDeps.core;
|
||||
chrome.docTitle.change(ELASTICSEARCH_PLUGIN.NAME);
|
||||
|
||||
await this.getInitialData(http);
|
||||
const pluginData = this.getPluginData();
|
||||
|
||||
const { renderApp } = await import('./applications');
|
||||
const { Elasticsearch } = await import('./applications/elasticsearch');
|
||||
|
||||
return renderApp(Elasticsearch, kibanaDeps, pluginData);
|
||||
},
|
||||
});
|
||||
|
||||
core.application.register({
|
||||
id: APP_SEARCH_PLUGIN.ID,
|
||||
title: APP_SEARCH_PLUGIN.NAME,
|
||||
|
@ -177,6 +199,16 @@ export class EnterpriseSearchPlugin implements Plugin {
|
|||
showOnHomePage: false,
|
||||
});
|
||||
|
||||
plugins.home.featureCatalogue.register({
|
||||
id: ELASTICSEARCH_PLUGIN.ID,
|
||||
title: ELASTICSEARCH_PLUGIN.NAME,
|
||||
icon: 'appElasticsearch',
|
||||
description: ELASTICSEARCH_PLUGIN.DESCRIPTION,
|
||||
path: ELASTICSEARCH_PLUGIN.URL,
|
||||
category: 'data',
|
||||
showOnHomePage: false,
|
||||
});
|
||||
|
||||
plugins.home.featureCatalogue.register({
|
||||
id: WORKPLACE_SEARCH_PLUGIN.ID,
|
||||
title: WORKPLACE_SEARCH_PLUGIN.NAME,
|
||||
|
|
|
@ -25,6 +25,7 @@ import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
|||
import {
|
||||
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN,
|
||||
ENTERPRISE_SEARCH_CONTENT_PLUGIN,
|
||||
ELASTICSEARCH_PLUGIN,
|
||||
APP_SEARCH_PLUGIN,
|
||||
WORKPLACE_SEARCH_PLUGIN,
|
||||
ENTERPRISE_SEARCH_RELEVANCE_LOGS_SOURCE_ID,
|
||||
|
@ -93,6 +94,7 @@ export class EnterpriseSearchPlugin implements Plugin {
|
|||
const PLUGIN_IDS = [
|
||||
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.ID,
|
||||
ENTERPRISE_SEARCH_CONTENT_PLUGIN.ID,
|
||||
ELASTICSEARCH_PLUGIN.ID,
|
||||
APP_SEARCH_PLUGIN.ID,
|
||||
WORKPLACE_SEARCH_PLUGIN.ID,
|
||||
];
|
||||
|
@ -134,12 +136,14 @@ export class EnterpriseSearchPlugin implements Plugin {
|
|||
navLinks: {
|
||||
enterpriseSearch: showEnterpriseSearch,
|
||||
enterpriseSearchContent: showEnterpriseSearch,
|
||||
elasticsearch: showEnterpriseSearch,
|
||||
appSearch: hasAppSearchAccess,
|
||||
workplaceSearch: hasWorkplaceSearchAccess,
|
||||
},
|
||||
catalogue: {
|
||||
enterpriseSearch: showEnterpriseSearch,
|
||||
enterpriseSearchContent: showEnterpriseSearch,
|
||||
elasticsearch: showEnterpriseSearch,
|
||||
appSearch: hasAppSearchAccess,
|
||||
workplaceSearch: hasWorkplaceSearchAccess,
|
||||
},
|
||||
|
|
|
@ -64,6 +64,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
|
|||
'monitoring',
|
||||
'enterpriseSearch',
|
||||
'enterpriseSearchContent',
|
||||
'elasticsearch',
|
||||
'appSearch',
|
||||
'workplaceSearch',
|
||||
'spaces',
|
||||
|
@ -88,6 +89,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
|
|||
'monitoring',
|
||||
'enterpriseSearch',
|
||||
'enterpriseSearchContent',
|
||||
'elasticsearch',
|
||||
'appSearch',
|
||||
'workplaceSearch',
|
||||
'spaces',
|
||||
|
|
|
@ -28,6 +28,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
|
|||
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following 4 capabilities are disabled
|
||||
'enterpriseSearch',
|
||||
'enterpriseSearchContent',
|
||||
'elasticsearch',
|
||||
'appSearch',
|
||||
'workplaceSearch',
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue