Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Move kuery_autocomplete ⇒ NP (#56607) #56752

Merged
merged 3 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -65,7 +64,6 @@ module.exports = function(kibana) {
licenseManagement(kibana),
indexManagement(kibana),
indexLifecycleManagement(kibana),
kueryAutocompleteInitializer(kibana),
infra(kibana),
taskManager(kibana),
rollup(kibana),
Expand Down
22 changes: 0 additions & 22 deletions x-pack/legacy/plugins/kuery_autocomplete/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions x-pack/legacy/plugins/kuery_autocomplete/public/legacy.ts

This file was deleted.

41 changes: 0 additions & 41 deletions x-pack/legacy/plugins/kuery_autocomplete/public/plugin.ts

This file was deleted.

13 changes: 13 additions & 0 deletions x-pack/plugins/data_enhanced/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "data_enhanced",
"version": "8.0.0",
"kibanaVersion": "kibana",
"configPath": [
"xpack"
],
"requiredPlugins": [
"data"
],
"server": false,
"ui": true
}
10 changes: 10 additions & 0 deletions x-pack/plugins/data_enhanced/public/autocomplete/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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<esKuery.KueryNode>) =>
(kueryNode as unknown) as esKuery.KueryNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,50 @@ 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 = (
<FormattedMessage
id="xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText"
id="xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText"
defaultMessage="both arguments"
description="Part of xpack.kueryAutocomplete.andOperatorDescription. Full text: 'Requires both arguments to be true'"
description="Part of xpack.data.kueryAutocomplete.andOperatorDescription. Full text: 'Requires both arguments to be true'"
/>
);

const oneOrMoreArgumentsText = (
<FormattedMessage
id="xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText"
id="xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText"
defaultMessage="one or more arguments"
description="Part of xpack.kueryAutocomplete.orOperatorDescription. Full text: 'Requires one or more arguments to be true'"
description="Part of xpack.data.kueryAutocomplete.orOperatorDescription. Full text: 'Requires one or more arguments to be true'"
/>
);

const conjunctions: Record<string, JSX.Element> = {
and: (
<p>
<FormattedMessage
id="xpack.kueryAutocomplete.andOperatorDescription"
id="xpack.data.kueryAutocomplete.andOperatorDescription"
defaultMessage="Requires {bothArguments} to be true"
values={{
bothArguments: <span className="kbnSuggestionItem__callout">{bothArgumentsText}</span>,
}}
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."
/>
</p>
),
or: (
<p>
<FormattedMessage
id="xpack.kueryAutocomplete.orOperatorDescription"
id="xpack.data.kueryAutocomplete.orOperatorDescription"
defaultMessage="Requires {oneOrMoreArguments} to be true"
values={{
oneOrMoreArguments: (
<span className="kbnSuggestionItem__callout">{oneOrMoreArgumentsText}</span>
),
}}
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."
/>
</p>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<esKuery.KueryNode>) =>
(kueryNode as unknown) as esKuery.KueryNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<p>
<FormattedMessage
id="xpack.kueryAutocomplete.filterResultsDescription"
id="xpack.data.kueryAutocomplete.filterResultsDescription"
defaultMessage="Filter results that contain {fieldName}"
values={{ fieldName: <span className="kbnSuggestionItem__callout">{field.name}</span> }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<esKuery.KueryNode>) =>
(kueryNode as unknown) as esKuery.KueryNode;
Expand Down
Loading