Skip to content

Commit

Permalink
Move kuery_autocomplete ⇒ NP (#56607)
Browse files Browse the repository at this point in the history
* Move kuery_autocomplete ⇒ NP

Closes: #51277

* fix i18n keys

* update translations

* data_xpack -> data_enhanced

* data -> data_enhanced

* fix i18nrc

* fix PR comments
  • Loading branch information
alexwizp authored Feb 4, 2020
1 parent 4f26741 commit be61507
Show file tree
Hide file tree
Showing 27 changed files with 152 additions and 183 deletions.
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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.licenseMgmt": "legacy/plugins/license_management",
"xpack.licensing": "plugins/licensing",
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

0 comments on commit be61507

Please sign in to comment.