From c84e7163a73527fd92d7e2da6668f7d0ab86bd15 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Tue, 30 Apr 2024 11:31:13 +0200 Subject: [PATCH] Revert "[Discover][Obs ai assistant] Set the index pattern on the context api to generate correct ES|QL queries etc (#181001)" (#182088) This reverts commit 9edb9d5734ee6eeadd6b2d8362a063cfc8ab3c8f. --- src/plugins/discover/kibana.jsonc | 3 +-- .../main/components/layout/discover_layout.tsx | 11 ----------- src/plugins/discover/public/build_services.ts | 3 --- src/plugins/discover/public/plugin.tsx | 6 ------ src/plugins/discover/tsconfig.json | 3 +-- 5 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/plugins/discover/kibana.jsonc b/src/plugins/discover/kibana.jsonc index 9b892ee79fe16..17693545dd6d0 100644 --- a/src/plugins/discover/kibana.jsonc +++ b/src/plugins/discover/kibana.jsonc @@ -37,8 +37,7 @@ "savedObjectsTaggingOss", "lens", "noDataPage", - "globalSearch", - "observabilityAIAssistant" + "globalSearch" ], "requiredBundles": ["kibanaUtils", "kibanaReact", "unifiedSearch", "savedObjects"], "extraPublicDirs": ["common"] diff --git a/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx b/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx index a104dc3c9d73b..344e0b36c9d0e 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx @@ -71,7 +71,6 @@ export function DiscoverLayout({ stateContainer }: DiscoverLayoutProps) { filterManager, history, spaces, - observabilityAIAssistant, } = useDiscoverServices(); const pageBackgroundColor = useEuiBackgroundColor('plain'); const globalQueryState = data.query.getState(); @@ -133,16 +132,6 @@ export function DiscoverLayout({ stateContainer }: DiscoverLayoutProps) { sort, }); - // The assistant is getting the state from the url correctly - // expect from the index pattern where we have only the dataview id - useEffect(() => { - return observabilityAIAssistant?.service.setScreenContext({ - screenDescription: `The user is looking at the Discover view on the ${ - isPlainRecord ? 'ES|QL' : 'dataView' - } mode. The index pattern is the ${dataView.getIndexPattern()}`, - }); - }, [dataView, isPlainRecord, observabilityAIAssistant?.service]); - const onAddFilter = useCallback( (field: DataViewField | string, values: unknown, operation: '+' | '-') => { const fieldName = typeof field === 'string' ? field : field.name; diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index 7f7bcdee2154b..fc599bd59620e 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -54,7 +54,6 @@ import type { LensPublicStart } from '@kbn/lens-plugin/public'; import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { SettingsStart } from '@kbn/core-ui-settings-browser'; import type { ContentClient } from '@kbn/content-management-plugin/public'; -import type { ObservabilityAIAssistantPublicStart } from '@kbn/observability-ai-assistant-plugin/public'; import { memoize, noop } from 'lodash'; import type { NoDataPagePluginStart } from '@kbn/no-data-page-plugin/public'; import { DiscoverStartPlugins } from './plugin'; @@ -124,7 +123,6 @@ export interface DiscoverServices { uiActions: UiActionsStart; contentClient: ContentClient; noDataPage?: NoDataPagePluginStart; - observabilityAIAssistant?: ObservabilityAIAssistantPublicStart; } export const buildServices = memoize( @@ -205,7 +203,6 @@ export const buildServices = memoize( uiActions: plugins.uiActions, contentClient: plugins.contentManagement.client, noDataPage: plugins.noDataPage, - observabilityAIAssistant: plugins.observabilityAIAssistant, }; } ); diff --git a/src/plugins/discover/public/plugin.tsx b/src/plugins/discover/public/plugin.tsx index 902cc0a38e717..46cbf95d299b1 100644 --- a/src/plugins/discover/public/plugin.tsx +++ b/src/plugins/discover/public/plugin.tsx @@ -46,10 +46,6 @@ import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public'; import type { LensPublicStart } from '@kbn/lens-plugin/public'; import { TRUNCATE_MAX_HEIGHT, ENABLE_ESQL } from '@kbn/discover-utils'; import type { NoDataPagePluginStart } from '@kbn/no-data-page-plugin/public'; -import type { - ObservabilityAIAssistantPublicSetup, - ObservabilityAIAssistantPublicStart, -} from '@kbn/observability-ai-assistant-plugin/public'; import { PLUGIN_ID } from '../common'; import { registerFeature } from './register_feature'; import { buildServices, UrlTracker } from './build_services'; @@ -170,7 +166,6 @@ export interface DiscoverSetupPlugins { data: DataPublicPluginSetup; expressions: ExpressionsSetup; globalSearch?: GlobalSearchPluginSetup; - observabilityAIAssistant?: ObservabilityAIAssistantPublicSetup; } /** @@ -201,7 +196,6 @@ export interface DiscoverStartPlugins { lens: LensPublicStart; contentManagement: ContentManagementPublicStart; noDataPage?: NoDataPagePluginStart; - observabilityAIAssistant?: ObservabilityAIAssistantPublicStart; } export type StartRenderServices = Pick; diff --git a/src/plugins/discover/tsconfig.json b/src/plugins/discover/tsconfig.json index 6b576f3a08c1a..b10dee36e3fb7 100644 --- a/src/plugins/discover/tsconfig.json +++ b/src/plugins/discover/tsconfig.json @@ -83,8 +83,7 @@ "@kbn/deeplinks-analytics", "@kbn/shared-ux-markdown", "@kbn/data-view-utils", - "@kbn/presentation-publishing", - "@kbn/observability-ai-assistant-plugin" + "@kbn/presentation-publishing" ], "exclude": ["target/**/*"] }