diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index 831852953b88..5870ea7def8e 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -42,7 +42,7 @@ import { IndexPatternsContract } from './index_patterns'; import { IndexPatternSelectProps, StatefulSearchBarProps } from './ui'; import { UsageCollectionSetup } from '../../usage_collection/public'; import { DataSourceStart } from './data_sources/datasource_services/types'; -import { ObservabilitySetup } from '../../../../plugins/dashboards-observability/public/types'; + export interface DataPublicPluginEnhancements { search: SearchEnhancements; } diff --git a/src/plugins/data/public/ui/query_string_input/language_switcher.tsx b/src/plugins/data/public/ui/query_string_input/language_switcher.tsx index c1f65d74c714..5ae279282735 100644 --- a/src/plugins/data/public/ui/query_string_input/language_switcher.tsx +++ b/src/plugins/data/public/ui/query_string_input/language_switcher.tsx @@ -43,19 +43,31 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@osd/i18n/react'; import React, { useState } from 'react'; -import { Observable } from 'rxjs'; import { useObservable } from 'react-use'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; +import { IDataPluginServices } from '../../types'; interface Props { language: string; onSelectLanguage: (newLanguage: string) => void; anchorPosition?: PopoverAnchorPosition; - currentApp$?: Observable; - useNewQuerySelector?: boolean; } export function QueryLanguageSwitcher(props: Props) { + const opensearchDashboards = useOpenSearchDashboards(); + const { application } = opensearchDashboards.services; + const currentApp$ = application?.currentAppId$; + + let useNewQuerySelector; + application?.applications$.subscribe((applications) => { + applications.forEach((applicationEntry) => { + if (applicationEntry.id === 'observability-dashboards') { + useNewQuerySelector = true; + return; + } + }); + }); + const dataExplorerOptions = [ { label: 'DQL', @@ -102,7 +114,7 @@ export function QueryLanguageSwitcher(props: Props) { setSelectedLanguage(newLanguage); }; - if (useObservable(props.currentApp$!, '') === 'data-explorer' && props.useNewQuerySelector) { + if (useObservable(currentApp$!, '') === 'data-explorer' && useNewQuerySelector) { return ( (); - const { - application, - uiSettings, - notifications, - storage, - appName, - docLinks, - } = opensearchDashboards.services; - - const currentApp = application?.currentAppId$; + const { uiSettings, notifications, storage, appName, docLinks } = opensearchDashboards.services; + const osdDQLDocs: string = docLinks!.links.opensearchDashboards.dql.base; const queryLanguage = props.query && props.query.language; @@ -220,8 +211,6 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { onSubmit={onInputSubmit} persistedLog={persistedLog} dataTestSubj={props.dataTestSubj} - currentApp$={currentApp} - useNewQuerySelector={props.useNewQuerySelector} /> ); diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx b/src/plugins/data/public/ui/query_string_input/query_string_input.tsx index 967803783e66..4eca674f89f4 100644 --- a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_string_input.tsx @@ -47,7 +47,6 @@ import { import { FormattedMessage } from '@osd/i18n/react'; import { debounce, compact, isEqual, isFunction } from 'lodash'; import { Toast } from 'src/core/public'; -import { Observable } from 'rxjs'; import { IDataPluginServices, IIndexPattern, Query } from '../..'; import { QuerySuggestion, QuerySuggestionTypes } from '../../autocomplete'; @@ -79,8 +78,6 @@ export interface QueryStringInputProps { size?: SuggestionsListSize; className?: string; isInvalid?: boolean; - currentApp$?: Observable; - useNewQuerySelector?: boolean; } interface Props extends QueryStringInputProps { @@ -709,8 +706,6 @@ export default class QueryStringInputUI extends Component { language={this.props.query.language} anchorPosition={this.props.languageSwitcherPopoverAnchorPosition} onSelectLanguage={this.onSelectLanguage} - currentApp$={this.props.currentApp$} - useNewQuerySelector={this.props.useNewQuerySelector} /> ); diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx index cbac4943701c..c739b955ff19 100644 --- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx @@ -188,7 +188,6 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) showAutoRefreshOnly={props.showAutoRefreshOnly} showDatePicker={props.showDatePicker} showFilterBar={props.showFilterBar} - useNewQuerySelector={props.useNewQuerySelector} showQueryBar={props.showQueryBar} showQueryInput={props.showQueryInput} showSaveQuery={props.showSaveQuery} diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx index 91d3785284fc..3231eabb31df 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx @@ -47,7 +47,6 @@ import { TimeRange, Query, Filter, IIndexPattern } from '../../../common'; import { FilterBar } from '../filter_bar/filter_bar'; import { SavedQueryMeta, SaveQueryForm } from '../saved_query_form'; import { SavedQueryManagementComponent } from '../saved_query_management'; -import { services } from '../../../../../../test/api_integration/services/index'; interface SearchBarInjectedDeps { opensearchDashboards: OpenSearchDashboardsReactContextValue; @@ -93,7 +92,6 @@ export interface SearchBarOwnProps { onRefresh?: (payload: { dateRange: TimeRange }) => void; indicateNoData?: boolean; - useNewQuerySelector?: boolean; } export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps; diff --git a/src/plugins/discover/opensearch_dashboards.json b/src/plugins/discover/opensearch_dashboards.json index f085df4f83da..bcbfc2096731 100644 --- a/src/plugins/discover/opensearch_dashboards.json +++ b/src/plugins/discover/opensearch_dashboards.json @@ -15,7 +15,7 @@ "uiActions", "visualizations" ], - "optionalPlugins": ["home", "share", "observabilityDashboards"], + "optionalPlugins": ["home", "share"], "requiredBundles": [ "home", "opensearchDashboardsUtils", diff --git a/src/plugins/discover/public/application/view_components/canvas/top_nav.tsx b/src/plugins/discover/public/application/view_components/canvas/top_nav.tsx index dcfe83147eda..feb7b91e7c5e 100644 --- a/src/plugins/discover/public/application/view_components/canvas/top_nav.tsx +++ b/src/plugins/discover/public/application/view_components/canvas/top_nav.tsx @@ -37,7 +37,6 @@ export const TopNav = ({ opts }: TopNavProps) => { data, chrome, osdUrlStateStorage, - useNewQuerySelector, } = services; const topNavLinks = savedSearch ? getTopNavLinks(services, inspectorAdapters, savedSearch) : []; @@ -91,7 +90,6 @@ export const TopNav = ({ opts }: TopNavProps) => { setMenuMountPoint={opts.setHeaderActionMenu} indexPatterns={indexPattern ? [indexPattern] : indexPatterns} onQuerySubmit={opts.onQuerySubmit} - useNewQuerySelector={useNewQuerySelector} /> ); }; diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index ee4b29370c8d..9b5506f0a3b2 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -82,7 +82,6 @@ export interface DiscoverServices { getSavedSearchUrlById: (id: string) => Promise; uiSettings: IUiSettingsClient; visualizations: VisualizationsStart; - useNewQuerySelector: boolean; } export function buildServices( diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 049a7e9c6173..8bae94dd1577 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -30,7 +30,6 @@ import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/publi import { stringify } from 'query-string'; import rison from 'rison-node'; import { lazy } from 'react'; -import { ObservabilityStart } from 'plugins/dashboards-observability/public/types'; import { DataPublicPluginStart, DataPublicPluginSetup, opensearchFilters } from '../../data/public'; import { SavedObjectLoader } from '../../saved_objects/public'; import { url } from '../../opensearch_dashboards_utils/public';