mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.13] Fix breadcrumbs and sidebar navigation for connectors/crawler + fix routes for connectors (#178078) (#178249)
# Backport This will backport the following commits from `main` to `8.13`: - [Fix breadcrumbs and sidebar navigation for connectors/crawler + fix routes for connectors (#178078)](https://github.com/elastic/kibana/pull/178078) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Artem Shelkovnikov","email":"artem.shelkovnikov@elastic.co"},"sourceCommit":{"committedDate":"2024-03-07T17:02:46Z","message":"Fix breadcrumbs and sidebar navigation for connectors/crawler + fix routes for connectors (#178078)\n\n## Summary\r\n\r\nAttempts to address\r\nhttps://github.com/elastic/enterprise-search-team/issues/6514.\r\n\r\nSeveral fixes were made:\r\n\r\n- Routing for new index was broken down into 3 routes per type: new api\r\nindex, new connector, new crawler. It was done so that the sidebar\r\nnavigation would be accurate\r\n- Breadcrumbs were updated to match the page location + sidebar\r\nnavigation.\r\n\r\n## Routing changes to update navigation:\r\n\r\nSelect connector:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/select_connector\r\nchanged to\r\napp/enterprise_search/content/connectors/select_connector\r\n```\r\n\r\nNew connector:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/connector?service_type=X&connector_type=Y\r\nchanged to\r\napp/enterprise_search/content/connectors/new_connector?service_type=X&connector_type=Y\r\n```\r\n\r\nNew web crawler:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/crawler\r\nchanged to\r\napp/enterprise_search/content/crawlers/new_crawler\r\n```\r\n\r\n### Index of Web Crawlers\r\n\r\nBreadcrumbs were changed to \"Web crawlers\"\r\n\r\nBefore: \r\n<img width=\"455\" alt=\"image\"\r\nsrc=\"edd20cf5
-40d1-40e8-aa74-3382e0fd2d32\">\r\n\r\nAfter:\r\n<img width=\"455\" alt=\"image\"\r\nsrc=\"4c7941a7
-a9b4-4b18-8920-0002a1bf8e78\">\r\n\r\n### Create Web Crawler\r\n\r\nBreadcrumbs and sidebar navigation were changed to \"Web crawlers\"\r\n\r\nBefore:\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"4e4182ca
-5e75-471a-b0fc-4cc43b2d4fd5\">\r\n\r\nAfter:\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"e06190ce
-9819-419c-9885-2dee3a93794f\">\r\n\r\n### Select Connector\r\n\r\nBreadcrumb was changed to \"Connectors\"\r\n\r\nBefore:\r\n<img width=\"553\" alt=\"image\"\r\nsrc=\"6472e28e
-0123-4327-9afb-118f99e50662\">\r\n\r\nAfter:\r\n<img width=\"553\" alt=\"image\"\r\nsrc=\"7b5cdc89
-2d35-4dd9-923f-66cba122c65d\">\r\n\r\n### Create connector\r\n\r\nBreadcrumb was fixed + sidebar navigation during actual creation is now\r\nfixed. Notice, than breadcrumb now mentions connector name!\r\n\r\nBefore:\r\n\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"2baeb13c
-be55-4503-8b90-4b4e152e0e35\">\r\n\r\nAfter:\r\n\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"c005567b
-5da7-4405-a484-4a54fa84be60\">\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### Release Note\r\n\r\nFix breadcrumbs for several Elastic Search Content pages.","sha":"a199e7847182f4746cf07768c50a2aad1df04121","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.13.0","v8.14.0"],"title":"Fix breadcrumbs and sidebar navigation for connectors/crawler + fix routes for connectors","number":178078,"url":"https://github.com/elastic/kibana/pull/178078","mergeCommit":{"message":"Fix breadcrumbs and sidebar navigation for connectors/crawler + fix routes for connectors (#178078)\n\n## Summary\r\n\r\nAttempts to address\r\nhttps://github.com/elastic/enterprise-search-team/issues/6514.\r\n\r\nSeveral fixes were made:\r\n\r\n- Routing for new index was broken down into 3 routes per type: new api\r\nindex, new connector, new crawler. It was done so that the sidebar\r\nnavigation would be accurate\r\n- Breadcrumbs were updated to match the page location + sidebar\r\nnavigation.\r\n\r\n## Routing changes to update navigation:\r\n\r\nSelect connector:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/select_connector\r\nchanged to\r\napp/enterprise_search/content/connectors/select_connector\r\n```\r\n\r\nNew connector:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/connector?service_type=X&connector_type=Y\r\nchanged to\r\napp/enterprise_search/content/connectors/new_connector?service_type=X&connector_type=Y\r\n```\r\n\r\nNew web crawler:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/crawler\r\nchanged to\r\napp/enterprise_search/content/crawlers/new_crawler\r\n```\r\n\r\n### Index of Web Crawlers\r\n\r\nBreadcrumbs were changed to \"Web crawlers\"\r\n\r\nBefore: \r\n<img width=\"455\" alt=\"image\"\r\nsrc=\"edd20cf5
-40d1-40e8-aa74-3382e0fd2d32\">\r\n\r\nAfter:\r\n<img width=\"455\" alt=\"image\"\r\nsrc=\"4c7941a7
-a9b4-4b18-8920-0002a1bf8e78\">\r\n\r\n### Create Web Crawler\r\n\r\nBreadcrumbs and sidebar navigation were changed to \"Web crawlers\"\r\n\r\nBefore:\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"4e4182ca
-5e75-471a-b0fc-4cc43b2d4fd5\">\r\n\r\nAfter:\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"e06190ce
-9819-419c-9885-2dee3a93794f\">\r\n\r\n### Select Connector\r\n\r\nBreadcrumb was changed to \"Connectors\"\r\n\r\nBefore:\r\n<img width=\"553\" alt=\"image\"\r\nsrc=\"6472e28e
-0123-4327-9afb-118f99e50662\">\r\n\r\nAfter:\r\n<img width=\"553\" alt=\"image\"\r\nsrc=\"7b5cdc89
-2d35-4dd9-923f-66cba122c65d\">\r\n\r\n### Create connector\r\n\r\nBreadcrumb was fixed + sidebar navigation during actual creation is now\r\nfixed. Notice, than breadcrumb now mentions connector name!\r\n\r\nBefore:\r\n\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"2baeb13c
-be55-4503-8b90-4b4e152e0e35\">\r\n\r\nAfter:\r\n\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"c005567b
-5da7-4405-a484-4a54fa84be60\">\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### Release Note\r\n\r\nFix breadcrumbs for several Elastic Search Content pages.","sha":"a199e7847182f4746cf07768c50a2aad1df04121"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178078","number":178078,"mergeCommit":{"message":"Fix breadcrumbs and sidebar navigation for connectors/crawler + fix routes for connectors (#178078)\n\n## Summary\r\n\r\nAttempts to address\r\nhttps://github.com/elastic/enterprise-search-team/issues/6514.\r\n\r\nSeveral fixes were made:\r\n\r\n- Routing for new index was broken down into 3 routes per type: new api\r\nindex, new connector, new crawler. It was done so that the sidebar\r\nnavigation would be accurate\r\n- Breadcrumbs were updated to match the page location + sidebar\r\nnavigation.\r\n\r\n## Routing changes to update navigation:\r\n\r\nSelect connector:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/select_connector\r\nchanged to\r\napp/enterprise_search/content/connectors/select_connector\r\n```\r\n\r\nNew connector:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/connector?service_type=X&connector_type=Y\r\nchanged to\r\napp/enterprise_search/content/connectors/new_connector?service_type=X&connector_type=Y\r\n```\r\n\r\nNew web crawler:\r\n```\r\napp/enterprise_search/content/search_indices/new_index/crawler\r\nchanged to\r\napp/enterprise_search/content/crawlers/new_crawler\r\n```\r\n\r\n### Index of Web Crawlers\r\n\r\nBreadcrumbs were changed to \"Web crawlers\"\r\n\r\nBefore: \r\n<img width=\"455\" alt=\"image\"\r\nsrc=\"edd20cf5
-40d1-40e8-aa74-3382e0fd2d32\">\r\n\r\nAfter:\r\n<img width=\"455\" alt=\"image\"\r\nsrc=\"4c7941a7
-a9b4-4b18-8920-0002a1bf8e78\">\r\n\r\n### Create Web Crawler\r\n\r\nBreadcrumbs and sidebar navigation were changed to \"Web crawlers\"\r\n\r\nBefore:\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"4e4182ca
-5e75-471a-b0fc-4cc43b2d4fd5\">\r\n\r\nAfter:\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"e06190ce
-9819-419c-9885-2dee3a93794f\">\r\n\r\n### Select Connector\r\n\r\nBreadcrumb was changed to \"Connectors\"\r\n\r\nBefore:\r\n<img width=\"553\" alt=\"image\"\r\nsrc=\"6472e28e
-0123-4327-9afb-118f99e50662\">\r\n\r\nAfter:\r\n<img width=\"553\" alt=\"image\"\r\nsrc=\"7b5cdc89
-2d35-4dd9-923f-66cba122c65d\">\r\n\r\n### Create connector\r\n\r\nBreadcrumb was fixed + sidebar navigation during actual creation is now\r\nfixed. Notice, than breadcrumb now mentions connector name!\r\n\r\nBefore:\r\n\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"2baeb13c
-be55-4503-8b90-4b4e152e0e35\">\r\n\r\nAfter:\r\n\r\n<img width=\"931\" alt=\"image\"\r\nsrc=\"c005567b
-5da7-4405-a484-4a54fa84be60\">\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### Release Note\r\n\r\nFix breadcrumbs for several Elastic Search Content pages.","sha":"a199e7847182f4746cf07768c50a2aad1df04121"}}]}] BACKPORT--> Co-authored-by: Artem Shelkovnikov <artem.shelkovnikov@elastic.co>
This commit is contained in:
parent
8f94eb0a7d
commit
cc878396dd
16 changed files with 145 additions and 73 deletions
|
@ -15,7 +15,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import { generateEncodedPath } from '../../../shared/encode_path_params';
|
||||
import { KibanaLogic } from '../../../shared/kibana';
|
||||
import { CONNECTOR_DETAIL_TAB_PATH } from '../../routes';
|
||||
import { baseBreadcrumbs } from '../connectors/connectors';
|
||||
import { connectorsBreadcrumbs } from '../connectors/connectors';
|
||||
import { EnterpriseSearchContentPageTemplate } from '../layout/page_template';
|
||||
|
||||
import { getHeaderActions } from '../search_index/components/header_actions/header_actions';
|
||||
|
@ -226,7 +226,7 @@ export const ConnectorDetail: React.FC = () => {
|
|||
|
||||
return (
|
||||
<EnterpriseSearchContentPageTemplate
|
||||
pageChrome={[...baseBreadcrumbs, connector?.name ?? '...']}
|
||||
pageChrome={[...connectorsBreadcrumbs, connector?.name ?? '...']}
|
||||
pageViewTelemetry={tabId}
|
||||
isLoading={isLoading}
|
||||
pageHeader={{
|
||||
|
|
|
@ -25,20 +25,16 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
|
||||
import { INGESTION_METHOD_IDS } from '../../../../../common/constants';
|
||||
|
||||
import { generateEncodedPath } from '../../../shared/encode_path_params';
|
||||
import { HttpLogic } from '../../../shared/http';
|
||||
import { KibanaLogic } from '../../../shared/kibana';
|
||||
import { handlePageChange } from '../../../shared/table_pagination';
|
||||
import {
|
||||
NEW_INDEX_METHOD_PATH,
|
||||
NEW_CRAWLER_PATH,
|
||||
NEW_INDEX_SELECT_CONNECTOR_CLIENTS_PATH,
|
||||
NEW_INDEX_SELECT_CONNECTOR_NATIVE_PATH,
|
||||
NEW_INDEX_SELECT_CONNECTOR_PATH,
|
||||
} from '../../routes';
|
||||
import { EnterpriseSearchContentPageTemplate } from '../layout';
|
||||
import { SelectConnector } from '../new_index/select_connector/select_connector';
|
||||
|
||||
import { CannotConnect } from '../search_index/components/cannot_connect';
|
||||
|
||||
|
@ -49,13 +45,20 @@ import { ConnectorsLogic } from './connectors_logic';
|
|||
import { ConnectorsTable } from './connectors_table';
|
||||
import { CrawlerEmptyState } from './crawler_empty_state';
|
||||
import { DeleteConnectorModal } from './delete_connector_modal';
|
||||
import { SelectConnector } from './select_connector/select_connector';
|
||||
|
||||
export const baseBreadcrumbs = [
|
||||
export const connectorsBreadcrumbs = [
|
||||
i18n.translate('xpack.enterpriseSearch.content.connectors.breadcrumb', {
|
||||
defaultMessage: 'Connectors',
|
||||
}),
|
||||
];
|
||||
|
||||
export const crawlersBreadcrumbs = [
|
||||
i18n.translate('xpack.enterpriseSearch.content.crawlers.breadcrumb', {
|
||||
defaultMessage: 'Web crawlers',
|
||||
}),
|
||||
];
|
||||
|
||||
export interface ConnectorsProps {
|
||||
isCrawler: boolean;
|
||||
}
|
||||
|
@ -83,7 +86,7 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
|
|||
<>
|
||||
<DeleteConnectorModal isCrawler={isCrawler} />
|
||||
<EnterpriseSearchContentPageTemplate
|
||||
pageChrome={baseBreadcrumbs}
|
||||
pageChrome={!isCrawler ? connectorsBreadcrumbs : crawlersBreadcrumbs}
|
||||
pageViewTelemetry={!isCrawler ? 'Connectors' : 'Web Crawlers'}
|
||||
isLoading={isLoading}
|
||||
pageHeader={{
|
||||
|
@ -202,11 +205,7 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
|
|||
iconType="plusInCircle"
|
||||
fill
|
||||
onClick={() => {
|
||||
KibanaLogic.values.navigateToUrl(
|
||||
generateEncodedPath(NEW_INDEX_METHOD_PATH, {
|
||||
type: INGESTION_METHOD_IDS.CRAWLER,
|
||||
})
|
||||
);
|
||||
KibanaLogic.values.navigateToUrl(NEW_CRAWLER_PATH);
|
||||
}}
|
||||
>
|
||||
{i18n.translate('xpack.enterpriseSearch.connectors.newCrawlerButtonLabel', {
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 { Routes, Route } from '@kbn/shared-ux-router';
|
||||
|
||||
import { CONNECTORS_PATH, NEW_INDEX_SELECT_CONNECTOR_PATH, NEW_CONNECTOR_PATH } from '../../routes';
|
||||
import { NewSearchIndexPage } from '../new_index/new_search_index_page';
|
||||
|
||||
import { Connectors } from './connectors';
|
||||
import { SelectConnector } from './select_connector/select_connector';
|
||||
|
||||
export const ConnectorsRouter: React.FC = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path={NEW_INDEX_SELECT_CONNECTOR_PATH}>
|
||||
<SelectConnector />
|
||||
</Route>
|
||||
<Route path={NEW_CONNECTOR_PATH}>
|
||||
<NewSearchIndexPage type="connector" />
|
||||
</Route>
|
||||
<Route path={CONNECTORS_PATH}>
|
||||
<Connectors isCrawler={false} />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
};
|
|
@ -11,10 +11,9 @@ import { useValues } from 'kea';
|
|||
import { EuiButton, EuiEmptyPrompt, EuiPanel } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { generateEncodedPath } from '../../../shared/encode_path_params';
|
||||
import { HttpLogic } from '../../../shared/http';
|
||||
import { KibanaLogic } from '../../../shared/kibana';
|
||||
import { NEW_INDEX_METHOD_PATH } from '../../routes';
|
||||
import { NEW_CRAWLER_PATH } from '../../routes';
|
||||
|
||||
export const CrawlerEmptyState: React.FC = () => {
|
||||
const { errorConnectingMessage } = useValues(HttpLogic);
|
||||
|
@ -46,11 +45,7 @@ export const CrawlerEmptyState: React.FC = () => {
|
|||
disabled={Boolean(errorConnectingMessage)}
|
||||
fill
|
||||
iconType="plusInCircle"
|
||||
onClick={() =>
|
||||
KibanaLogic.values.navigateToUrl(
|
||||
generateEncodedPath(NEW_INDEX_METHOD_PATH, { type: 'crawler' })
|
||||
)
|
||||
}
|
||||
onClick={() => KibanaLogic.values.navigateToUrl(NEW_CRAWLER_PATH)}
|
||||
>
|
||||
{i18n.translate('xpack.enterpriseSearch.crawlerEmptyState.newWebCrawlerButtonLabel', {
|
||||
defaultMessage: 'New web crawler',
|
||||
|
|
|
@ -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 React from 'react';
|
||||
|
||||
import { Routes, Route } from '@kbn/shared-ux-router';
|
||||
|
||||
import { CRAWLERS_PATH, NEW_CRAWLER_PATH } from '../../routes';
|
||||
import { NewSearchIndexPage } from '../new_index/new_search_index_page';
|
||||
|
||||
import { Connectors } from './connectors';
|
||||
|
||||
export const CrawlersRouter: React.FC = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path={NEW_CRAWLER_PATH}>
|
||||
<NewSearchIndexPage type="crawler" />
|
||||
</Route>
|
||||
<Route path={CRAWLERS_PATH}>
|
||||
<Connectors isCrawler />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
};
|
|
@ -34,26 +34,21 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
|
||||
import {
|
||||
CONNECTOR_CLIENTS_TYPE,
|
||||
CONNECTOR_NATIVE_TYPE,
|
||||
INGESTION_METHOD_IDS,
|
||||
} from '../../../../../../common/constants';
|
||||
import { CONNECTOR_CLIENTS_TYPE, CONNECTOR_NATIVE_TYPE } from '../../../../../../common/constants';
|
||||
|
||||
import connectorLogo from '../../../../../assets/source_icons/network_drive.svg';
|
||||
import { BACK_BUTTON_LABEL } from '../../../../shared/constants';
|
||||
import { generateEncodedPath } from '../../../../shared/encode_path_params';
|
||||
|
||||
import { KibanaLogic } from '../../../../shared/kibana';
|
||||
import { LicensingLogic } from '../../../../shared/licensing';
|
||||
import { parseQueryParams } from '../../../../shared/query_params';
|
||||
|
||||
import { NEW_INDEX_METHOD_PATH, NEW_INDEX_PATH } from '../../../routes';
|
||||
import { NEW_CONNECTOR_PATH, NEW_INDEX_PATH } from '../../../routes';
|
||||
import { EnterpriseSearchContentPageTemplate } from '../../layout';
|
||||
|
||||
import { CONNECTORS } from '../../search_index/connector/constants';
|
||||
|
||||
import { baseBreadcrumbs } from '../../search_indices';
|
||||
import { connectorsBreadcrumbs } from '../connectors';
|
||||
|
||||
import { ConnectorCheckable } from './connector_checkable';
|
||||
import { ConnectorDescriptionBadge } from './connector_description_badge_popout';
|
||||
|
@ -115,7 +110,7 @@ export const SelectConnector: React.FC = () => {
|
|||
return (
|
||||
<EnterpriseSearchContentPageTemplate
|
||||
pageChrome={[
|
||||
...baseBreadcrumbs,
|
||||
...connectorsBreadcrumbs,
|
||||
i18n.translate('xpack.enterpriseSearch.content.indices.selectConnector.breadcrumb', {
|
||||
defaultMessage: 'Select connector',
|
||||
}),
|
||||
|
@ -345,9 +340,7 @@ export const SelectConnector: React.FC = () => {
|
|||
);
|
||||
}
|
||||
KibanaLogic.values.navigateToUrl(
|
||||
`${generateEncodedPath(NEW_INDEX_METHOD_PATH, {
|
||||
type: INGESTION_METHOD_IDS.CONNECTOR,
|
||||
})}?${queryParam.toString()}`
|
||||
`${NEW_CONNECTOR_PATH}?${queryParam.toString()}`
|
||||
);
|
||||
}}
|
||||
documentationUrl={connector.docsUrl}
|
|
@ -16,11 +16,10 @@ import { INGESTION_METHOD_IDS } from '../../../../../common/constants';
|
|||
|
||||
import { ProductFeatures } from '../../../../../common/types';
|
||||
|
||||
import { generateEncodedPath } from '../../../shared/encode_path_params';
|
||||
import { HttpLogic } from '../../../shared/http';
|
||||
import { KibanaLogic } from '../../../shared/kibana/kibana_logic';
|
||||
|
||||
import { NEW_INDEX_METHOD_PATH, NEW_INDEX_SELECT_CONNECTOR_PATH } from '../../routes';
|
||||
import { NEW_API_PATH, NEW_CRAWLER_PATH, NEW_INDEX_SELECT_CONNECTOR_PATH } from '../../routes';
|
||||
import { EnterpriseSearchContentPageTemplate } from '../layout/page_template';
|
||||
import { CannotConnect } from '../search_index/components/cannot_connect';
|
||||
import { baseBreadcrumbs } from '../search_indices';
|
||||
|
@ -76,10 +75,10 @@ export const NewIndex: React.FC = () => {
|
|||
onSelect={() => {
|
||||
if (type === INGESTION_METHOD_IDS.CONNECTOR) {
|
||||
KibanaLogic.values.navigateToUrl(NEW_INDEX_SELECT_CONNECTOR_PATH);
|
||||
} else if (type === INGESTION_METHOD_IDS.CRAWLER) {
|
||||
KibanaLogic.values.navigateToUrl(NEW_CRAWLER_PATH);
|
||||
} else {
|
||||
KibanaLogic.values.navigateToUrl(
|
||||
generateEncodedPath(NEW_INDEX_METHOD_PATH, { type })
|
||||
);
|
||||
KibanaLogic.values.navigateToUrl(NEW_API_PATH);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -9,15 +9,10 @@ import React from 'react';
|
|||
|
||||
import { Routes, Route } from '@kbn/shared-ux-router';
|
||||
|
||||
import {
|
||||
NEW_INDEX_PATH,
|
||||
NEW_INDEX_SELECT_CONNECTOR_PATH,
|
||||
NEW_INDEX_METHOD_PATH,
|
||||
} from '../../routes';
|
||||
import { NEW_INDEX_PATH, NEW_API_PATH } from '../../routes';
|
||||
|
||||
import { NewIndex } from './new_index';
|
||||
import { NewSearchIndexPage } from './new_search_index_page';
|
||||
import { SelectConnector } from './select_connector/select_connector';
|
||||
|
||||
export const NewIndexRouter: React.FC = () => {
|
||||
return (
|
||||
|
@ -25,11 +20,8 @@ export const NewIndexRouter: React.FC = () => {
|
|||
<Route path={NEW_INDEX_PATH} exact>
|
||||
<NewIndex />
|
||||
</Route>
|
||||
<Route path={NEW_INDEX_SELECT_CONNECTOR_PATH} exact>
|
||||
<SelectConnector />
|
||||
</Route>
|
||||
<Route path={NEW_INDEX_METHOD_PATH} exact>
|
||||
<NewSearchIndexPage />
|
||||
<Route path={NEW_API_PATH} exact>
|
||||
<NewSearchIndexPage type="api" />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
@ -20,6 +20,7 @@ import {
|
|||
} from '../../../../../common/constants';
|
||||
import { parseQueryParams } from '../../../shared/query_params';
|
||||
|
||||
import { connectorsBreadcrumbs, crawlersBreadcrumbs } from '../connectors/connectors';
|
||||
import { EnterpriseSearchContentPageTemplate } from '../layout/page_template';
|
||||
import { CONNECTORS } from '../search_index/connector/constants';
|
||||
import { baseBreadcrumbs } from '../search_indices';
|
||||
|
@ -95,6 +96,44 @@ const parseIsNativeParam = (queryString: string | string[] | null): boolean | un
|
|||
return undefined;
|
||||
};
|
||||
|
||||
const getBreadcrumb = (method: string, serviceType: string): string[] => {
|
||||
switch (method) {
|
||||
case INGESTION_METHOD_IDS.CONNECTOR:
|
||||
const connector =
|
||||
Boolean(serviceType) && CONNECTORS.find((item) => item.serviceType === serviceType);
|
||||
|
||||
const thisConnectorBreadcrumb = connector
|
||||
? i18n.translate(
|
||||
'xpack.enterpriseSearch.content.new_connector_with_service_type.breadcrumbs',
|
||||
{
|
||||
defaultMessage: `New {name} connector`,
|
||||
values: {
|
||||
name: connector.name,
|
||||
},
|
||||
}
|
||||
)
|
||||
: i18n.translate('xpack.enterpriseSearch.content.new_connector.breadcrumbs', {
|
||||
defaultMessage: `New connector`,
|
||||
});
|
||||
|
||||
return [...connectorsBreadcrumbs, thisConnectorBreadcrumb];
|
||||
case INGESTION_METHOD_IDS.CRAWLER:
|
||||
return [
|
||||
...crawlersBreadcrumbs,
|
||||
i18n.translate('xpack.enterpriseSearch.content.new_web_crawler.breadcrumbs', {
|
||||
defaultMessage: 'New web crawler',
|
||||
}),
|
||||
];
|
||||
default:
|
||||
return [
|
||||
...baseBreadcrumbs,
|
||||
i18n.translate('xpack.enterpriseSearch.content.new_index.breadcrumbs', {
|
||||
defaultMessage: 'New search index',
|
||||
}),
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
const getConnectorModeBadge = (isNative?: boolean) => {
|
||||
if (isNative) {
|
||||
return (
|
||||
|
@ -117,9 +156,10 @@ const getConnectorModeBadge = (isNative?: boolean) => {
|
|||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const NewSearchIndexPage: React.FC = () => {
|
||||
const type = decodeURIComponent(useParams<{ type: string }>().type);
|
||||
export interface NewSearchIndexPageProps {
|
||||
type: string;
|
||||
}
|
||||
export const NewSearchIndexPage: React.FC<NewSearchIndexPageProps> = ({ type }) => {
|
||||
const { search } = useLocation();
|
||||
const { service_type: inputServiceType, connector_type: inputConnectorType } =
|
||||
parseQueryParams(search);
|
||||
|
@ -131,12 +171,7 @@ export const NewSearchIndexPage: React.FC = () => {
|
|||
|
||||
return (
|
||||
<EnterpriseSearchContentPageTemplate
|
||||
pageChrome={[
|
||||
...baseBreadcrumbs,
|
||||
i18n.translate('xpack.enterpriseSearch.content.new_index.breadcrumbs', {
|
||||
defaultMessage: 'New search index',
|
||||
}),
|
||||
]}
|
||||
pageChrome={getBreadcrumb(type, serviceType)}
|
||||
pageViewTelemetry="New Index"
|
||||
isLoading={false}
|
||||
pageHeader={{
|
||||
|
|
|
@ -21,7 +21,8 @@ import { KibanaLogic } from '../shared/kibana';
|
|||
import { VersionMismatchPage } from '../shared/version_mismatch';
|
||||
|
||||
import { ConnectorDetailRouter } from './components/connector_detail/connector_detail_router';
|
||||
import { Connectors } from './components/connectors/connectors';
|
||||
import { ConnectorsRouter } from './components/connectors/connectors_router';
|
||||
import { CrawlersRouter } from './components/connectors/crawlers_router';
|
||||
import { NotFound } from './components/not_found';
|
||||
import { SearchIndicesRouter } from './components/search_indices';
|
||||
import {
|
||||
|
@ -77,14 +78,14 @@ export const EnterpriseSearchContentConfigured: React.FC<Required<InitialAppData
|
|||
<Route path={SEARCH_INDICES_PATH}>
|
||||
<SearchIndicesRouter />
|
||||
</Route>
|
||||
<Route path={CONNECTORS_PATH}>
|
||||
<ConnectorsRouter />
|
||||
</Route>
|
||||
<Route path={CONNECTOR_DETAIL_PATH}>
|
||||
<ConnectorDetailRouter />
|
||||
</Route>
|
||||
<Route path={CONNECTORS_PATH}>
|
||||
<Connectors isCrawler={false} />
|
||||
</Route>
|
||||
<Route path={CRAWLERS_PATH}>
|
||||
<Connectors isCrawler />
|
||||
<CrawlersRouter />
|
||||
</Route>
|
||||
<Route>
|
||||
<NotFound />
|
||||
|
|
|
@ -16,13 +16,14 @@ export const CRAWLERS_PATH = `${ROOT_PATH}crawlers`;
|
|||
export const SETTINGS_PATH = `${ROOT_PATH}settings`;
|
||||
|
||||
export const NEW_INDEX_PATH = `${SEARCH_INDICES_PATH}/new_index`;
|
||||
export const NEW_INDEX_METHOD_PATH = `${NEW_INDEX_PATH}/:type`;
|
||||
export const NEW_API_PATH = `${NEW_INDEX_PATH}/api`;
|
||||
export const NEW_ES_INDEX_PATH = `${NEW_INDEX_PATH}/elasticsearch`;
|
||||
export const NEW_DIRECT_UPLOAD_PATH = `${NEW_INDEX_PATH}/upload`;
|
||||
export const NEW_INDEX_SELECT_CONNECTOR_PATH = `${NEW_INDEX_PATH}/select_connector`;
|
||||
export const NEW_INDEX_SELECT_CONNECTOR_NATIVE_PATH = `${NEW_INDEX_PATH}/select_connector?filter=native`;
|
||||
export const NEW_INDEX_SELECT_CONNECTOR_CLIENTS_PATH = `${NEW_INDEX_PATH}/select_connector?filter=connector_clients`;
|
||||
export const NEW_INDEX_SELECT_CONNECTOR_PATH = `${CONNECTORS_PATH}/select_connector`;
|
||||
export const NEW_CONNECTOR_PATH = `${CONNECTORS_PATH}/new_connector`;
|
||||
export const NEW_CRAWLER_PATH = `${CRAWLERS_PATH}/new_crawler`;
|
||||
export const NEW_INDEX_SELECT_CONNECTOR_NATIVE_PATH = `${CONNECTORS_PATH}/select_connector?filter=native`;
|
||||
export const NEW_INDEX_SELECT_CONNECTOR_CLIENTS_PATH = `${CONNECTORS_PATH}/select_connector?filter=connector_clients`;
|
||||
|
||||
export const SEARCH_INDEX_PATH = `${SEARCH_INDICES_PATH}/:indexName`;
|
||||
export const SEARCH_INDEX_TAB_PATH = `${SEARCH_INDEX_PATH}/:tabId`;
|
||||
|
|
|
@ -18,7 +18,6 @@ import { i18n } from '@kbn/i18n';
|
|||
import {
|
||||
ENTERPRISE_SEARCH_CONTENT_PLUGIN,
|
||||
ENTERPRISE_SEARCH_ELASTICSEARCH_URL,
|
||||
INGESTION_METHOD_IDS,
|
||||
} from '../../../../../common/constants';
|
||||
|
||||
import apiLogo from '../../../../assets/images/api_image.png';
|
||||
|
@ -31,7 +30,7 @@ import languageClientsLogo from '../../../../assets/images/search_language_clien
|
|||
import { IngestionCard } from '../../../enterprise_search_content/components/shared/ingestion_card/ingestion_card';
|
||||
import {
|
||||
NEW_API_PATH,
|
||||
NEW_INDEX_METHOD_PATH,
|
||||
NEW_CRAWLER_PATH,
|
||||
NEW_INDEX_SELECT_CONNECTOR_PATH,
|
||||
} from '../../../enterprise_search_content/routes';
|
||||
import { HttpLogic } from '../../../shared/http/http_logic';
|
||||
|
@ -91,9 +90,7 @@ export const IngestionSelector: React.FC = () => {
|
|||
'Discover, extract, and index searchable content from websites and knowledge bases.',
|
||||
}
|
||||
)}
|
||||
href={generatePath(ENTERPRISE_SEARCH_CONTENT_PLUGIN.URL + NEW_INDEX_METHOD_PATH, {
|
||||
type: INGESTION_METHOD_IDS.CRAWLER,
|
||||
})}
|
||||
href={generatePath(ENTERPRISE_SEARCH_CONTENT_PLUGIN.URL + NEW_CRAWLER_PATH)}
|
||||
isDisabled={crawlerDisabled}
|
||||
logo={crawlerLogo}
|
||||
title={i18n.translate('xpack.enterpriseSearch.ingestSelector.method.crawler', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue