From 8cd7b5eac25edcd775d79ec870c3021cb358172d Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Mon, 9 Dec 2024 12:36:16 -0600 Subject: [PATCH] [Search] Inference Endpoints - Align rendering to plugin (#203313) ## Summary This PR removes rendering of the Inference Endpoints UI from `enterprise_search` for stack and instead utilizes the `search_inference_endpoints` plugin to render the UI for both serverless and stack. This can be done by utilizing the `search_navigation` plugin for rendering the classic navigation for stack. To support this change the `xpack.searchInferenceEndpoints.ui.enabled` was updated to default to `true` instead of only being set for serverless search. To account for this change I have added `xpack.searchInferenceEndpoints.enabled: false` to the serverless configs for both security and observability to ensure the `search_inference_endpoints` plugin is disabled in both of those projects. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine --- config/serverless.es.yml | 3 - config/serverless.oblt.yml | 1 + config/serverless.security.yml | 1 + packages/deeplinks/search/constants.ts | 1 - packages/deeplinks/search/deep_links.ts | 7 +- packages/deeplinks/search/index.ts | 1 - .../enterprise_search/common/constants.ts | 17 ---- .../common/locators/index.ts | 3 - .../common/locators/inference_locator.tsx | 30 ------- x-pack/plugins/enterprise_search/kibana.jsonc | 1 - .../__mocks__/kea_logic/kibana_logic.mock.ts | 1 - .../components/inference_endpoints.tsx | 41 ---------- .../components/layout/index.ts | 8 -- .../components/layout/page_template.test.tsx | 79 ------------------- .../components/layout/page_template.tsx | 37 --------- .../components/not_found/index.ts | 8 -- .../components/not_found/not_found.test.tsx | 38 --------- .../components/not_found/not_found.tsx | 23 ------ .../index.test.tsx | 23 ------ .../enterprise_search_relevance/index.tsx | 41 ---------- .../jest.config.js | 28 ------- .../enterprise_search_relevance/routes.ts | 10 --- .../public/applications/index.tsx | 1 - .../shared/kibana/kibana_logic.ts | 4 - .../kibana_chrome/generate_breadcrumbs.ts | 4 - .../shared/kibana_chrome/index.ts | 1 - .../shared/kibana_chrome/set_chrome.tsx | 14 ---- .../enterprise_search/public/plugin.ts | 57 +++---------- .../enterprise_search/server/plugin.ts | 2 - .../plugins/enterprise_search/tsconfig.json | 1 - .../common/translations.ts | 14 ++++ .../search_inference_endpoints/kibana.jsonc | 4 +- .../public/embeddable.tsx | 29 ------- .../use_inference_endpoints_breadcrumbs.ts | 27 +++++++ .../public/index.ts | 2 - .../public/inference_endpoints_overview.tsx | 17 ++-- .../public/plugin.ts | 44 ++++++++--- .../public/types.ts | 30 +++---- .../server/config.ts | 2 +- .../server/plugin.ts | 2 +- .../search_inference_endpoints/tsconfig.json | 8 +- .../hooks/use_playground_breadcrumbs.ts | 16 +++- .../translations/translations/fr-FR.json | 5 -- .../translations/translations/ja-JP.json | 4 - .../translations/translations/zh-CN.json | 5 -- 45 files changed, 133 insertions(+), 562 deletions(-) delete mode 100644 x-pack/plugins/enterprise_search/common/locators/inference_locator.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/inference_endpoints.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/index.ts delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.test.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/index.ts delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.test.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.test.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.tsx delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/jest.config.js delete mode 100644 x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/routes.ts delete mode 100644 x-pack/plugins/search_inference_endpoints/public/embeddable.tsx create mode 100644 x-pack/plugins/search_inference_endpoints/public/hooks/use_inference_endpoints_breadcrumbs.ts diff --git a/config/serverless.es.yml b/config/serverless.es.yml index 127a0c8362d7f..2d5ba84ece795 100644 --- a/config/serverless.es.yml +++ b/config/serverless.es.yml @@ -116,9 +116,6 @@ xpack.ml.compatibleModuleType: 'search' data_visualizer.resultLinks.fileBeat.enabled: false -# Search InferenceEndpoints -xpack.searchInferenceEndpoints.ui.enabled: true - # Search Notebooks xpack.search.notebooks.catalog.url: https://elastic-enterprise-search.s3.us-east-2.amazonaws.com/serverless/catalog.json diff --git a/config/serverless.oblt.yml b/config/serverless.oblt.yml index ef3c9fd23121e..937954a1c5e84 100644 --- a/config/serverless.oblt.yml +++ b/config/serverless.oblt.yml @@ -8,6 +8,7 @@ xpack.uptime.enabled: true xpack.securitySolution.enabled: false xpack.search.notebooks.enabled: false xpack.searchPlayground.enabled: false +xpack.searchInferenceEndpoints.enabled: false ## Fine-tune the observability solution feature privileges. Also, refer to `serverless.yml` for the project-agnostic overrides. xpack.features.overrides: diff --git a/config/serverless.security.yml b/config/serverless.security.yml index 1b75b4b06cb25..b9190df608540 100644 --- a/config/serverless.security.yml +++ b/config/serverless.security.yml @@ -9,6 +9,7 @@ xpack.observability.enabled: false xpack.observabilityAIAssistant.enabled: false xpack.search.notebooks.enabled: false xpack.searchPlayground.enabled: false +xpack.searchInferenceEndpoints.enabled: false ## Fine-tune the security solution feature privileges. Also, refer to `serverless.yml` for the project-agnostic overrides. xpack.features.overrides: diff --git a/packages/deeplinks/search/constants.ts b/packages/deeplinks/search/constants.ts index a458b38aff3cc..cd632c5b24a03 100644 --- a/packages/deeplinks/search/constants.ts +++ b/packages/deeplinks/search/constants.ts @@ -9,7 +9,6 @@ export const ENTERPRISE_SEARCH_APP_ID = 'enterpriseSearch'; export const ENTERPRISE_SEARCH_CONTENT_APP_ID = 'enterpriseSearchContent'; -export const ENTERPRISE_SEARCH_RELEVANCE_APP_ID = 'searchInferenceEndpoints'; export const ENTERPRISE_SEARCH_APPLICATIONS_APP_ID = 'enterpriseSearchApplications'; export const ENTERPRISE_SEARCH_ANALYTICS_APP_ID = 'enterpriseSearchAnalytics'; export const ENTERPRISE_SEARCH_APPSEARCH_APP_ID = 'appSearch'; diff --git a/packages/deeplinks/search/deep_links.ts b/packages/deeplinks/search/deep_links.ts index ede9bc303dbe5..dcba1f7888597 100644 --- a/packages/deeplinks/search/deep_links.ts +++ b/packages/deeplinks/search/deep_links.ts @@ -14,7 +14,6 @@ import { ENTERPRISE_SEARCH_APP_ID, ENTERPRISE_SEARCH_CONTENT_APP_ID, ENTERPRISE_SEARCH_APPLICATIONS_APP_ID, - ENTERPRISE_SEARCH_RELEVANCE_APP_ID, ENTERPRISE_SEARCH_ANALYTICS_APP_ID, ENTERPRISE_SEARCH_APPSEARCH_APP_ID, ENTERPRISE_SEARCH_WORKPLACESEARCH_APP_ID, @@ -33,7 +32,6 @@ import { export type EnterpriseSearchApp = typeof ENTERPRISE_SEARCH_APP_ID; export type EnterpriseSearchContentApp = typeof ENTERPRISE_SEARCH_CONTENT_APP_ID; export type EnterpriseSearchApplicationsApp = typeof ENTERPRISE_SEARCH_APPLICATIONS_APP_ID; -export type EnterpriseSearchRelevanceApp = typeof ENTERPRISE_SEARCH_RELEVANCE_APP_ID; export type EnterpriseSearchAnalyticsApp = typeof ENTERPRISE_SEARCH_ANALYTICS_APP_ID; export type EnterpriseSearchAppsearchApp = typeof ENTERPRISE_SEARCH_APPSEARCH_APP_ID; export type EnterpriseSearchWorkplaceSearchApp = typeof ENTERPRISE_SEARCH_WORKPLACESEARCH_APP_ID; @@ -56,7 +54,7 @@ export type ApplicationsLinkId = 'searchApplications'; export type AppsearchLinkId = 'engines'; -export type RelevanceLinkId = 'inferenceEndpoints'; +export type SearchInferenceEndpointsLinkId = 'inferenceEndpoints'; export type SearchIndicesLinkId = typeof SEARCH_INDICES_CREATE_INDEX; @@ -64,7 +62,6 @@ export type DeepLinkId = | EnterpriseSearchApp | EnterpriseSearchContentApp | EnterpriseSearchApplicationsApp - | EnterpriseSearchRelevanceApp | EnterpriseSearchAnalyticsApp | EnterpriseSearchAppsearchApp | EnterpriseSearchWorkplaceSearchApp @@ -77,7 +74,7 @@ export type DeepLinkId = | `${EnterpriseSearchContentApp}:${ContentLinkId}` | `${EnterpriseSearchApplicationsApp}:${ApplicationsLinkId}` | `${EnterpriseSearchAppsearchApp}:${AppsearchLinkId}` - | `${EnterpriseSearchRelevanceApp}:${RelevanceLinkId}` + | `${SearchInferenceEndpointsId}:${SearchInferenceEndpointsLinkId}` | SearchStart | SearchIndices | SearchElasticsearch diff --git a/packages/deeplinks/search/index.ts b/packages/deeplinks/search/index.ts index 69110f36deb45..2b3d392971a5f 100644 --- a/packages/deeplinks/search/index.ts +++ b/packages/deeplinks/search/index.ts @@ -10,7 +10,6 @@ export { ENTERPRISE_SEARCH_APP_ID, ENTERPRISE_SEARCH_CONTENT_APP_ID, - ENTERPRISE_SEARCH_RELEVANCE_APP_ID, ENTERPRISE_SEARCH_APPLICATIONS_APP_ID, ENTERPRISE_SEARCH_ANALYTICS_APP_ID, ENTERPRISE_SEARCH_APPSEARCH_APP_ID, diff --git a/x-pack/plugins/enterprise_search/common/constants.ts b/x-pack/plugins/enterprise_search/common/constants.ts index 2603ea3d89018..13afad3f1a342 100644 --- a/x-pack/plugins/enterprise_search/common/constants.ts +++ b/x-pack/plugins/enterprise_search/common/constants.ts @@ -10,7 +10,6 @@ import dedent from 'dedent'; import { ENTERPRISE_SEARCH_APP_ID, ENTERPRISE_SEARCH_CONTENT_APP_ID, - ENTERPRISE_SEARCH_RELEVANCE_APP_ID, ENTERPRISE_SEARCH_APPLICATIONS_APP_ID, ENTERPRISE_SEARCH_ANALYTICS_APP_ID, ENTERPRISE_SEARCH_APPSEARCH_APP_ID, @@ -200,22 +199,6 @@ export const SEMANTIC_SEARCH_PLUGIN = { URL: '/app/enterprise_search/semantic_search', }; -export const SEARCH_RELEVANCE_PLUGIN = { - ID: ENTERPRISE_SEARCH_RELEVANCE_APP_ID, - NAME: i18n.translate('xpack.enterpriseSearch.inferenceEndpoints.productName', { - defaultMessage: 'Inference Endpoints', - }), - NAV_TITLE: i18n.translate('xpack.enterpriseSearch.inferenceEndpoints.navTitle', { - defaultMessage: 'Relevance', - }), - DESCRIPTION: i18n.translate('xpack.enterpriseSearch.inferenceEndpoints.description', { - defaultMessage: 'Manage your inference endpoints for semantic search and AI use cases.', - }), - URL: '/app/elasticsearch/relevance', - LOGO: 'logoEnterpriseSearch', - SUPPORT_URL: 'https://discuss.elastic.co/c/enterprise-search/', -}; - export const CREATE_CONNECTOR_PLUGIN = { CLI_SNIPPET: dedent`./bin/connectors connector create --index-name my-index diff --git a/x-pack/plugins/enterprise_search/common/locators/index.ts b/x-pack/plugins/enterprise_search/common/locators/index.ts index 3c3597fe4f161..e89c31a2f589b 100644 --- a/x-pack/plugins/enterprise_search/common/locators/index.ts +++ b/x-pack/plugins/enterprise_search/common/locators/index.ts @@ -6,15 +6,12 @@ */ import type { SharePluginSetup } from '@kbn/share-plugin/public'; -import { SerializableRecord } from '@kbn/utility-types'; import { CreateIndexLocatorDefinition, type CreateIndexLocatorParams, } from './create_index_locator'; -import { SearchInferenceEndpointLocatorDefinition } from './inference_locator'; export function registerLocators(share: SharePluginSetup) { share.url.locators.create(new CreateIndexLocatorDefinition()); - share.url.locators.create(new SearchInferenceEndpointLocatorDefinition()); } diff --git a/x-pack/plugins/enterprise_search/common/locators/inference_locator.tsx b/x-pack/plugins/enterprise_search/common/locators/inference_locator.tsx deleted file mode 100644 index f20d628bf1899..0000000000000 --- a/x-pack/plugins/enterprise_search/common/locators/inference_locator.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 type { LocatorDefinition } from '@kbn/share-plugin/common'; -import type { SharePluginSetup } from '@kbn/share-plugin/public'; -import type { SerializableRecord } from '@kbn/utility-types'; - -import { SEARCH_RELEVANCE_PLUGIN } from '../constants'; - -export function registerLocators(share: SharePluginSetup) { - share.url.locators.create(new SearchInferenceEndpointLocatorDefinition()); -} - -export class SearchInferenceEndpointLocatorDefinition - implements LocatorDefinition -{ - public readonly getLocation = async () => { - return { - app: SEARCH_RELEVANCE_PLUGIN.ID, - path: '/inference_endpoints', - state: {}, - }; - }; - - public readonly id = 'SEARCH_INFERENCE_ENDPOINTS'; -} diff --git a/x-pack/plugins/enterprise_search/kibana.jsonc b/x-pack/plugins/enterprise_search/kibana.jsonc index 65343904ba7fc..42e4db528a759 100644 --- a/x-pack/plugins/enterprise_search/kibana.jsonc +++ b/x-pack/plugins/enterprise_search/kibana.jsonc @@ -34,7 +34,6 @@ "guidedOnboarding", "console", "searchConnectors", - "searchInferenceEndpoints", "searchNavigation", "searchPlayground", "embeddable", diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts index 7af3dbc94343d..4dde6a5be527e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts @@ -65,7 +65,6 @@ export const mockKibanaValues = { hasWebCrawler: true, }, renderHeaderActions: jest.fn(), - searchInferenceEndpoints: null, security: securityMock.createStart(), setBreadcrumbs: jest.fn(), setChromeIsVisible: jest.fn(), diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/inference_endpoints.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/inference_endpoints.tsx deleted file mode 100644 index bc3ca80c1c751..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/inference_endpoints.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { useValues } from 'kea'; - -import { i18n } from '@kbn/i18n'; - -import { KibanaLogic } from '../../shared/kibana'; - -import { EnterpriseSearchRelevancePageTemplate } from './layout/page_template'; - -export const InferenceEndpoints: React.FC = () => { - const { searchInferenceEndpoints } = useValues(KibanaLogic); - - if (!searchInferenceEndpoints) { - return null; - } - return ( - - - - - - ); -}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/index.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/index.ts deleted file mode 100644 index 0a155ce20b555..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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 { EnterpriseSearchRelevancePageTemplate } from './page_template'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.test.tsx deleted file mode 100644 index 246c9835a015a..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.test.tsx +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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/nav', () => ({ - useEnterpriseSearchNav: () => [], -})); - -import React from 'react'; - -import { shallow } from 'enzyme'; - -import { i18n } from '@kbn/i18n'; - -import { SetEnterpriseSearchRelevanceChrome } from '../../../shared/kibana_chrome'; -import { EnterpriseSearchPageTemplateWrapper } from '../../../shared/layout'; -import { SendEnterpriseSearchTelemetry } from '../../../shared/telemetry'; - -import { EnterpriseSearchRelevancePageTemplate } from './page_template'; - -describe('EnterpriseSearchRelevancePageTemplate', () => { - it('renders', () => { - const wrapper = shallow( - -
- {i18n.translate('xpack.enterpriseSearch..div.worldLabel', { defaultMessage: 'world' })} -
-
- ); - - expect(wrapper.type()).toEqual(EnterpriseSearchPageTemplateWrapper); - expect(wrapper.prop('solutionNav')).toEqual({ items: [], name: 'Elasticsearch' }); - expect(wrapper.find('.hello').text()).toEqual('world'); - }); - - describe('page chrome', () => { - it('takes a breadcrumb array & renders a product-specific page chrome', () => { - const wrapper = shallow(); - const setPageChrome = wrapper - .find(EnterpriseSearchPageTemplateWrapper) - .prop('setPageChrome') as any; - - expect(setPageChrome.type).toEqual(SetEnterpriseSearchRelevanceChrome); - expect(setPageChrome.props.trail).toEqual(['Some page']); - }); - }); - - describe('page telemetry', () => { - it('takes a metric & renders product-specific telemetry viewed event', () => { - const wrapper = shallow( - - ); - - 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( - } - /> - ); - - 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(
); - }); - }); -}); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.tsx deleted file mode 100644 index 258b9c9a68ae1..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/layout/page_template.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { SEARCH_PRODUCT_NAME } from '../../../../../common/constants'; -import { SetEnterpriseSearchRelevanceChrome } from '../../../shared/kibana_chrome'; -import { EnterpriseSearchPageTemplateWrapper, PageTemplateProps } from '../../../shared/layout'; -import { useEnterpriseSearchNav } from '../../../shared/layout'; -import { SendEnterpriseSearchTelemetry } from '../../../shared/telemetry'; - -export const EnterpriseSearchRelevancePageTemplate: React.FC = ({ - children, - pageChrome, - pageViewTelemetry, - ...pageTemplateProps -}) => { - return ( - } - > - {pageViewTelemetry && ( - - )} - {children} - - ); -}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/index.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/index.ts deleted file mode 100644 index 482c1a58faa9c..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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 { NotFound } from './not_found'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.test.tsx deleted file mode 100644 index 7b5436958edb7..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.test.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { NotFoundPrompt } from '../../../shared/not_found'; -import { SendEnterpriseSearchTelemetry } from '../../../shared/telemetry'; -import { EnterpriseSearchRelevancePageTemplate } from '../layout'; - -import { NotFound } from '.'; - -describe('NotFound', () => { - const wrapper = shallow(); - - it('renders the shared not found prompt', () => { - expect(wrapper.find(NotFoundPrompt)).toHaveLength(1); - }); - - it('renders a telemetry error event', () => { - expect(wrapper.find(SendEnterpriseSearchTelemetry).prop('action')).toEqual('error'); - }); - - it('passes optional preceding page chrome', () => { - wrapper.setProps({ pageChrome: ['Inference Endpoints', 'some-index'] }); - - expect(wrapper.find(EnterpriseSearchRelevancePageTemplate).prop('pageChrome')).toEqual([ - 'Inference Endpoints', - 'some-index', - '404', - ]); - }); -}); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.tsx deleted file mode 100644 index 22f5e8d913bd8..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/components/not_found/not_found.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 { SEARCH_RELEVANCE_PLUGIN } from '../../../../../common/constants'; -import { PageTemplateProps } from '../../../shared/layout'; -import { NotFoundPrompt } from '../../../shared/not_found'; -import { SendEnterpriseSearchTelemetry } from '../../../shared/telemetry'; -import { EnterpriseSearchRelevancePageTemplate } from '../layout'; - -export const NotFound: React.FC = ({ pageChrome = [] }) => { - return ( - - - - - ); -}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.test.tsx deleted file mode 100644 index 6294a60128e2d..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.test.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 '../__mocks__/shallow_useeffect.mock'; -import '../__mocks__/enterprise_search_url.mock'; - -import React from 'react'; - -import { shallow } from 'enzyme'; - -import { EnterpriseSearchRelevance, EnterpriseSearchRelevanceConfigured } from '.'; - -describe('EnterpriseSearchRelevance', () => { - it('renders EnterpriseSearchRelevanceConfigured', () => { - const wrapper = shallow(); - - expect(wrapper.find(EnterpriseSearchRelevanceConfigured)).toHaveLength(1); - }); -}); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.tsx deleted file mode 100644 index 7594e514af54f..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { Redirect } from 'react-router-dom'; - -import { Route, Routes } from '@kbn/shared-ux-router'; - -import { InitialAppData } from '../../../common/types'; - -import { InferenceEndpoints } from './components/inference_endpoints'; -import { NotFound } from './components/not_found'; -import { INFERENCE_ENDPOINTS_PATH, ROOT_PATH } from './routes'; - -export const EnterpriseSearchRelevance: React.FC = (props) => { - return ( - - - )} /> - - - ); -}; - -export const EnterpriseSearchRelevanceConfigured: React.FC> = () => { - return ( - - - - - - - - - - ); -}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/jest.config.js b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/jest.config.js deleted file mode 100644 index d186396d14a07..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/jest.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ - -module.exports = { - preset: '@kbn/test', - rootDir: '../../../../../..', - roots: [ - '/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance', - ], - collectCoverage: true, - coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/x-pack/plugins/enterprise_search/public/applications/**/*.{ts,tsx}', - '!/x-pack/plugins/enterprise_search/public/*.ts', - '!/x-pack/plugins/enterprise_search/server/*.ts', - '!/x-pack/plugins/enterprise_search/public/applications/test_helpers/**/*.{ts,tsx}', - ], - coverageDirectory: - '/target/kibana-coverage/jest/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance', - modulePathIgnorePatterns: [ - '/x-pack/plugins/enterprise_search/public/applications/app_search/cypress', - '/x-pack/plugins/enterprise_search/public/applications/workplace_search/cypress', - ], -}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/routes.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/routes.ts deleted file mode 100644 index 5ea7ad1c781a8..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_relevance/routes.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * 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 = '/'; -export const ERROR_STATE_PATH = '/error_state'; -export const INFERENCE_ENDPOINTS_PATH = `${ROOT_PATH}inference_endpoints`; diff --git a/x-pack/plugins/enterprise_search/public/applications/index.tsx b/x-pack/plugins/enterprise_search/public/applications/index.tsx index 8cefb4cb733e5..d934932dd163f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/index.tsx @@ -129,7 +129,6 @@ export const renderApp = ( params.setHeaderActionMenu( HeaderActions ? renderHeaderActions.bind(null, HeaderActions, store, params) : undefined ), - searchInferenceEndpoints: plugins.searchInferenceEndpoints, security, setBreadcrumbs: chrome.setBreadcrumbs, setChromeIsVisible: chrome.setIsVisible, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts index 02a00a3198ee2..2185f0df344cc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts @@ -29,7 +29,6 @@ import { LensPublicStart } from '@kbn/lens-plugin/public'; import { MlPluginStart } from '@kbn/ml-plugin/public'; import { ELASTICSEARCH_URL_PLACEHOLDER } from '@kbn/search-api-panels/constants'; import { ConnectorDefinition } from '@kbn/search-connectors'; -import { SearchInferenceEndpointsPluginStart } from '@kbn/search-inference-endpoints/public'; import { AuthenticatedUser, SecurityPluginStart } from '@kbn/security-plugin/public'; import { SharePluginStart } from '@kbn/share-plugin/public'; @@ -66,7 +65,6 @@ export interface KibanaLogicProps { productAccess: ProductAccess; productFeatures: ProductFeatures; renderHeaderActions(HeaderActions?: FC): void; - searchInferenceEndpoints?: SearchInferenceEndpointsPluginStart; security?: SecurityPluginStart; setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void; setChromeIsVisible(isVisible: boolean): void; @@ -100,7 +98,6 @@ export interface KibanaValues { productAccess: ProductAccess; productFeatures: ProductFeatures; renderHeaderActions(HeaderActions?: FC): void; - searchInferenceEndpoints: SearchInferenceEndpointsPluginStart | null; security: SecurityPluginStart | null; setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void; setChromeIsVisible(isVisible: boolean): void; @@ -146,7 +143,6 @@ export const KibanaLogic = kea>({ productAccess: [props.productAccess, {}], productFeatures: [props.productFeatures, {}], renderHeaderActions: [props.renderHeaderActions, {}], - searchInferenceEndpoints: [props.searchInferenceEndpoints || null, {}], security: [props.security || null, {}], setBreadcrumbs: [props.setBreadcrumbs, {}], setChromeIsVisible: [props.setChromeIsVisible, {}], diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.ts index 189ca53e362e1..024a84858f108 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.ts @@ -14,7 +14,6 @@ import { ANALYTICS_PLUGIN, APP_SEARCH_PLUGIN, ENTERPRISE_SEARCH_CONTENT_PLUGIN, - SEARCH_RELEVANCE_PLUGIN, ENTERPRISE_SEARCH_PRODUCT_NAME, AI_SEARCH_PLUGIN, SEARCH_EXPERIENCES_PLUGIN, @@ -160,9 +159,6 @@ export const useEnterpriseSearchContentBreadcrumbs = (breadcrumbs: Breadcrumbs = ...breadcrumbs, ]); -export const useEnterpriseSearchRelevanceBreadcrumbs = (breadcrumbs: Breadcrumbs = []) => - useSearchBreadcrumbs([{ text: SEARCH_RELEVANCE_PLUGIN.NAV_TITLE, path: '/' }, ...breadcrumbs]); - export const useSearchExperiencesBreadcrumbs = (breadcrumbs: Breadcrumbs = []) => useSearchBreadcrumbs([{ text: SEARCH_EXPERIENCES_PLUGIN.NAV_TITLE, path: '/' }, ...breadcrumbs]); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/index.ts index f9a6564ab5f28..2da72eb28b6e9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/index.ts @@ -9,7 +9,6 @@ export { SetSearchChrome, SetAnalyticsChrome, SetEnterpriseSearchContentChrome, - SetEnterpriseSearchRelevanceChrome, SetElasticsearchChrome, SetAiSearchChrome, SetAppSearchChrome, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.tsx index 0c05cb0c02ca0..c556213ec8b42 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.tsx @@ -18,7 +18,6 @@ import { useEnterpriseSearchApplicationsBreadcrumbs, useAnalyticsBreadcrumbs, useEnterpriseSearchContentBreadcrumbs, - useEnterpriseSearchRelevanceBreadcrumbs, useAiSearchBreadcrumbs, useElasticsearchBreadcrumbs, useAppSearchBreadcrumbs, @@ -181,19 +180,6 @@ export const SetEnterpriseSearchContentChrome: React.FC = ({ tra return null; }; -export const SetEnterpriseSearchRelevanceChrome: React.FC = ({ trail = [] }) => { - const { setBreadcrumbs } = useValues(KibanaLogic); - - const crumbs = useGenerateBreadcrumbs(trail); - const breadcrumbs = useEnterpriseSearchRelevanceBreadcrumbs(crumbs); - - useEffect(() => { - setBreadcrumbs(breadcrumbs); - }, [trail]); - - return null; -}; - export const SetSearchExperiencesChrome: React.FC = ({ trail = [] }) => { const { setBreadcrumbs, setDocTitle } = useValues(KibanaLogic); diff --git a/x-pack/plugins/enterprise_search/public/plugin.ts b/x-pack/plugins/enterprise_search/public/plugin.ts index aa0a2e37c599c..b483796540ad1 100644 --- a/x-pack/plugins/enterprise_search/public/plugin.ts +++ b/x-pack/plugins/enterprise_search/public/plugin.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { BehaviorSubject, firstValueFrom } from 'rxjs'; +import { BehaviorSubject, firstValueFrom, type Subscription } from 'rxjs'; import { ChartsPluginStart } from '@kbn/charts-plugin/public'; import { CloudSetup, CloudStart } from '@kbn/cloud-plugin/public'; @@ -34,7 +34,6 @@ import { MlPluginStart } from '@kbn/ml-plugin/public'; import type { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public'; import { ELASTICSEARCH_URL_PLACEHOLDER } from '@kbn/search-api-panels/constants'; import { SearchConnectorsPluginStart } from '@kbn/search-connectors-plugin/public'; -import { SearchInferenceEndpointsPluginStart } from '@kbn/search-inference-endpoints/public'; import type { SearchNavigationPluginStart } from '@kbn/search-navigation/public'; import { SearchPlaygroundPluginStart } from '@kbn/search-playground/public'; import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/public'; @@ -53,7 +52,6 @@ import { VECTOR_SEARCH_PLUGIN, WORKPLACE_SEARCH_PLUGIN, SEMANTIC_SEARCH_PLUGIN, - SEARCH_RELEVANCE_PLUGIN, } from '../common/constants'; import { registerLocators } from '../common/locators'; import { ClientConfigType, InitialAppData, ProductAccess } from '../common/types'; @@ -67,7 +65,6 @@ import { CRAWLERS_PATH, } from './applications/enterprise_search_content/routes'; -import { INFERENCE_ENDPOINTS_PATH } from './applications/enterprise_search_relevance/routes'; import { docLinks } from './applications/shared/doc_links'; import type { DynamicSideNavItems } from './navigation_tree'; @@ -99,7 +96,6 @@ export interface PluginsStart { ml?: MlPluginStart; navigation: NavigationPublicPluginStart; searchConnectors?: SearchConnectorsPluginStart; - searchInferenceEndpoints?: SearchInferenceEndpointsPluginStart; searchNavigation?: SearchNavigationPluginStart; searchPlayground?: SearchPlaygroundPluginStart; security?: SecurityPluginStart; @@ -136,20 +132,6 @@ const contentLinks: AppDeepLink[] = [ }, ]; -const relevanceLinks: AppDeepLink[] = [ - { - id: 'inferenceEndpoints', - path: `/${INFERENCE_ENDPOINTS_PATH}`, - title: i18n.translate( - 'xpack.enterpriseSearch.navigation.relevanceInferenceEndpointsLinkLabel', - { - defaultMessage: 'Inference Endpoints', - } - ), - visibleIn: ['globalSearch'], - }, -]; - const applicationsLinks: AppDeepLink[] = [ { id: 'searchApplications', @@ -177,6 +159,7 @@ const appSearchLinks: AppDeepLink[] = [ export class EnterpriseSearchPlugin implements Plugin { private config: ClientConfigType; private enterpriseLicenseAppUpdater$ = new BehaviorSubject(() => ({})); + private licenseSubscription: Subscription | undefined; constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); @@ -432,33 +415,6 @@ export class EnterpriseSearchPlugin implements Plugin { title: ANALYTICS_PLUGIN.NAME, }); - core.application.register({ - appRoute: SEARCH_RELEVANCE_PLUGIN.URL, - category: DEFAULT_APP_CATEGORIES.enterpriseSearch, - deepLinks: relevanceLinks, - euiIconType: SEARCH_RELEVANCE_PLUGIN.LOGO, - id: SEARCH_RELEVANCE_PLUGIN.ID, - status: AppStatus.inaccessible, - updater$: this.enterpriseLicenseAppUpdater$, - mount: async (params: AppMountParameters) => { - const kibanaDeps = await this.getKibanaDeps(core, params, cloud); - const { chrome, http } = kibanaDeps.core; - chrome.docTitle.change(SEARCH_RELEVANCE_PLUGIN.NAME); - - await this.getInitialData(http); - const pluginData = this.getPluginData(); - - const { renderApp } = await import('./applications'); - const { EnterpriseSearchRelevance } = await import( - './applications/enterprise_search_relevance' - ); - - return renderApp(EnterpriseSearchRelevance, kibanaDeps, pluginData); - }, - title: SEARCH_RELEVANCE_PLUGIN.NAV_TITLE, - visibleIn: [], - }); - core.application.register({ appRoute: SEARCH_EXPERIENCES_PLUGIN.URL, category: DEFAULT_APP_CATEGORIES.enterpriseSearch, @@ -636,7 +592,7 @@ export class EnterpriseSearchPlugin implements Plugin { }); } - plugins.licensing?.license$.subscribe((license) => { + this.licenseSubscription = plugins.licensing?.license$.subscribe((license) => { if (hasEnterpriseLicense(license)) { this.enterpriseLicenseAppUpdater$.next(() => ({ status: AppStatus.accessible, @@ -653,7 +609,12 @@ export class EnterpriseSearchPlugin implements Plugin { return {}; } - public stop() {} + public stop() { + if (this.licenseSubscription) { + this.licenseSubscription.unsubscribe(); + this.licenseSubscription = undefined; + } + } private updateSideNavDefinition = (items: Partial) => { this.sideNavDynamicItems$.next({ ...this.sideNavDynamicItems$.getValue(), ...items }); diff --git a/x-pack/plugins/enterprise_search/server/plugin.ts b/x-pack/plugins/enterprise_search/server/plugin.ts index 4900fe2af29a2..6079e53e618e6 100644 --- a/x-pack/plugins/enterprise_search/server/plugin.ts +++ b/x-pack/plugins/enterprise_search/server/plugin.ts @@ -47,7 +47,6 @@ import { AI_SEARCH_PLUGIN, APPLICATIONS_PLUGIN, SEARCH_PRODUCT_NAME, - SEARCH_RELEVANCE_PLUGIN, } from '../common/constants'; import { @@ -177,7 +176,6 @@ export class EnterpriseSearchPlugin implements Plugin { SEMANTIC_SEARCH_PLUGIN.ID, APPLICATIONS_PLUGIN.ID, AI_SEARCH_PLUGIN.ID, - SEARCH_RELEVANCE_PLUGIN.ID, ]; const isCloud = !!cloud?.cloudId; diff --git a/x-pack/plugins/enterprise_search/tsconfig.json b/x-pack/plugins/enterprise_search/tsconfig.json index de98a647e0a94..bd716c8ac169f 100644 --- a/x-pack/plugins/enterprise_search/tsconfig.json +++ b/x-pack/plugins/enterprise_search/tsconfig.json @@ -70,7 +70,6 @@ "@kbn/es-errors", "@kbn/search-connectors-plugin", "@kbn/search-playground", - "@kbn/search-inference-endpoints", "@kbn/utility-types", "@kbn/index-management-shared-types", "@kbn/deeplinks-search", diff --git a/x-pack/plugins/search_inference_endpoints/common/translations.ts b/x-pack/plugins/search_inference_endpoints/common/translations.ts index 8b63725c59f96..9d4238b494e6b 100644 --- a/x-pack/plugins/search_inference_endpoints/common/translations.ts +++ b/x-pack/plugins/search_inference_endpoints/common/translations.ts @@ -103,3 +103,17 @@ export const TRAINED_MODELS_STAT_GATHER_FAILED = i18n.translate( defaultMessage: 'Failed to retrieve trained model statistics', } ); + +export const BREADCRUMB_RELEVANCE = i18n.translate( + 'xpack.searchInferenceEndpoints.breadcrumbs.relevance', + { + defaultMessage: 'Relevance', + } +); + +export const BREADCRUMB_INFERENCE_ENDPOINTS = i18n.translate( + 'xpack.searchInferenceEndpoints.breadcrumbs.inferenceEndpoints', + { + defaultMessage: 'Inference Endpoints', + } +); diff --git a/x-pack/plugins/search_inference_endpoints/kibana.jsonc b/x-pack/plugins/search_inference_endpoints/kibana.jsonc index 25b7b391b955a..dca472a92d437 100644 --- a/x-pack/plugins/search_inference_endpoints/kibana.jsonc +++ b/x-pack/plugins/search_inference_endpoints/kibana.jsonc @@ -18,13 +18,15 @@ "requiredPlugins": [ "actions", "features", + "licensing", "ml", "share", ], "optionalPlugins": [ "cloud", "console", - "serverless" + "serverless", + "searchNavigation", ], "requiredBundles": [ "kibanaReact" diff --git a/x-pack/plugins/search_inference_endpoints/public/embeddable.tsx b/x-pack/plugins/search_inference_endpoints/public/embeddable.tsx deleted file mode 100644 index fb733ec7ff5e6..0000000000000 --- a/x-pack/plugins/search_inference_endpoints/public/embeddable.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 { dynamic } from '@kbn/shared-ux-utility'; -import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; -import { CoreStart } from '@kbn/core-lifecycle-browser'; -import { AppPluginStartDependencies } from './types'; - -export const InferenceEndpoints = dynamic(async () => ({ - default: (await import('./components/app')).App, -})); - -export const InferenceEndpointsProvider = dynamic(async () => ({ - default: (await import('./providers/inference_endpoints_provider')).InferenceEndpointsProvider, -})); - -export const getInferenceEndpointsProvider = - (core: CoreStart, services: AppPluginStartDependencies) => - (props: React.ComponentProps) => - ( - - - - ); diff --git a/x-pack/plugins/search_inference_endpoints/public/hooks/use_inference_endpoints_breadcrumbs.ts b/x-pack/plugins/search_inference_endpoints/public/hooks/use_inference_endpoints_breadcrumbs.ts new file mode 100644 index 0000000000000..c64326b84bea1 --- /dev/null +++ b/x-pack/plugins/search_inference_endpoints/public/hooks/use_inference_endpoints_breadcrumbs.ts @@ -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 { useEffect } from 'react'; + +import * as i18n from '../../common/translations'; +import { useKibana } from './use_kibana'; + +export const useInferenceEndpointsBreadcrumbs = () => { + const { searchNavigation } = useKibana().services; + + useEffect(() => { + searchNavigation?.breadcrumbs.setSearchBreadCrumbs( + [{ text: i18n.BREADCRUMB_RELEVANCE }, { text: i18n.BREADCRUMB_INFERENCE_ENDPOINTS }], + { forClassicChromeStyle: true } + ); + + return () => { + // Clear breadcrumbs on unmount; + searchNavigation?.breadcrumbs.clearBreadcrumbs(); + }; + }, [searchNavigation]); +}; diff --git a/x-pack/plugins/search_inference_endpoints/public/index.ts b/x-pack/plugins/search_inference_endpoints/public/index.ts index 1c9e267a18bde..b06f1f64b909d 100644 --- a/x-pack/plugins/search_inference_endpoints/public/index.ts +++ b/x-pack/plugins/search_inference_endpoints/public/index.ts @@ -17,5 +17,3 @@ export type { SearchInferenceEndpointsPluginSetup, SearchInferenceEndpointsPluginStart, } from './types'; - -export const INFERENCE_ENDPOINTS_UI_FLAG = 'inferenceEndpointsUi:enabled'; diff --git a/x-pack/plugins/search_inference_endpoints/public/inference_endpoints_overview.tsx b/x-pack/plugins/search_inference_endpoints/public/inference_endpoints_overview.tsx index 5dd017f263caa..cda1481765cd1 100644 --- a/x-pack/plugins/search_inference_endpoints/public/inference_endpoints_overview.tsx +++ b/x-pack/plugins/search_inference_endpoints/public/inference_endpoints_overview.tsx @@ -6,17 +6,18 @@ */ import React, { useMemo } from 'react'; - -import { EuiPageTemplate } from '@elastic/eui'; +import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; import { App } from './components/app'; +import { useInferenceEndpointsBreadcrumbs } from './hooks/use_inference_endpoints_breadcrumbs'; import { useKibana } from './hooks/use_kibana'; import { InferenceEndpointsProvider } from './providers/inference_endpoints_provider'; export const InferenceEndpointsOverview: React.FC = () => { const { - services: { console: consolePlugin }, + services: { console: consolePlugin, history, searchNavigation }, } = useKibana(); + useInferenceEndpointsBreadcrumbs(); const embeddableConsole = useMemo( () => (consolePlugin?.EmbeddableConsole ? : null), @@ -25,10 +26,16 @@ export const InferenceEndpointsOverview: React.FC = () => { return ( - + {embeddableConsole} - + ); }; diff --git a/x-pack/plugins/search_inference_endpoints/public/plugin.ts b/x-pack/plugins/search_inference_endpoints/public/plugin.ts index cb60f611b3bb3..0fcd0ef082489 100644 --- a/x-pack/plugins/search_inference_endpoints/public/plugin.ts +++ b/x-pack/plugins/search_inference_endpoints/public/plugin.ts @@ -5,8 +5,12 @@ * 2.0. */ +import { BehaviorSubject, type Subscription } from 'rxjs'; + import { AppMountParameters, + AppStatus, + AppUpdater, CoreSetup, CoreStart, Plugin, @@ -15,7 +19,6 @@ import { import { i18n } from '@kbn/i18n'; import { PLUGIN_ID, PLUGIN_NAME } from '../common/constants'; import { docLinks } from '../common/doc_links'; -import { InferenceEndpoints, getInferenceEndpointsProvider } from './embeddable'; import { AppPluginSetupDependencies, AppPluginStartDependencies, @@ -23,7 +26,6 @@ import { SearchInferenceEndpointsPluginSetup, SearchInferenceEndpointsPluginStart, } from './types'; -import { INFERENCE_ENDPOINTS_UI_FLAG } from '.'; import { registerLocators } from './locators'; import { INFERENCE_ENDPOINTS_PATH } from './components/routes'; @@ -31,6 +33,8 @@ export class SearchInferenceEndpointsPlugin implements Plugin { private config: SearchInferenceEndpointsConfigType; + private readonly appUpdater$ = new BehaviorSubject(() => ({})); + private licenseSubscription: Subscription | undefined; constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); @@ -40,11 +44,7 @@ export class SearchInferenceEndpointsPlugin core: CoreSetup, plugins: AppPluginSetupDependencies ): SearchInferenceEndpointsPluginSetup { - if ( - !this.config.ui?.enabled && - !core.uiSettings.get(INFERENCE_ENDPOINTS_UI_FLAG, false) - ) - return {}; + if (!this.config.ui?.enabled) return {}; core.application.register({ id: PLUGIN_ID, appRoute: '/app/elasticsearch/relevance', @@ -55,9 +55,12 @@ export class SearchInferenceEndpointsPlugin title: i18n.translate('xpack.searchInferenceEndpoints.InferenceEndpointsLinkLabel', { defaultMessage: 'Inference Endpoints', }), + visibleIn: ['globalSearch'], }, ], + status: AppStatus.inaccessible, title: PLUGIN_NAME, + updater$: this.appUpdater$, async mount({ element, history }: AppMountParameters) { const { renderApp } = await import('./application'); const [coreStart, depsStart] = await core.getStartServices(); @@ -66,8 +69,11 @@ export class SearchInferenceEndpointsPlugin history, }; + depsStart.searchNavigation?.handleOnAppMount(); + return renderApp(coreStart, startDeps, element); }, + visibleIn: [], }); registerLocators(plugins.share); @@ -79,13 +85,27 @@ export class SearchInferenceEndpointsPlugin core: CoreStart, deps: AppPluginStartDependencies ): SearchInferenceEndpointsPluginStart { + const { licensing } = deps; docLinks.setDocLinks(core.docLinks.links); - return { - InferenceEdnpointsProvider: getInferenceEndpointsProvider(core, deps), - InferenceEndpoints, - }; + this.licenseSubscription = licensing.license$.subscribe((license) => { + const status: AppStatus = + license && license.isAvailable && license.isActive && license.hasAtLeast('enterprise') + ? AppStatus.accessible + : AppStatus.inaccessible; + + this.appUpdater$.next(() => ({ + status, + })); + }); + + return {}; } - public stop() {} + public stop() { + if (this.licenseSubscription) { + this.licenseSubscription.unsubscribe(); + this.licenseSubscription = undefined; + } + } } diff --git a/x-pack/plugins/search_inference_endpoints/public/types.ts b/x-pack/plugins/search_inference_endpoints/public/types.ts index 9f73d0d0033b0..1ebd803229e50 100644 --- a/x-pack/plugins/search_inference_endpoints/public/types.ts +++ b/x-pack/plugins/search_inference_endpoints/public/types.ts @@ -6,29 +6,27 @@ */ import type { ConsolePluginSetup, ConsolePluginStart } from '@kbn/console-plugin/public'; -import { HttpStart } from '@kbn/core-http-browser'; -import { AppMountParameters } from '@kbn/core/public'; -import { MlPluginStart } from '@kbn/ml-plugin/public'; -import { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; -import React from 'react'; - +import type { AppMountParameters, CoreStart } from '@kbn/core/public'; +import type { MlPluginStart } from '@kbn/ml-plugin/public'; +import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; +import type { SearchNavigationPluginStart } from '@kbn/search-navigation/public'; import type { ServerlessPluginStart } from '@kbn/serverless/public'; -import type { App } from './components/app'; -import type { InferenceEndpointsProvider } from './providers/inference_endpoints_provider'; +import type { LicensingPluginStart } from '@kbn/licensing-plugin/public'; export * from '../common/types'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface SearchInferenceEndpointsPluginSetup {} -export interface SearchInferenceEndpointsPluginStart { - InferenceEdnpointsProvider: React.FC>; - InferenceEndpoints: React.FC>; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchInferenceEndpointsPluginStart {} export interface AppPluginStartDependencies { history: AppMountParameters['history']; share: SharePluginStart; console?: ConsolePluginStart; + licensing: LicensingPluginStart; + ml: MlPluginStart; + searchNavigation?: SearchNavigationPluginStart; serverless?: ServerlessPluginStart; } @@ -38,13 +36,7 @@ export interface AppPluginSetupDependencies { console?: ConsolePluginSetup; } -export interface AppServicesContext { - http: HttpStart; - ml?: MlPluginStart; - console?: ConsolePluginStart; - serverless?: ServerlessPluginStart; - share: SharePluginStart; -} +export type AppServicesContext = CoreStart & AppPluginStartDependencies; export interface InferenceUsageResponse { acknowledge: boolean; diff --git a/x-pack/plugins/search_inference_endpoints/server/config.ts b/x-pack/plugins/search_inference_endpoints/server/config.ts index 5593fb2251aba..5fa8fbf5cfcbf 100644 --- a/x-pack/plugins/search_inference_endpoints/server/config.ts +++ b/x-pack/plugins/search_inference_endpoints/server/config.ts @@ -13,7 +13,7 @@ export * from './types'; const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: true }), ui: schema.object({ - enabled: schema.boolean({ defaultValue: false }), + enabled: schema.boolean({ defaultValue: true }), }), }); diff --git a/x-pack/plugins/search_inference_endpoints/server/plugin.ts b/x-pack/plugins/search_inference_endpoints/server/plugin.ts index 425820495e997..f7057ec6331c2 100644 --- a/x-pack/plugins/search_inference_endpoints/server/plugin.ts +++ b/x-pack/plugins/search_inference_endpoints/server/plugin.ts @@ -54,7 +54,7 @@ export class SearchInferenceEndpointsPlugin id: PLUGIN_ID, minimumLicense: 'enterprise', name: PLUGIN_NAME, - order: 0, + order: 2, category: DEFAULT_APP_CATEGORIES.enterpriseSearch, app: ['kibana', PLUGIN_ID], scope: [KibanaFeatureScope.Spaces, KibanaFeatureScope.Security], diff --git a/x-pack/plugins/search_inference_endpoints/tsconfig.json b/x-pack/plugins/search_inference_endpoints/tsconfig.json index 9a5b160779e7a..f448d36c7f463 100644 --- a/x-pack/plugins/search_inference_endpoints/tsconfig.json +++ b/x-pack/plugins/search_inference_endpoints/tsconfig.json @@ -12,7 +12,6 @@ "kbn_references": [ "@kbn/config-schema", "@kbn/core", - "@kbn/core-http-browser", "@kbn/i18n", "@kbn/i18n-react", "@kbn/kibana-react-plugin", @@ -22,8 +21,6 @@ "@kbn/core-http-server", "@kbn/share-plugin", "@kbn/actions-plugin", - "@kbn/shared-ux-utility", - "@kbn/core-lifecycle-browser", "@kbn/logging", "@kbn/react-kibana-context-render", "@kbn/doc-links", @@ -35,7 +32,10 @@ "@kbn/deeplinks-search", "@kbn/deeplinks-management", "@kbn/serverless", - "@kbn/utility-types" + "@kbn/utility-types", + "@kbn/search-navigation", + "@kbn/shared-ux-page-kibana-template", + "@kbn/licensing-plugin" ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts b/x-pack/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts index 8e3467a968b36..3fd64c3a7c2a7 100644 --- a/x-pack/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts +++ b/x-pack/plugins/search_playground/public/hooks/use_playground_breadcrumbs.ts @@ -6,6 +6,9 @@ */ import { useEffect } from 'react'; + +import { i18n } from '@kbn/i18n'; + import { useKibana } from './use_kibana'; export const usePlaygroundBreadcrumbs = () => { @@ -13,7 +16,18 @@ export const usePlaygroundBreadcrumbs = () => { useEffect(() => { searchNavigation?.breadcrumbs.setSearchBreadCrumbs( - [{ text: 'Build' }, { text: 'Playground' }], + [ + { + text: i18n.translate('xpack.searchPlayground.breadcrumbs.build', { + defaultMessage: 'Build', + }), + }, + { + text: i18n.translate('xpack.searchPlayground.breadcrumbs.playground', { + defaultMessage: 'Playground', + }), + }, + ], { forClassicChromeStyle: true } ); diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 397c73a512c10..81298783701e2 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -18243,9 +18243,6 @@ "xpack.enterpriseSearch.indexOverview.indexErrors.modelNotDeployedError": "Le modèle {modelId} pour le point de terminaison d'inférence {inferenceId} dans le champ {fieldName} n'a pas été démarré", "xpack.enterpriseSearch.indexOverview.indexErrors.showErrorsLabel": "Afficher l'erreur en intégralité", "xpack.enterpriseSearch.indexOverview.indexErrors.title": "L'index comporte des erreurs", - "xpack.enterpriseSearch.inferenceEndpoints.description": "Gérez vos points de terminaison d'inférence pour la recherche sémantique et les cas d'utilisation de l'IA.", - "xpack.enterpriseSearch.inferenceEndpoints.navTitle": "Pertinence", - "xpack.enterpriseSearch.inferenceEndpoints.productName": "Points de terminaison d'inférence", "xpack.enterpriseSearch.inferencePipelineCard.action.delete": "Supprimer un pipeline", "xpack.enterpriseSearch.inferencePipelineCard.action.delete.disabledDescription": "Ce pipeline d'inférence ne peut pas être supprimé car il est utilisé dans plusieurs pipelines [{indexReferences}]. Pour le supprimer, vous devez le détacher des autres pipelines pour ne garder qu'un seul pipeline d'ingestion.", "xpack.enterpriseSearch.inferencePipelineCard.action.detach": "Détacher le pipeline", @@ -18341,7 +18338,6 @@ "xpack.enterpriseSearch.navigation.contentConnectorsLinkLabel": "Connecteurs", "xpack.enterpriseSearch.navigation.contentIndicesLinkLabel": "Index", "xpack.enterpriseSearch.navigation.contentWebcrawlersLinkLabel": "Robots d'indexation", - "xpack.enterpriseSearch.navigation.relevanceInferenceEndpointsLinkLabel": "Points de terminaison d'inférence", "xpack.enterpriseSearch.notFound.action1": "Retour à votre tableau de bord", "xpack.enterpriseSearch.notFound.action2": "Contacter le support technique", "xpack.enterpriseSearch.notFound.description": "Impossible de trouver la page que vous recherchez.", @@ -18386,7 +18382,6 @@ "xpack.enterpriseSearch.productSelector.overview.title": "Ingérer votre contenu", "xpack.enterpriseSearch.productSelectorCalloutTitle": "Mettez à niveau pour obtenir des fonctionnalités de niveau entreprise pour votre équipe", "xpack.enterpriseSearch.readOnlyMode.warning": "Enterprise Search est en mode de lecture seule. Vous ne pourrez pas effectuer de changements tels que création, modification ou suppression.", - "xpack.enterpriseSearch.relevance.inferenceEndpoints.breadcrumb": "Points de terminaison d'inférence", "xpack.enterpriseSearch.required": "Obligatoire", "xpack.enterpriseSearch.researchConfiguration.euiText.checkRequirementsLabel": "Vérifier les exigences", "xpack.enterpriseSearch.researchConfiguration.p.referToTheDocumentationLabel": "Consultez la documentation de ce connecteur pour en apprendre plus sur les prérequis de connexion à {serviceType} ainsi que les prérequis de configuration.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 37f24051c6001..ca80aaa127e32 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -18103,8 +18103,6 @@ "xpack.enterpriseSearch.indexOverview.indexErrors.modelNotDeployedError": "フィールド{fieldName}で推論エンドポイント{inferenceId}のモデル{modelId}は開始されていません。", "xpack.enterpriseSearch.indexOverview.indexErrors.showErrorsLabel": "完全なエラーを表示", "xpack.enterpriseSearch.indexOverview.indexErrors.title": "インデックスにはエラーがあります", - "xpack.enterpriseSearch.inferenceEndpoints.description": "セマンティック検索やAIのユースケースに対応する推論エンドポイントを管理します。", - "xpack.enterpriseSearch.inferenceEndpoints.productName": "推論エンドポイント", "xpack.enterpriseSearch.inferencePipelineCard.action.delete": "パイプラインを削除", "xpack.enterpriseSearch.inferencePipelineCard.action.delete.disabledDescription": "この推論パイプラインは削除できません。複数のパイプライン[{indexReferences}]で使用されています。削除する前に、1つのインジェストパイプライン以外のすべてからこのパイプラインをデタッチする必要があります。", "xpack.enterpriseSearch.inferencePipelineCard.action.detach": "パイプラインのデタッチ", @@ -18199,7 +18197,6 @@ "xpack.enterpriseSearch.navigation.contentConnectorsLinkLabel": "コネクター", "xpack.enterpriseSearch.navigation.contentIndicesLinkLabel": "インデックス", "xpack.enterpriseSearch.navigation.contentWebcrawlersLinkLabel": "Webクローラー", - "xpack.enterpriseSearch.navigation.relevanceInferenceEndpointsLinkLabel": "推論エンドポイント", "xpack.enterpriseSearch.notFound.action1": "ダッシュボードに戻す", "xpack.enterpriseSearch.notFound.action2": "サポートに問い合わせる", "xpack.enterpriseSearch.notFound.description": "お探しのページは見つかりませんでした。", @@ -18244,7 +18241,6 @@ "xpack.enterpriseSearch.productSelector.overview.title": "データをインジェスト", "xpack.enterpriseSearch.productSelectorCalloutTitle": "チームのためのエンタープライズレベルの機能を実現できるようにアップグレード", "xpack.enterpriseSearch.readOnlyMode.warning": "エンタープライズ サーチは読み取り専用モードです。作成、編集、削除などの変更を実行できません。", - "xpack.enterpriseSearch.relevance.inferenceEndpoints.breadcrumb": "推論エンドポイント", "xpack.enterpriseSearch.required": "必須", "xpack.enterpriseSearch.researchConfiguration.euiText.checkRequirementsLabel": "要件を確認", "xpack.enterpriseSearch.researchConfiguration.p.referToTheDocumentationLabel": "{serviceType}に接続するための前提条件と構成要件については、このコネクターのドキュメントを参照してください。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 67f0cee7591ff..31eb102ba6780 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -17800,9 +17800,6 @@ "xpack.enterpriseSearch.indexOverview.indexErrors.modelNotDeployedError": "字段 {fieldName} 中用于推理终端 {inferenceId} 的模型 {modelId} 尚未启动", "xpack.enterpriseSearch.indexOverview.indexErrors.showErrorsLabel": "显示完整错误", "xpack.enterpriseSearch.indexOverview.indexErrors.title": "索引包含错误", - "xpack.enterpriseSearch.inferenceEndpoints.description": "管理您用于语义搜索和 AI 用例的推理终端。", - "xpack.enterpriseSearch.inferenceEndpoints.navTitle": "相关性", - "xpack.enterpriseSearch.inferenceEndpoints.productName": "推理终端", "xpack.enterpriseSearch.inferencePipelineCard.action.delete": "删除管道", "xpack.enterpriseSearch.inferencePipelineCard.action.delete.disabledDescription": "无法删除此推理管道,因为它已用在多个管道中 [{indexReferences}]。您必须将此管道从所有管道(一个采集管道除外)分离,然后才能将其删除。", "xpack.enterpriseSearch.inferencePipelineCard.action.detach": "分离管道", @@ -17897,7 +17894,6 @@ "xpack.enterpriseSearch.navigation.contentConnectorsLinkLabel": "连接器", "xpack.enterpriseSearch.navigation.contentIndicesLinkLabel": "索引", "xpack.enterpriseSearch.navigation.contentWebcrawlersLinkLabel": "网络爬虫", - "xpack.enterpriseSearch.navigation.relevanceInferenceEndpointsLinkLabel": "推理终端", "xpack.enterpriseSearch.notFound.action1": "返回到您的仪表板", "xpack.enterpriseSearch.notFound.action2": "联系支持人员", "xpack.enterpriseSearch.notFound.description": "找不到您要查找的页面。", @@ -17942,7 +17938,6 @@ "xpack.enterpriseSearch.productSelector.overview.title": "采集您的内容", "xpack.enterpriseSearch.productSelectorCalloutTitle": "进行升级以便为您的团队获取企业级功能", "xpack.enterpriseSearch.readOnlyMode.warning": "企业搜索处于只读模式。您将无法执行更改,例如创建、编辑或删除。", - "xpack.enterpriseSearch.relevance.inferenceEndpoints.breadcrumb": "推理终端", "xpack.enterpriseSearch.required": "必需", "xpack.enterpriseSearch.researchConfiguration.euiText.checkRequirementsLabel": "检查要求", "xpack.enterpriseSearch.researchConfiguration.p.referToTheDocumentationLabel": "请参阅此连接器的文档了解连接到 {serviceType} 的先决条件和配置要求。",