diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index f322214812273..fda0d8e9fbc95 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -17,7 +17,7 @@ "xpack.idxMgmt": "legacy/plugins/index_management", "xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management", "xpack.infra": "legacy/plugins/infra", - "xpack.kueryAutocomplete": "legacy/plugins/kuery_autocomplete", + "xpack.data": "plugins/data_enhanced", "xpack.lens": "legacy/plugins/lens", "xpack.licensing": "plugins/licensing", "xpack.licenseMgmt": "legacy/plugins/license_management", diff --git a/x-pack/index.js b/x-pack/index.js index 9ab6e2ee322d9..e2d25ce87b26b 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -23,7 +23,6 @@ import { licenseManagement } from './legacy/plugins/license_management'; import { indexManagement } from './legacy/plugins/index_management'; import { indexLifecycleManagement } from './legacy/plugins/index_lifecycle_management'; import { spaces } from './legacy/plugins/spaces'; -import { kueryAutocompleteInitializer } from './legacy/plugins/kuery_autocomplete'; import { canvas } from './legacy/plugins/canvas'; import { infra } from './legacy/plugins/infra'; import { taskManager } from './legacy/plugins/task_manager'; @@ -65,7 +64,6 @@ module.exports = function(kibana) { licenseManagement(kibana), indexManagement(kibana), indexLifecycleManagement(kibana), - kueryAutocompleteInitializer(kibana), infra(kibana), taskManager(kibana), rollup(kibana), diff --git a/x-pack/legacy/plugins/kuery_autocomplete/index.ts b/x-pack/legacy/plugins/kuery_autocomplete/index.ts deleted file mode 100644 index 5f9d74ed799e6..0000000000000 --- a/x-pack/legacy/plugins/kuery_autocomplete/index.ts +++ /dev/null @@ -1,22 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { resolve } from 'path'; -import { Legacy } from 'kibana'; - -import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types'; - -export const kueryAutocompleteInitializer: LegacyPluginInitializer = ({ - Plugin, -}: LegacyPluginApi) => - new Plugin({ - id: 'kuery_autocomplete', - publicDir: resolve(__dirname, 'public'), - uiExports: { - hacks: [resolve(__dirname, 'public/legacy')], - }, - init: (server: Legacy.Server) => ({}), - } as Legacy.PluginSpecOptions); diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/legacy.ts b/x-pack/legacy/plugins/kuery_autocomplete/public/legacy.ts deleted file mode 100644 index 303fe8c557fbd..0000000000000 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/legacy.ts +++ /dev/null @@ -1,27 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { PluginInitializerContext } from 'src/core/public'; -import { npSetup, npStart } from 'ui/new_platform'; - -import { plugin } from './index'; -import { - KueryAutocompletePluginSetupDependencies, - KueryAutocompletePluginStartDependencies, -} from './plugin'; - -const pluginsSetup: Readonly = { - data: npSetup.plugins.data, -}; - -const pluginsStart: Readonly = { - data: npStart.plugins.data, -}; - -const pluginInstance = plugin({} as PluginInitializerContext); - -export const setup = pluginInstance.setup(npSetup.core, pluginsSetup); -export const start = pluginInstance.start(npStart.core, pluginsStart); diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/plugin.ts b/x-pack/legacy/plugins/kuery_autocomplete/public/plugin.ts deleted file mode 100644 index 81737c4636532..0000000000000 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/plugin.ts +++ /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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public'; -import { Plugin as DataPublicPlugin } from '../../../../../src/plugins/data/public'; -import { setAutocompleteService } from './services'; -import { setupKqlQuerySuggestionProvider } from './kql_query_suggestion'; - -/** @internal */ -export interface KueryAutocompletePluginSetupDependencies { - data: ReturnType; -} - -/** @internal */ -export interface KueryAutocompletePluginStartDependencies { - data: ReturnType; -} - -const KUERY_LANGUAGE_NAME = 'kuery'; - -/** @internal */ -export class KueryAutocompletePlugin implements Plugin, void> { - initializerContext: PluginInitializerContext; - - constructor(initializerContext: PluginInitializerContext) { - this.initializerContext = initializerContext; - } - - public async setup(core: CoreSetup, plugins: KueryAutocompletePluginSetupDependencies) { - const kueryProvider = setupKqlQuerySuggestionProvider(core); - - plugins.data.autocomplete.addQuerySuggestionProvider(KUERY_LANGUAGE_NAME, kueryProvider); - } - - public start(core: CoreStart, plugins: KueryAutocompletePluginStartDependencies) { - setAutocompleteService(plugins.data.autocomplete); - } -} diff --git a/x-pack/plugins/data_enhanced/kibana.json b/x-pack/plugins/data_enhanced/kibana.json new file mode 100644 index 0000000000000..4dbfe958eff68 --- /dev/null +++ b/x-pack/plugins/data_enhanced/kibana.json @@ -0,0 +1,13 @@ +{ + "id": "data_enhanced", + "version": "8.0.0", + "kibanaVersion": "kibana", + "configPath": [ + "xpack" + ], + "requiredPlugins": [ + "data" + ], + "server": false, + "ui": true +} diff --git a/x-pack/plugins/data_enhanced/public/autocomplete/index.ts b/x-pack/plugins/data_enhanced/public/autocomplete/index.ts new file mode 100644 index 0000000000000..59670a89d2caf --- /dev/null +++ b/x-pack/plugins/data_enhanced/public/autocomplete/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { + setupKqlQuerySuggestionProvider, + KUERY_LANGUAGE_NAME, +} from './providers/kql_query_suggestion'; diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/__fixtures__/index_pattern_response.json b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json similarity index 100% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/__fixtures__/index_pattern_response.json rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/conjunction.test.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts similarity index 93% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/conjunction.test.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts index e8aec0deec6d7..d993c3d8ad51d 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/conjunction.test.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts @@ -5,8 +5,8 @@ */ import { setupGetConjunctionSuggestions } from './conjunction'; -import { autocomplete, esKuery } from '../../../../../../src/plugins/data/public'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import { autocomplete, esKuery } from '../../../../../../../src/plugins/data/public'; +import { coreMock } from '../../../../../../../src/core/public/mocks'; const mockKueryNode = (kueryNode: Partial) => (kueryNode as unknown) as esKuery.KueryNode; diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/conjunction.tsx b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx similarity index 69% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/conjunction.tsx rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx index f570586274fdd..fa655562134cc 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/conjunction.tsx +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx @@ -7,21 +7,21 @@ import React from 'react'; import { $Keys } from 'utility-types'; import { FormattedMessage } from '@kbn/i18n/react'; import { KqlQuerySuggestionProvider } from './types'; -import { autocomplete } from '../../../../../../src/plugins/data/public'; +import { autocomplete } from '../../../../../../../src/plugins/data/public'; const bothArgumentsText = ( ); const oneOrMoreArgumentsText = ( ); @@ -29,20 +29,20 @@ const conjunctions: Record = { and: (

{bothArgumentsText}, }} description="Full text: ' Requires both arguments to be true'. See - 'xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText' for 'both arguments' part." + 'xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText' for 'both arguments' part." />

), or: (

= { ), }} description="Full text: 'Requires one or more arguments to be true'. See - 'xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText' for 'one or more arguments' part." + 'xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText' for 'one or more arguments' part." />

), diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/field.test.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/field.test.ts similarity index 98% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/field.test.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/field.test.ts index 2fd5cfd17eb69..d05fd49d266f2 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/field.test.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/field.test.ts @@ -6,8 +6,8 @@ import indexPatternResponse from './__fixtures__/index_pattern_response.json'; import { setupGetFieldSuggestions } from './field'; -import { isFilterable, autocomplete, esKuery } from '../../../../../../src/plugins/data/public'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import { isFilterable, autocomplete, esKuery } from '../../../../../../../src/plugins/data/public'; +import { coreMock } from '../../../../../../../src/core/public/mocks'; const mockKueryNode = (kueryNode: Partial) => (kueryNode as unknown) as esKuery.KueryNode; diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/field.tsx b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/field.tsx similarity index 94% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/field.tsx rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/field.tsx index a8af884c24fc3..f04312b925436 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/field.tsx +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/field.tsx @@ -8,14 +8,18 @@ import { flatten } from 'lodash'; import { FormattedMessage } from '@kbn/i18n/react'; import { escapeKuery } from './lib/escape_kuery'; import { sortPrefixFirst } from './sort_prefix_first'; -import { IFieldType, isFilterable, autocomplete } from '../../../../../../src/plugins/data/public'; +import { + IFieldType, + isFilterable, + autocomplete, +} from '../../../../../../../src/plugins/data/public'; import { KqlQuerySuggestionProvider } from './types'; const getDescription = (field: IFieldType) => { return (

{field.name} }} /> diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/index.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/index.ts similarity index 94% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/index.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/index.ts index 2cc15fe4c9280..6168ab8fc3462 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/index.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/index.ts @@ -11,13 +11,15 @@ import { setupGetFieldSuggestions } from './field'; import { setupGetValueSuggestions } from './value'; import { setupGetOperatorSuggestions } from './operator'; import { setupGetConjunctionSuggestions } from './conjunction'; -import { esKuery, autocomplete } from '../../../../../../src/plugins/data/public'; +import { esKuery, autocomplete } from '../../../../../../../src/plugins/data/public'; const cursorSymbol = '@kuery-cursor@'; const dedup = (suggestions: autocomplete.QuerySuggestion[]): autocomplete.QuerySuggestion[] => uniq(suggestions, ({ type, text, start, end }) => [type, text, start, end].join('|')); +export const KUERY_LANGUAGE_NAME = 'kuery'; + export const setupKqlQuerySuggestionProvider = ( core: CoreSetup ): autocomplete.QuerySuggestionsGetFn => { diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/lib/escape_kuery.test.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts similarity index 100% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/lib/escape_kuery.test.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/lib/escape_kuery.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts similarity index 100% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/lib/escape_kuery.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/operator.test.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/operator.test.ts similarity index 94% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/operator.test.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/operator.test.ts index acafc4e169c8f..7e564b96064ef 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/operator.test.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/operator.test.ts @@ -6,8 +6,8 @@ import indexPatternResponse from './__fixtures__/index_pattern_response.json'; import { setupGetOperatorSuggestions } from './operator'; -import { autocomplete, esKuery } from '../../../../../../src/plugins/data/public'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import { autocomplete, esKuery } from '../../../../../../../src/plugins/data/public'; +import { coreMock } from '../../../../../../../src/core/public/mocks'; const mockKueryNode = (kueryNode: Partial) => (kueryNode as unknown) as esKuery.KueryNode; diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/operator.tsx b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/operator.tsx similarity index 64% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/operator.tsx rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/operator.tsx index 6e9010c4310fb..af90e7bfe1172 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/operator.tsx +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/operator.tsx @@ -10,48 +10,48 @@ import { $Keys } from 'utility-types'; import { flatten } from 'lodash'; import { KqlQuerySuggestionProvider } from './types'; -import { autocomplete } from '../../../../../../src/plugins/data/public'; +import { autocomplete } from '../../../../../../../src/plugins/data/public'; const equalsText = ( ); const lessThanOrEqualToText = ( ); const greaterThanOrEqualToText = ( ); const lessThanText = ( ); const greaterThanText = ( ); const existsText = ( ); @@ -59,11 +59,11 @@ const operators = { ':': { description: ( {equalsText} }} description="Full text: 'equals some value'. See - 'xpack.kueryAutocomplete.equalOperatorDescription.equalsText' for 'equals' part." + 'xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText' for 'equals' part." /> ), fieldTypes: ['string', 'number', 'date', 'ip', 'geo_point', 'geo_shape', 'boolean'], @@ -71,7 +71,7 @@ const operators = { '<=': { description: ( ), fieldTypes: ['number', 'date', 'ip'], @@ -87,7 +87,7 @@ const operators = { '>=': { description: ( ), fieldTypes: ['number', 'date', 'ip'], @@ -103,11 +103,11 @@ const operators = { '<': { description: ( {lessThanText} }} description="Full text: 'is less than some value'. See - 'xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText' for 'less than' part." + 'xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText' for 'less than' part." /> ), fieldTypes: ['number', 'date', 'ip'], @@ -115,13 +115,13 @@ const operators = { '>': { description: ( {greaterThanText}, }} description="Full text: 'is greater than some value'. See - 'xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText' for 'greater than' part." + 'xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText' for 'greater than' part." /> ), fieldTypes: ['number', 'date', 'ip'], @@ -129,11 +129,11 @@ const operators = { ': *': { description: ( {existsText} }} description="Full text: 'exists in any form'. See - 'xpack.kueryAutocomplete.existOperatorDescription.existsText' for 'exists' part." + 'xpack.data.kueryAutocomplete.existOperatorDescription.existsText' for 'exists' part." /> ), fieldTypes: undefined, diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/sort_prefix_first.test.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts similarity index 100% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/sort_prefix_first.test.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/sort_prefix_first.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts similarity index 100% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/sort_prefix_first.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/types.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/types.ts similarity index 85% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/types.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/types.ts index c51b75e001b9f..8e3146ab09848 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/types.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/types.ts @@ -5,7 +5,7 @@ */ import { CoreSetup } from 'kibana/public'; -import { esKuery, autocomplete } from '../../../../../../src/plugins/data/public'; +import { esKuery, autocomplete } from '../../../../../../../src/plugins/data/public'; export type KqlQuerySuggestionProvider = ( core: CoreSetup diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/value.test.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/value.test.ts similarity index 96% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/value.test.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/value.test.ts index 5ffe30c877868..14eeabda97d1a 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/value.test.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/value.test.ts @@ -5,9 +5,9 @@ */ import { setupGetValueSuggestions } from './value'; import indexPatternResponse from './__fixtures__/index_pattern_response.json'; -import { coreMock } from '../../../../../../src/core/public/mocks'; -import { autocomplete, esKuery } from '../../../../../../src/plugins/data/public'; -import { setAutocompleteService } from '../services'; +import { coreMock } from '../../../../../../../src/core/public/mocks'; +import { autocomplete, esKuery } from '../../../../../../../src/plugins/data/public'; +import { setAutocompleteService } from '../../../services'; const mockKueryNode = (kueryNode: Partial) => (kueryNode as unknown) as esKuery.KueryNode; diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/value.ts b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/value.ts similarity index 93% rename from x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/value.ts rename to x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/value.ts index 242b9ccba3508..83b8024d8314d 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/kql_query_suggestion/value.ts +++ b/x-pack/plugins/data_enhanced/public/autocomplete/providers/kql_query_suggestion/value.ts @@ -7,8 +7,8 @@ import { flatten } from 'lodash'; import { escapeQuotes } from './lib/escape_kuery'; import { KqlQuerySuggestionProvider } from './types'; -import { getAutocompleteService } from '../services'; -import { autocomplete } from '../../../../../../src/plugins/data/public'; +import { getAutocompleteService } from '../../../services'; +import { autocomplete } from '../../../../../../../src/plugins/data/public'; const wrapAsSuggestions = (start: number, end: number, query: string, values: string[]) => values diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/index.ts b/x-pack/plugins/data_enhanced/public/index.ts similarity index 50% rename from x-pack/legacy/plugins/kuery_autocomplete/public/index.ts rename to x-pack/plugins/data_enhanced/public/index.ts index c2241f424511f..93b6b7a957182 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/index.ts +++ b/x-pack/plugins/data_enhanced/public/index.ts @@ -4,9 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { PluginInitializerContext } from 'src/core/public'; -import { KueryAutocompletePlugin as Plugin } from './plugin'; +import { DataEnhancedPlugin, DataEnhancedSetup, DataEnhancedStart } from './plugin'; -export function plugin(initializerContext: PluginInitializerContext) { - return new Plugin(initializerContext); -} +export const plugin = () => new DataEnhancedPlugin(); + +export { DataEnhancedSetup, DataEnhancedStart }; diff --git a/x-pack/plugins/data_enhanced/public/plugin.ts b/x-pack/plugins/data_enhanced/public/plugin.ts new file mode 100644 index 0000000000000..14b5382bc85aa --- /dev/null +++ b/x-pack/plugins/data_enhanced/public/plugin.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup, CoreStart, Plugin } from 'src/core/public'; +import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import { setAutocompleteService } from './services'; +import { setupKqlQuerySuggestionProvider, KUERY_LANGUAGE_NAME } from './autocomplete'; + +export interface DataEnhancedSetupDependencies { + data: DataPublicPluginSetup; +} +export interface DataEnhancedStartDependencies { + data: DataPublicPluginStart; +} + +export type DataEnhancedSetup = ReturnType; +export type DataEnhancedStart = ReturnType; + +export class DataEnhancedPlugin implements Plugin { + public setup(core: CoreSetup, plugins: DataEnhancedSetupDependencies) { + plugins.data.autocomplete.addQuerySuggestionProvider( + KUERY_LANGUAGE_NAME, + setupKqlQuerySuggestionProvider(core) + ); + } + + public start(core: CoreStart, plugins: DataEnhancedStartDependencies) { + setAutocompleteService(plugins.data.autocomplete); + } +} diff --git a/x-pack/legacy/plugins/kuery_autocomplete/public/services.ts b/x-pack/plugins/data_enhanced/public/services.ts similarity index 70% rename from x-pack/legacy/plugins/kuery_autocomplete/public/services.ts rename to x-pack/plugins/data_enhanced/public/services.ts index 1ec48e597f636..847b4c783fd7f 100644 --- a/x-pack/legacy/plugins/kuery_autocomplete/public/services.ts +++ b/x-pack/plugins/data_enhanced/public/services.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { createGetterSetter } from '../../../../../src/plugins/kibana_utils/public'; -import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; +import { createGetterSetter } from '../../../../src/plugins/kibana_utils/public'; +import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; export const [getAutocompleteService, setAutocompleteService] = createGetterSetter< DataPublicPluginStart['autocomplete'] diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 131a05ace4ec9..732cd6c1f8042 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -6754,23 +6754,23 @@ "xpack.infra.waffle.unableToSelectMetricErrorTitle": "メトリックのオプションまたは値を選択できません", "xpack.infra.waffleTime.autoRefreshButtonLabel": "自動更新", "xpack.infra.waffleTime.stopRefreshingButtonLabel": "更新中止", - "xpack.kueryAutocomplete.andOperatorDescription": "{bothArguments}がtrueであることを条件とする", - "xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "両方の引数", - "xpack.kueryAutocomplete.equalOperatorDescription": "一部の値に{equals}", - "xpack.kueryAutocomplete.equalOperatorDescription.equalsText": "一致する", - "xpack.kueryAutocomplete.existOperatorDescription": "いずれかの形式中に{exists}", - "xpack.kueryAutocomplete.existOperatorDescription.existsText": "存在する", - "xpack.kueryAutocomplete.filterResultsDescription": "{fieldName}を含む結果をフィルタリング", - "xpack.kueryAutocomplete.greaterThanOperatorDescription": "が一部の値{greaterThan}", - "xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "より大きい", - "xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "が一部の値{greaterThanOrEqualTo}", - "xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "よりも大きいまたは等しい", - "xpack.kueryAutocomplete.lessThanOperatorDescription": "が一部の値{lessThan}", - "xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "より小さい", - "xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription": "が一部の値{lessThanOrEqualTo}", - "xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "より小さいまたは等しい", - "xpack.kueryAutocomplete.orOperatorDescription": "{oneOrMoreArguments}がtrueであることを条件とする", - "xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数", + "xpack.data.kueryAutocomplete.andOperatorDescription": "{bothArguments}がtrueであることを条件とする", + "xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "両方の引数", + "xpack.data.kueryAutocomplete.equalOperatorDescription": "一部の値に{equals}", + "xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText": "一致する", + "xpack.data.kueryAutocomplete.existOperatorDescription": "いずれかの形式中に{exists}", + "xpack.data.kueryAutocomplete.existOperatorDescription.existsText": "存在する", + "xpack.data.kueryAutocomplete.filterResultsDescription": "{fieldName}を含む結果をフィルタリング", + "xpack.data.kueryAutocomplete.greaterThanOperatorDescription": "が一部の値{greaterThan}", + "xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "より大きい", + "xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "が一部の値{greaterThanOrEqualTo}", + "xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "よりも大きいまたは等しい", + "xpack.data.kueryAutocomplete.lessThanOperatorDescription": "が一部の値{lessThan}", + "xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "より小さい", + "xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "が一部の値{lessThanOrEqualTo}", + "xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "より小さいまたは等しい", + "xpack.data.kueryAutocomplete.orOperatorDescription": "{oneOrMoreArguments}がtrueであることを条件とする", + "xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数", "xpack.lens.app.docLoadingError": "保存されたドキュメントの保存中にエラーが発生", "xpack.lens.app.docSavingError": "ドキュメントの保存中にエラーが発生", "xpack.lens.app.indexPatternLoadingError": "インデックスパターンの読み込み中にエラーが発生", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 50b92eca7a4bc..7b14d40f34f04 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -6753,23 +6753,23 @@ "xpack.infra.waffle.unableToSelectMetricErrorTitle": "无法选择指标选项或指标值。", "xpack.infra.waffleTime.autoRefreshButtonLabel": "自动刷新", "xpack.infra.waffleTime.stopRefreshingButtonLabel": "停止刷新", - "xpack.kueryAutocomplete.andOperatorDescription": "需要{bothArguments}为真", - "xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "两个参数都", - "xpack.kueryAutocomplete.equalOperatorDescription": "{equals}某一值", - "xpack.kueryAutocomplete.equalOperatorDescription.equalsText": "等于", - "xpack.kueryAutocomplete.existOperatorDescription": "以任意形式{exists}", - "xpack.kueryAutocomplete.existOperatorDescription.existsText": "存在", - "xpack.kueryAutocomplete.filterResultsDescription": "筛选包含 {fieldName} 的结果", - "xpack.kueryAutocomplete.greaterThanOperatorDescription": "{greaterThan}某一值", - "xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "大于", - "xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "{greaterThanOrEqualTo}某一值", - "xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "大于或等于", - "xpack.kueryAutocomplete.lessThanOperatorDescription": "{lessThan}某一值", - "xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "小于", - "xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription": "{lessThanOrEqualTo}某一值", - "xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "小于或等于", - "xpack.kueryAutocomplete.orOperatorDescription": "需要{oneOrMoreArguments}为真", - "xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数", + "xpack.data.kueryAutocomplete.andOperatorDescription": "需要{bothArguments}为真", + "xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "两个参数都", + "xpack.data.kueryAutocomplete.equalOperatorDescription": "{equals}某一值", + "xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText": "等于", + "xpack.data.kueryAutocomplete.existOperatorDescription": "以任意形式{exists}", + "xpack.data.kueryAutocomplete.existOperatorDescription.existsText": "存在", + "xpack.data.kueryAutocomplete.filterResultsDescription": "筛选包含 {fieldName} 的结果", + "xpack.data.kueryAutocomplete.greaterThanOperatorDescription": "{greaterThan}某一值", + "xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "大于", + "xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "{greaterThanOrEqualTo}某一值", + "xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "大于或等于", + "xpack.data.kueryAutocomplete.lessThanOperatorDescription": "{lessThan}某一值", + "xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "小于", + "xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "{lessThanOrEqualTo}某一值", + "xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "小于或等于", + "xpack.data.kueryAutocomplete.orOperatorDescription": "需要{oneOrMoreArguments}为真", + "xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数", "xpack.lens.app.docLoadingError": "加载已保存文档时出错", "xpack.lens.app.docSavingError": "保存文档时出错", "xpack.lens.app.indexPatternLoadingError": "加载索引模式时出错",