diff --git a/package.json b/package.json index dd9a24215f38..b41c6b834fd9 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dashboarding" ], "private": true, - "version": "2.11.0", + "version": "3.0.0", "branch": "main", "types": "./opensearch_dashboards.d.ts", "tsdocMetadata": "./build/tsdoc-metadata.json", diff --git a/plugins_internal/.gitignore b/plugins_internal/.gitignore deleted file mode 100644 index 86d0cb2726c6..000000000000 --- a/plugins_internal/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/src/plugins/data/opensearch_dashboards.json b/src/plugins/data/opensearch_dashboards.json index c357da7c28db..9dff517d5524 100644 --- a/src/plugins/data/opensearch_dashboards.json +++ b/src/plugins/data/opensearch_dashboards.json @@ -4,7 +4,7 @@ "server": true, "ui": true, "requiredPlugins": ["expressions", "uiActions"], - "optionalPlugins": ["usageCollection", "dataSource", "observability-dashboards"], + "optionalPlugins": ["usageCollection", "dataSource"], "extraPublicDirs": ["common", "common/utils/abort_utils", "common/index_patterns/utils.ts"], "requiredBundles": [ "usageCollection", diff --git a/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx b/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx index b96b24bde3b6..aaab4d57c830 100644 --- a/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx +++ b/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx @@ -117,8 +117,6 @@ export const DataSourceSelectable = ({ (selectedOptions: any) => onDataSourceSelect(selectedOptions), [onDataSourceSelect] ); - console.log("dataSourceOptionList", dataSourceOptionList) - console.log("selectedSource", selectedSources) return ( void; anchorPosition?: PopoverAnchorPosition; - currentApp$?: Observable + currentApp$?: Observable; + useNewQuerySelector?: boolean; } export function QueryLanguageSwitcher(props: Props) { const dataExplorerOptions = [ { - label: 'DQL' + label: 'DQL', }, { label: 'lucene', }, { - label: 'PPL' - } - ] - const [selectedLanguage, setSelectedLanguage] = useState([dataExplorerOptions[0]]) - + label: 'PPL', + }, + ]; + const [selectedLanguage, setSelectedLanguage] = useState([dataExplorerOptions[0]]); + const osdDQLDocs = useOpenSearchDashboards().services.docLinks?.links.opensearchDashboards.dql .base; const [isPopoverOpen, setIsPopoverOpen] = useState(false); @@ -85,8 +85,6 @@ export function QueryLanguageSwitcher(props: Props) { /> ); - - const button = ( ); - const handleLanguageChange = (newLanguage:any) => { - const queryLanguage = newLanguage[0].label === 'DQL' ? 'kuery' : newLanguage[0].label; - props.onSelectLanguage(queryLanguage) - setSelectedLanguage(newLanguage) - } + const handleLanguageChange = (newLanguage: any) => { + const queryLanguage = newLanguage[0].label === 'DQL' ? 'kuery' : newLanguage[0].label; + props.onSelectLanguage(queryLanguage); + setSelectedLanguage(newLanguage); + }; - if(props.currentApp$ && useObservable(props.currentApp$, '') === "data-explorer"){ + if (useObservable(props.currentApp$!, '') === 'data-explorer' && props.useNewQuerySelector) { return ( - ); - } - else{ - return ( - setIsPopoverOpen(false)} - repositionOnScroll - > - - - -
- -

- setIsPopoverOpen(false)} + repositionOnScroll + > + + + +

+ +

+ - {dqlFullName} - - ), - }} - /> -

-
- - - - - - - - ) : ( - - ) - } - checked={props.language === 'kuery'} - onChange={() => { - const newLanguage = props.language === 'lucene' ? 'kuery' : 'lucene'; - props.onSelectLanguage(newLanguage); - }} - data-test-subj="languageToggle" - /> - - -
+ OpenSearch Dashboards uses Lucene." + values={{ + docsLink: ( + + {dqlFullName} + + ), + }} + /> +

+
+ + + + + + + ) : ( + + ) + } + checked={props.language === 'kuery'} + onChange={() => { + const newLanguage = props.language === 'lucene' ? 'kuery' : 'lucene'; + props.onSelectLanguage(newLanguage); + }} + data-test-subj="languageToggle" + /> + + +
- ) + ); } - } - +} diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx index ab41db3a73af..7b41199e1412 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx @@ -83,6 +83,7 @@ export interface QueryBarTopRowProps { isDirty: boolean; timeHistory?: TimeHistoryContract; indicateNoData?: boolean; + useNewQuerySelector?: boolean; } // Needed for React.lazy @@ -92,7 +93,14 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { const [isQueryInputFocused, setIsQueryInputFocused] = useState(false); const opensearchDashboards = useOpenSearchDashboards(); - const { application, uiSettings, notifications, storage, appName, docLinks } = opensearchDashboards.services; + const { + application, + uiSettings, + notifications, + storage, + appName, + docLinks, + } = opensearchDashboards.services; const currentApp = application?.currentAppId$; const osdDQLDocs: string = docLinks!.links.opensearchDashboards.dql.base; @@ -213,6 +221,7 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { 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 4ca63eb75b22..967803783e66 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,6 +47,7 @@ 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'; @@ -59,7 +60,6 @@ import { QueryLanguageSwitcher } from './language_switcher'; import { PersistedLog, getQueryLog, matchPairs, toUser, fromUser } from '../../query'; import { SuggestionsListSize } from '../typeahead/suggestions_component'; import { SuggestionsComponent } from '..'; -import { Observable } from 'rxjs'; export interface QueryStringInputProps { indexPatterns: Array; @@ -79,7 +79,8 @@ export interface QueryStringInputProps { size?: SuggestionsListSize; className?: string; isInvalid?: boolean; - currentApp$?: Observable + currentApp$?: Observable; + useNewQuerySelector?: boolean; } interface Props extends QueryStringInputProps { @@ -122,7 +123,7 @@ export default class QueryStringInputUI extends Component { selectionEnd: null, indexPatterns: [], queryBarRect: undefined, - currentApp: undefined + currentApp: undefined, }; public inputRef: HTMLTextAreaElement | null = null; @@ -233,8 +234,6 @@ export default class QueryStringInputUI extends Component { if (this.persistedLog) { this.persistedLog.add(query.query); } - - console.log("on submit query language", query.language) this.props.onSubmit({ query: fromUser(query.query), language: query.language }); } }; @@ -463,8 +462,8 @@ export default class QueryStringInputUI extends Component { }; private onSelectLanguage = (language: string) => { - if(language === 'PPL'){ - this.services.application?.navigateToUrl('../observability-logs#/explorer') + if (language === 'PPL') { + this.services.application?.navigateToUrl('../observability-logs#/explorer'); return; } // Send telemetry info every time the user opts in or out of kuery @@ -711,6 +710,7 @@ export default class QueryStringInputUI extends Component { 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 c739b955ff19..cbac4943701c 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,6 +188,7 @@ 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 b05b18b6d64e..91d3785284fc 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx @@ -47,6 +47,7 @@ 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; @@ -92,6 +93,7 @@ export interface SearchBarOwnProps { onRefresh?: (payload: { dateRange: TimeRange }) => void; indicateNoData?: boolean; + useNewQuerySelector?: boolean; } export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps; @@ -418,6 +420,7 @@ class SearchBarUI extends Component { } dataTestSubj={this.props.dataTestSubj} indicateNoData={this.props.indicateNoData} + useNewQuerySelector={this.props.useNewQuerySelector} /> ); } diff --git a/src/plugins/discover/opensearch_dashboards.json b/src/plugins/discover/opensearch_dashboards.json index bcbfc2096731..f085df4f83da 100644 --- a/src/plugins/discover/opensearch_dashboards.json +++ b/src/plugins/discover/opensearch_dashboards.json @@ -15,7 +15,7 @@ "uiActions", "visualizations" ], - "optionalPlugins": ["home", "share"], + "optionalPlugins": ["home", "share", "observabilityDashboards"], "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 feb7b91e7c5e..dcfe83147eda 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,6 +37,7 @@ export const TopNav = ({ opts }: TopNavProps) => { data, chrome, osdUrlStateStorage, + useNewQuerySelector, } = services; const topNavLinks = savedSearch ? getTopNavLinks(services, inspectorAdapters, savedSearch) : []; @@ -90,6 +91,7 @@ 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 785e72536417..ee4b29370c8d 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -82,6 +82,7 @@ export interface DiscoverServices { getSavedSearchUrlById: (id: string) => Promise; uiSettings: IUiSettingsClient; visualizations: VisualizationsStart; + useNewQuerySelector: boolean; } export function buildServices( @@ -123,6 +124,7 @@ export function buildServices( toastNotifications: core.notifications.toasts, uiSettings: core.uiSettings, visualizations: plugins.visualizations, + useNewQuerySelector: !!plugins.observabilityDashboards, }; } diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index f8e0f254f925..049a7e9c6173 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -30,6 +30,7 @@ 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'; @@ -144,6 +145,7 @@ export interface DiscoverStartPlugins { urlForwarding: UrlForwardingStart; inspector: InspectorPublicPluginStart; visualizations: VisualizationsStart; + observabilityDashboards?: ObservabilityStart; } /**