From 6942d0bbe6c451dd61dbbc5ecfff8aeabeb7b54c Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Fri, 3 Jan 2020 15:57:46 +0300 Subject: [PATCH] =?UTF-8?q?Move=20index=20patterns:=20src/legacy/core=5Fpl?= =?UTF-8?q?ugins/data=20=F0=9F=91=89=20src/plugins/data=20(#53794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move index patterns: src/legacy/core_plugins/data 👉 src/plugins/data Closes: #43444 Make sure that all index pattern related imports use NP (and delete index_pattern folder from shim) * fix JEST tests * fix CI * fix PR comments Co-authored-by: Elastic Machine --- src/legacy/core_plugins/data/public/index.ts | 3 -- .../data/public/index_patterns/index.ts | 33 --------------- .../public/views/json_code_block.test.tsx | 2 +- .../public/views/table/table.test.tsx | 6 +-- .../np_ready/dashboard_app_controller.tsx | 9 ++++- .../__jest__/render.test.js | 6 --- .../__jest__/step_index_pattern.test.js | 5 --- .../step_index_pattern/step_index_pattern.js | 6 +-- src/legacy/ui/public/agg_types/agg_configs.ts | 2 +- .../agg_types/filter/agg_type_filters.test.ts | 2 +- .../agg_types/filter/agg_type_filters.ts | 2 +- .../ui/public/agg_types/param_types/field.ts | 2 +- .../param_types/filter/field_filters.test.ts | 2 +- .../param_types/filter/field_filters.ts | 2 +- .../public/index_patterns/__mocks__/index.ts | 25 ------------ src/legacy/ui/public/index_patterns/index.ts | 40 ------------------- .../ui/public/indices/constants/index.js | 6 +-- .../ui/public/registry/doc_views_types.ts | 2 +- .../saved_objects/helpers/apply_es_resp.ts | 2 +- .../editors/config/editor_config_providers.ts | 2 +- .../editors/default/components/agg.test.tsx | 2 +- .../default/components/agg_param_props.ts | 2 +- .../default/components/agg_params.test.tsx | 2 +- .../editors/default/components/agg_params.tsx | 2 +- .../components/agg_params_helper.test.ts | 2 +- .../default/components/agg_params_helper.ts | 2 +- .../editors/default/components/agg_select.tsx | 2 +- .../editors/default/controls/field.test.tsx | 2 +- .../vis/editors/default/controls/field.tsx | 2 +- .../editors/default/controls/top_field.tsx | 2 +- .../default/controls/top_sort_field.tsx | 2 +- .../editors/default/vis_type_agg_filter.ts | 2 +- .../public/query/timefilter/timefilter.ts | 2 +- .../field_validators/index_pattern_field.ts | 11 ++--- .../auto_follow_pattern_add.test.js | 4 +- .../follower_index_add.test.js | 6 +-- .../components/auto_follow_pattern_form.js | 4 +- .../auto_follow_pattern_validators.js | 20 +++++----- .../public/components/search_bar.test.tsx | 3 +- .../graph/public/components/search_bar.tsx | 2 +- .../public/services/index_pattern_cache.ts | 2 +- .../services/persistence/deserialize.test.ts | 2 +- .../services/persistence/deserialize.ts | 2 +- .../state_management/datasource.sagas.ts | 2 +- .../state_management/datasource.test.ts | 2 +- .../graph/public/state_management/mocks.ts | 2 +- .../plugins/graph/public/types/app_state.ts | 2 +- .../public/elasticsearch_geo_utils.test.js | 6 +-- .../data_recognizer/data_recognizer.d.ts | 3 +- .../full_time_range_selector.test.tsx | 2 +- .../full_time_range_selector.tsx | 2 +- .../full_time_range_selector_service.ts | 2 +- .../kibana/__mocks__/index_pattern.ts | 2 +- .../create_analytics_button.test.tsx | 5 --- .../create_analytics_flyout.test.tsx | 5 --- .../create_analytics_form.test.tsx | 5 --- .../create_analytics_form.tsx | 12 +++--- .../use_create_analytics_form/reducer.test.ts | 4 -- .../use_create_analytics_form/reducer.ts | 10 ++--- .../use_create_analytics_form.test.tsx | 4 -- .../analytics_service/get_analytics.test.ts | 4 -- .../actions_panel/actions_panel.tsx | 4 +- .../components/search_panel/search_panel.tsx | 2 +- .../index_based/data_loader/data_loader.ts | 2 +- .../datavisualizer/index_based/page.tsx | 10 +++-- .../common/chart_loader/chart_loader.ts | 2 +- .../job_creator/advanced_job_creator.ts | 2 +- .../new_job/common/job_creator/job_creator.ts | 2 +- .../common/job_creator/job_creator_factory.ts | 2 +- .../job_creator/multi_metric_job_creator.ts | 2 +- .../job_creator/population_job_creator.ts | 2 +- .../job_creator/single_metric_job_creator.ts | 2 +- .../jobs/new_job/utils/new_job_utils.ts | 8 +++- .../services/field_format_service.ts | 2 +- .../new_job_capabilities._service.test.ts | 2 +- .../util/field_types_utils.test.ts | 11 +++-- .../application/util/field_types_utils.ts | 5 +-- .../job_create_logistics.test.js | 4 +- .../job_create/steps/step_logistics.js | 5 ++- .../steps_config/validate_index_pattern.js | 5 +-- .../transform/public/app/common/request.ts | 4 +- .../transform/public/app/lib/kibana/common.ts | 9 +++-- .../components/step_define/common.test.ts | 2 +- .../components/step_define/common.ts | 8 ++-- .../use_pivot_preview_data.test.tsx | 2 +- .../step_define/use_pivot_preview_data.ts | 8 ++-- 86 files changed, 145 insertions(+), 277 deletions(-) delete mode 100644 src/legacy/core_plugins/data/public/index_patterns/index.ts delete mode 100644 src/legacy/ui/public/index_patterns/__mocks__/index.ts delete mode 100644 src/legacy/ui/public/index_patterns/index.ts diff --git a/src/legacy/core_plugins/data/public/index.ts b/src/legacy/core_plugins/data/public/index.ts index 09881c00c63b6..4514d67ea5fcd 100644 --- a/src/legacy/core_plugins/data/public/index.ts +++ b/src/legacy/core_plugins/data/public/index.ts @@ -28,8 +28,6 @@ export function plugin() { /** @public types */ export { DataStart }; - -export { Field, FieldType, IFieldList, IndexPattern } from './index_patterns'; export { EsQuerySortValue, FetchOptions, ISearchSource, SortDirection } from './search/types'; export { SearchSourceFields } from './search/types'; export { @@ -41,5 +39,4 @@ export { /** @public static code */ export * from '../common'; export { FilterStateManager } from './filter/filter_manager'; -export { getFromSavedObject, getRoutes, flattenHitWrapper } from './index_patterns'; export { getRequestInspectorStats, getResponseInspectorStats } from './search'; diff --git a/src/legacy/core_plugins/data/public/index_patterns/index.ts b/src/legacy/core_plugins/data/public/index_patterns/index.ts deleted file mode 100644 index 96995c10e5469..0000000000000 --- a/src/legacy/core_plugins/data/public/index_patterns/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { IFieldType, indexPatterns } from '../../../../../plugins/data/public'; - -const getFromSavedObject = indexPatterns.getFromSavedObject; -const getRoutes = indexPatterns.getRoutes; -const flattenHitWrapper = indexPatterns.flattenHitWrapper; - -export { getFromSavedObject, getRoutes, flattenHitWrapper }; -export { IFieldType as FieldType }; -export { - Field, - IFieldList, - IndexPattern, - IndexPatternsContract, -} from '../../../../../plugins/data/public'; diff --git a/src/legacy/core_plugins/kbn_doc_views/public/views/json_code_block.test.tsx b/src/legacy/core_plugins/kbn_doc_views/public/views/json_code_block.test.tsx index 776971e57091d..ea11ea7b7df10 100644 --- a/src/legacy/core_plugins/kbn_doc_views/public/views/json_code_block.test.tsx +++ b/src/legacy/core_plugins/kbn_doc_views/public/views/json_code_block.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { JsonCodeBlock } from './json_code_block'; -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../plugins/data/public'; it('returns the `JsonCodeEditor` component', () => { const props = { diff --git a/src/legacy/core_plugins/kbn_doc_views/public/views/table/table.test.tsx b/src/legacy/core_plugins/kbn_doc_views/public/views/table/table.test.tsx index 24efbc2d41f4f..91b98865a0207 100644 --- a/src/legacy/core_plugins/kbn_doc_views/public/views/table/table.test.tsx +++ b/src/legacy/core_plugins/kbn_doc_views/public/views/table/table.test.tsx @@ -18,12 +18,12 @@ */ import React from 'react'; import { mount } from 'enzyme'; -import { IndexPattern } from 'ui/index_patterns'; // @ts-ignore import { findTestSubject } from '@elastic/eui/lib/test'; -import { flattenHitWrapper } from '../../../../data/public/'; import { DocViewTable } from './table'; +import { IndexPattern, indexPatterns } from '../../../../../../plugins/data/public'; + jest.mock('ui/new_platform'); // @ts-ignore @@ -70,7 +70,7 @@ const indexPattern = { formatHit: jest.fn(hit => hit._source), } as IndexPattern; -indexPattern.flattenHit = flattenHitWrapper(indexPattern, indexPattern.metaFields); +indexPattern.flattenHit = indexPatterns.flattenHitWrapper(indexPattern, indexPattern.metaFields); describe('DocViewTable at Discover', () => { // At Discover's main view, all buttons are rendered diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx index 5ba457b6c3362..08637174c8cec 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx @@ -39,8 +39,13 @@ import { unhashUrl, VISUALIZE_EMBEDDABLE_TYPE, } from '../legacy_imports'; -import { FilterStateManager, IndexPattern } from '../../../../data/public'; -import { Query, SavedQuery, IndexPatternsContract } from '../../../../../../plugins/data/public'; +import { FilterStateManager } from '../../../../data/public'; +import { + IndexPattern, + Query, + SavedQuery, + IndexPatternsContract, +} from '../../../../../../plugins/data/public'; import { DashboardContainer, diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__jest__/render.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__jest__/render.test.js index be4866f9dfdd4..375e80028f317 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__jest__/render.test.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__jest__/render.test.js @@ -22,12 +22,6 @@ const unmountComponentAtNode = jest.fn(); jest.doMock('react-dom', () => ({ render, unmountComponentAtNode })); -// If we don't mock this, Jest fails with the error `TypeError: Cannot redefine property: prototype -// at Function.defineProperties`. -jest.mock('ui/index_patterns', () => ({ - INDEX_PATTERN_ILLEGAL_CHARACTERS: ['\\', '/', '?', '"', '<', '>', '|', ' '], -})); - jest.mock('ui/chrome', () => ({ getUiSettingsClient: () => ({ get: () => '', diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/__jest__/step_index_pattern.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/__jest__/step_index_pattern.test.js index 1797fc203ccd8..85e610bbbf993 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/__jest__/step_index_pattern.test.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/__jest__/step_index_pattern.test.js @@ -32,11 +32,6 @@ const mockIndexPatternCreationType = { checkIndicesForErrors: () => false, getShowSystemIndices: () => false, }; -// If we don't mock this, Jest fails with the error `TypeError: Cannot redefine property: prototype -// at Function.defineProperties`. -jest.mock('ui/index_patterns', () => ({ - INDEX_PATTERN_ILLEGAL_CHARACTERS: ['\\', '/', '?', '"', '<', '>', '|', ' '], -})); jest.mock('ui/chrome', () => ({ getUiSettingsClient: () => ({ diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js index 4764b516dffec..c990efaf43547 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js @@ -19,7 +19,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS as ILLEGAL_CHARACTERS } from 'ui/index_patterns'; +import { indexPatterns } from '../../../../../../../../../../plugins/data/public'; import { MAX_SEARCH_SIZE } from '../../constants'; import { getIndices, @@ -71,7 +71,7 @@ export class StepIndexPattern extends Component { indexPatternName: indexPatternCreationType.getIndexPatternName(), }; - this.ILLEGAL_CHARACTERS = [...ILLEGAL_CHARACTERS]; + this.ILLEGAL_CHARACTERS = [...indexPatterns.ILLEGAL_CHARACTERS]; this.lastQuery = null; } @@ -243,7 +243,7 @@ export class StepIndexPattern extends Component { if (!query || !query.length || query === '.' || query === '..') { // This is an error scenario but do not report an error containsErrors = true; - } else if (containsIllegalCharacters(query, ILLEGAL_CHARACTERS)) { + } else if (containsIllegalCharacters(query, indexPatterns.ILLEGAL_CHARACTERS)) { const errorMessage = i18n.translate( 'kbn.management.createIndexPattern.step.invalidCharactersErrorMessage', { diff --git a/src/legacy/ui/public/agg_types/agg_configs.ts b/src/legacy/ui/public/agg_types/agg_configs.ts index ece9c90d09b68..6e811afb1849d 100644 --- a/src/legacy/ui/public/agg_types/agg_configs.ts +++ b/src/legacy/ui/public/agg_types/agg_configs.ts @@ -31,7 +31,7 @@ import { TimeRange } from 'src/plugins/data/public'; import { Schema } from '../vis/editors/default/schemas'; import { AggConfig, AggConfigOptions } from './agg_config'; import { AggGroupNames } from '../vis/editors/default/agg_groups'; -import { IndexPattern } from '../../../core_plugins/data/public'; +import { IndexPattern } from '../../../../plugins/data/public'; import { ISearchSource, FetchOptions } from '../courier/types'; type Schemas = Record; diff --git a/src/legacy/ui/public/agg_types/filter/agg_type_filters.test.ts b/src/legacy/ui/public/agg_types/filter/agg_type_filters.test.ts index f470ebbc90b48..517cee23e6be1 100644 --- a/src/legacy/ui/public/agg_types/filter/agg_type_filters.test.ts +++ b/src/legacy/ui/public/agg_types/filter/agg_type_filters.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../plugins/data/public'; import { AggTypeFilters } from './agg_type_filters'; import { AggType } from '..'; import { AggConfig } from '../../vis'; diff --git a/src/legacy/ui/public/agg_types/filter/agg_type_filters.ts b/src/legacy/ui/public/agg_types/filter/agg_type_filters.ts index 4d99575e4ae38..2388d458d4abb 100644 --- a/src/legacy/ui/public/agg_types/filter/agg_type_filters.ts +++ b/src/legacy/ui/public/agg_types/filter/agg_type_filters.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { IndexPattern } from '../../index_patterns'; +import { IndexPattern } from '../../../../../plugins/data/public'; import { AggConfig } from '../../vis'; import { AggType } from '..'; diff --git a/src/legacy/ui/public/agg_types/param_types/field.ts b/src/legacy/ui/public/agg_types/param_types/field.ts index 4fda86bd1379f..0ca60267becec 100644 --- a/src/legacy/ui/public/agg_types/param_types/field.ts +++ b/src/legacy/ui/public/agg_types/param_types/field.ts @@ -25,7 +25,7 @@ import { FieldParamEditor } from '../../vis/editors/default/controls/field'; import { BaseParamType } from './base'; import { toastNotifications } from '../../notify'; import { propFilter } from '../filter'; -import { Field, IFieldList } from '../../index_patterns'; +import { Field, IFieldList } from '../../../../../plugins/data/public'; const filterByType = propFilter('type'); diff --git a/src/legacy/ui/public/agg_types/param_types/filter/field_filters.test.ts b/src/legacy/ui/public/agg_types/param_types/filter/field_filters.test.ts index e8d53754f6682..978b7edaa83ff 100644 --- a/src/legacy/ui/public/agg_types/param_types/filter/field_filters.test.ts +++ b/src/legacy/ui/public/agg_types/param_types/filter/field_filters.test.ts @@ -17,10 +17,10 @@ * under the License. */ -import { Field } from 'ui/index_patterns'; import { IndexedArray } from 'ui/indexed_array'; import { AggTypeFieldFilters } from './field_filters'; import { AggConfig } from 'ui/vis'; +import { Field } from '../../../../../../plugins/data/public'; describe('AggTypeFieldFilters', () => { let registry: AggTypeFieldFilters; diff --git a/src/legacy/ui/public/agg_types/param_types/filter/field_filters.ts b/src/legacy/ui/public/agg_types/param_types/filter/field_filters.ts index b3dbcf05681db..e5cb5226435ff 100644 --- a/src/legacy/ui/public/agg_types/param_types/filter/field_filters.ts +++ b/src/legacy/ui/public/agg_types/param_types/filter/field_filters.ts @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { Field } from 'ui/index_patterns'; import { AggConfig } from '../../../vis'; +import { Field } from '../../../../../../plugins/data/public'; type AggTypeFieldFilter = (field: Field, aggConfig: AggConfig) => boolean; diff --git a/src/legacy/ui/public/index_patterns/__mocks__/index.ts b/src/legacy/ui/public/index_patterns/__mocks__/index.ts deleted file mode 100644 index 0cb1cf897b166..0000000000000 --- a/src/legacy/ui/public/index_patterns/__mocks__/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { indexPatterns as npIndexPatterns } from '../../../../../plugins/data/public'; - -export const flattenHitWrapper = npIndexPatterns.flattenHitWrapper; - -// static code -export { getFromSavedObject, getRoutes } from '../../../../core_plugins/data/public'; diff --git a/src/legacy/ui/public/index_patterns/index.ts b/src/legacy/ui/public/index_patterns/index.ts deleted file mode 100644 index 47f6e697c54e9..0000000000000 --- a/src/legacy/ui/public/index_patterns/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Nothing to see here! - * - * Index Patterns have moved to the data plugin, and are being re-exported - * from ui/index_patterns for backwards compatibility. - */ - -import { indexPatterns } from '../../../../plugins/data/public'; - -// static code -export const INDEX_PATTERN_ILLEGAL_CHARACTERS = indexPatterns.ILLEGAL_CHARACTERS; -export const INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE; -export const ILLEGAL_CHARACTERS = indexPatterns.ILLEGAL_CHARACTERS_KEY; -export const CONTAINS_SPACES = indexPatterns.CONTAINS_SPACES_KEY; -export const validateIndexPattern = indexPatterns.validate; -export const flattenHitWrapper = indexPatterns.flattenHitWrapper; -export const getFromSavedObject = indexPatterns.getFromSavedObject; -export const getRoutes = indexPatterns.getRoutes; - -// types -export { Field, FieldType, IFieldList, IndexPattern } from '../../../core_plugins/data/public'; diff --git a/src/legacy/ui/public/indices/constants/index.js b/src/legacy/ui/public/indices/constants/index.js index 87d36d1c6d14a..72ecc2e4c87de 100644 --- a/src/legacy/ui/public/indices/constants/index.js +++ b/src/legacy/ui/public/indices/constants/index.js @@ -17,11 +17,11 @@ * under the License. */ -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from '../../index_patterns'; +import { indexPatterns } from '../../../../../plugins/data/public'; -export const INDEX_ILLEGAL_CHARACTERS_VISIBLE = [...INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE, '*']; +export const INDEX_ILLEGAL_CHARACTERS_VISIBLE = [...indexPatterns.ILLEGAL_CHARACTERS_VISIBLE, '*']; // Insert the comma into the middle, so it doesn't look as if it has grammatical meaning when // these characters are rendered in the UI. -const insertionIndex = Math.floor(INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.length / 2); +const insertionIndex = Math.floor(indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.length / 2); INDEX_ILLEGAL_CHARACTERS_VISIBLE.splice(insertionIndex, 0, ','); diff --git a/src/legacy/ui/public/registry/doc_views_types.ts b/src/legacy/ui/public/registry/doc_views_types.ts index f078f374b4579..eb2a5bdc4b3b7 100644 --- a/src/legacy/ui/public/registry/doc_views_types.ts +++ b/src/legacy/ui/public/registry/doc_views_types.ts @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; import { ComponentType } from 'react'; import { IScope } from 'angular'; +import { IndexPattern } from '../../../../plugins/data/public'; export interface AngularDirective { controller: (scope: AngularScope) => void; diff --git a/src/legacy/ui/public/saved_objects/helpers/apply_es_resp.ts b/src/legacy/ui/public/saved_objects/helpers/apply_es_resp.ts index bec0a1d96ba92..ee49b7495f2af 100644 --- a/src/legacy/ui/public/saved_objects/helpers/apply_es_resp.ts +++ b/src/legacy/ui/public/saved_objects/helpers/apply_es_resp.ts @@ -20,7 +20,7 @@ import _ from 'lodash'; import { EsResponse, SavedObject, SavedObjectConfig } from 'ui/saved_objects/types'; import { parseSearchSource } from 'ui/saved_objects/helpers/parse_search_source'; import { expandShorthand, SavedObjectNotFound } from '../../../../../plugins/kibana_utils/public'; -import { IndexPattern } from '../../../../core_plugins/data/public'; +import { IndexPattern } from '../../../../../plugins/data/public'; /** * A given response of and ElasticSearch containing a plain saved object is applied to the given diff --git a/src/legacy/ui/public/vis/editors/config/editor_config_providers.ts b/src/legacy/ui/public/vis/editors/config/editor_config_providers.ts index 3dd911efc324c..31fc0d90be101 100644 --- a/src/legacy/ui/public/vis/editors/config/editor_config_providers.ts +++ b/src/legacy/ui/public/vis/editors/config/editor_config_providers.ts @@ -20,7 +20,7 @@ import { TimeIntervalParam } from 'ui/vis/editors/config/types'; import { AggConfig } from '../..'; import { AggType } from '../../../agg_types'; -import { IndexPattern } from '../../../index_patterns'; +import { IndexPattern } from '../../../../../../plugins/data/public'; import { leastCommonMultiple } from '../../../utils/math'; import { parseEsInterval } from '../../../../../core_plugins/data/public'; import { leastCommonInterval } from '../../lib/least_common_interval'; diff --git a/src/legacy/ui/public/vis/editors/default/components/agg.test.tsx b/src/legacy/ui/public/vis/editors/default/components/agg.test.tsx index 661ece5944fa3..c19f101fa2c32 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg.test.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/agg.test.tsx @@ -24,8 +24,8 @@ import { AggGroupNames } from '../agg_groups'; import { DefaultEditorAgg, DefaultEditorAggProps } from './agg'; import { act } from 'react-dom/test-utils'; import { DefaultEditorAggParams } from './agg_params'; -import { IndexPattern } from 'ui/index_patterns'; import { AggType } from 'ui/agg_types'; +import { IndexPattern } from '../../../../../../../plugins/data/public'; jest.mock('./agg_params', () => ({ DefaultEditorAggParams: () => null, diff --git a/src/legacy/ui/public/vis/editors/default/components/agg_param_props.ts b/src/legacy/ui/public/vis/editors/default/components/agg_param_props.ts index aafba008f97c5..df77ea9e43eab 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg_param_props.ts +++ b/src/legacy/ui/public/vis/editors/default/components/agg_param_props.ts @@ -17,13 +17,13 @@ * under the License. */ -import { Field } from 'ui/index_patterns'; import { AggParam } from 'ui/agg_types'; import { AggConfig } from '../../../../agg_types/agg_config'; import { ComboBoxGroupedOptions } from '../utils'; import { EditorConfig } from '../../config/types'; import { VisState } from '../../..'; import { SubAggParamsProp } from './agg_params'; +import { Field } from '../../../../../../../plugins/data/public'; // NOTE: we cannot export the interface with export { InterfaceName } // as there is currently a bug on babel typescript transform plugin for it diff --git a/src/legacy/ui/public/vis/editors/default/components/agg_params.test.tsx b/src/legacy/ui/public/vis/editors/default/components/agg_params.test.tsx index 25e2db8ef1836..9f3f5bff3f56e 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg_params.test.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/agg_params.test.tsx @@ -19,9 +19,9 @@ import React from 'react'; import { mount, shallow } from 'enzyme'; -import { IndexPattern } from 'ui/index_patterns'; import { AggConfig, VisState } from '../../..'; import { DefaultEditorAggParams, DefaultEditorAggParamsProps } from './agg_params'; +import { IndexPattern } from '../../../../../../../plugins/data/public'; const mockEditorConfig = { useNormalizedEsInterval: { hidden: false, fixedValue: false }, diff --git a/src/legacy/ui/public/vis/editors/default/components/agg_params.tsx b/src/legacy/ui/public/vis/editors/default/components/agg_params.tsx index 1515ed86db070..c62e2837908c7 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg_params.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/agg_params.tsx @@ -23,8 +23,8 @@ import { i18n } from '@kbn/i18n'; import useUnmount from 'react-use/lib/useUnmount'; import { VisState } from 'ui/vis'; -import { IndexPattern } from 'ui/index_patterns'; import { aggTypes, AggType, AggParam, AggConfig } from 'ui/agg_types/'; +import { IndexPattern } from '../../../../../../../plugins/data/public'; import { DefaultEditorAggSelect } from './agg_select'; import { DefaultEditorAggParam } from './agg_param'; diff --git a/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.test.ts b/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.test.ts index eb6bef4887642..fb37dd5d94618 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.test.ts +++ b/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.test.ts @@ -19,7 +19,6 @@ import { AggConfig, VisState } from '../../..'; import { AggType } from 'ui/agg_types'; -import { IndexPattern, Field } from 'ui/index_patterns'; import { IndexedArray } from 'ui/indexed_array'; import { getAggParamsToRender, @@ -28,6 +27,7 @@ import { isInvalidParamsTouched, } from './agg_params_helper'; import { EditorConfig } from '../../config/types'; +import { IndexPattern, Field } from '../../../../../../../plugins/data/public'; jest.mock('ui/agg_types', () => ({ aggTypes: { diff --git a/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.ts b/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.ts index d233f561940da..e0e014f69ef3f 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.ts +++ b/src/legacy/ui/public/vis/editors/default/components/agg_params_helper.ts @@ -20,7 +20,6 @@ import { get, isEmpty } from 'lodash'; import { i18n } from '@kbn/i18n'; import { aggTypeFilters } from 'ui/agg_types/filter'; -import { IndexPattern, Field } from 'ui/index_patterns'; import { aggTypes, AggParam, FieldParamType, AggType } from 'ui/agg_types'; import { aggTypeFieldFilters } from 'ui/agg_types/param_types/filter'; import { AggConfig, VisState } from '../../..'; @@ -28,6 +27,7 @@ import { groupAndSortBy, ComboBoxGroupedOptions } from '../utils'; import { EditorConfig } from '../../config/types'; import { AggTypeState, AggParamsState } from './agg_params_state'; import { AggParamEditorProps } from './agg_param_props'; +import { IndexPattern, Field } from '../../../../../../../plugins/data/public'; interface ParamInstanceBase { agg: AggConfig; diff --git a/src/legacy/ui/public/vis/editors/default/components/agg_select.tsx b/src/legacy/ui/public/vis/editors/default/components/agg_select.tsx index 2934711b2357a..443c655912a55 100644 --- a/src/legacy/ui/public/vis/editors/default/components/agg_select.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/agg_select.tsx @@ -23,9 +23,9 @@ import { EuiComboBox, EuiComboBoxOptionProps, EuiFormRow, EuiLink, EuiText } fro import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { AggType } from 'ui/agg_types'; -import { IndexPattern } from 'ui/index_patterns'; import { documentationLinks } from '../../../../documentation_links/documentation_links'; import { ComboBoxGroupedOptions } from '../utils'; +import { IndexPattern } from '../../../../../../../plugins/data/public'; interface DefaultEditorAggSelectProps { aggError?: string; diff --git a/src/legacy/ui/public/vis/editors/default/controls/field.test.tsx b/src/legacy/ui/public/vis/editors/default/controls/field.test.tsx index aac32e28c80a5..4d15ac8e80e63 100644 --- a/src/legacy/ui/public/vis/editors/default/controls/field.test.tsx +++ b/src/legacy/ui/public/vis/editors/default/controls/field.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { mount, shallow, ReactWrapper } from 'enzyme'; import { EuiComboBoxProps, EuiComboBox } from '@elastic/eui'; -import { Field } from '../../../../index_patterns'; +import { Field } from '../../../../../../../plugins/data/public'; import { ComboBoxGroupedOptions, SubAggParamsProp } from '..'; import { FieldParamEditor, FieldParamEditorProps } from './field'; import { AggConfig, VisState } from '../../..'; diff --git a/src/legacy/ui/public/vis/editors/default/controls/field.tsx b/src/legacy/ui/public/vis/editors/default/controls/field.tsx index a96be3a14b7ef..75a9e24cd0dee 100644 --- a/src/legacy/ui/public/vis/editors/default/controls/field.tsx +++ b/src/legacy/ui/public/vis/editors/default/controls/field.tsx @@ -23,7 +23,7 @@ import React, { useEffect } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { AggConfig } from '../../..'; -import { Field } from '../../../../index_patterns'; +import { Field } from '../../../../../../../plugins/data/public'; import { formatListAsProse, parseCommaSeparatedList } from '../../../../../../utils'; import { AggParam, FieldParamType } from '../../../../agg_types'; import { AggParamEditorProps, ComboBoxGroupedOptions } from '..'; diff --git a/src/legacy/ui/public/vis/editors/default/controls/top_field.tsx b/src/legacy/ui/public/vis/editors/default/controls/top_field.tsx index 5a5f2ceee3a56..e15187621954f 100644 --- a/src/legacy/ui/public/vis/editors/default/controls/top_field.tsx +++ b/src/legacy/ui/public/vis/editors/default/controls/top_field.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Field } from '../../../../index_patterns'; +import { Field } from '../../../../../../../plugins/data/public'; import { FieldParamEditor } from './field'; import { getCompatibleAggs } from './top_aggregate'; import { AggParamEditorProps } from '..'; diff --git a/src/legacy/ui/public/vis/editors/default/controls/top_sort_field.tsx b/src/legacy/ui/public/vis/editors/default/controls/top_sort_field.tsx index 4116ae878209e..905bd052ec695 100644 --- a/src/legacy/ui/public/vis/editors/default/controls/top_sort_field.tsx +++ b/src/legacy/ui/public/vis/editors/default/controls/top_sort_field.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Field } from '../../../../index_patterns'; +import { Field } from '../../../../../../../plugins/data/public'; import { FieldParamEditor } from './field'; import { AggParamEditorProps } from '..'; diff --git a/src/legacy/ui/public/vis/editors/default/vis_type_agg_filter.ts b/src/legacy/ui/public/vis/editors/default/vis_type_agg_filter.ts index 5842d7579f60a..c64907fff58a1 100644 --- a/src/legacy/ui/public/vis/editors/default/vis_type_agg_filter.ts +++ b/src/legacy/ui/public/vis/editors/default/vis_type_agg_filter.ts @@ -18,7 +18,7 @@ */ import { AggType } from '../../../agg_types'; import { aggTypeFilters, propFilter } from '../../../agg_types/filter'; -import { IndexPattern } from '../../../index_patterns'; +import { IndexPattern } from '../../../../../../plugins/data/public'; import { AggConfig } from '../../../vis'; const filterByName = propFilter('name'); diff --git a/src/plugins/data/public/query/timefilter/timefilter.ts b/src/plugins/data/public/query/timefilter/timefilter.ts index 639f3f4a66f18..58806a9328b1c 100644 --- a/src/plugins/data/public/query/timefilter/timefilter.ts +++ b/src/plugins/data/public/query/timefilter/timefilter.ts @@ -20,13 +20,13 @@ import _ from 'lodash'; import { Subject, BehaviorSubject } from 'rxjs'; import moment from 'moment'; -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; import { areRefreshIntervalsDifferent, areTimeRangesDifferent } from './lib/diff_time_picker_vals'; import { parseQueryString } from './lib/parse_querystring'; import { calculateBounds, getTime } from './get_time'; import { TimefilterConfig, InputTimeRange, TimeRangeBounds } from './types'; import { RefreshInterval, TimeRange } from '../../../common'; import { TimeHistoryContract } from './time_history'; +import { IndexPattern } from '../../index_patterns'; // TODO: remove! diff --git a/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts b/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts index 7f178eabdcd19..48702a32bfde8 100644 --- a/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts +++ b/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts @@ -16,12 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -import { ILLEGAL_CHARACTERS, validateIndexPattern } from 'ui/index_patterns'; import { ValidationFunc } from '../../hook_form_lib'; import { containsChars } from '../../../validators/string'; import { ERROR_CODE } from './types'; +import { indexPatterns } from '../../../../../data/public'; + export const indexPatternField = (i18n: any) => ( ...args: Parameters ): ReturnType> => { @@ -45,9 +46,9 @@ export const indexPatternField = (i18n: any) => ( } // Validate illegal characters - const errors = validateIndexPattern(value); + const errors = indexPatterns.validate(value); - if (errors[ILLEGAL_CHARACTERS]) { + if (errors[indexPatterns.ILLEGAL_CHARACTERS_KEY]) { return { code: 'ERR_FIELD_FORMAT', formatType: 'INDEX_PATTERN', @@ -55,8 +56,8 @@ export const indexPatternField = (i18n: any) => ( defaultMessage: 'The index pattern contains the invalid {characterListLength, plural, one {character} other {characters}} { characterList }.', values: { - characterList: errors[ILLEGAL_CHARACTERS].join(' '), - characterListLength: errors[ILLEGAL_CHARACTERS].length, + characterList: errors[indexPatterns.ILLEGAL_CHARACTERS_KEY].join(' '), + characterListLength: errors[indexPatterns.ILLEGAL_CHARACTERS_KEY].length, }, }), }; diff --git a/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/auto_follow_pattern_add.test.js b/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/auto_follow_pattern_add.test.js index 2e0acca5ba4a8..06a7c2f1ec45e 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/auto_follow_pattern_add.test.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/auto_follow_pattern_add.test.js @@ -5,7 +5,7 @@ */ import { setupEnvironment, pageHelpers, nextTick, getRandomString } from './helpers'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from '../../../../../../src/legacy/ui/public/index_patterns'; +import { indexPatterns } from '../../../../../../src/plugins/data/public'; jest.mock('ui/new_platform'); @@ -203,7 +203,7 @@ describe('Create Auto-follow pattern', () => { ); }; - return INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.reduce((promise, char) => { + return indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.reduce((promise, char) => { return promise.then(() => expectInvalidChar(char)); }, Promise.resolve()); }); diff --git a/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/follower_index_add.test.js b/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/follower_index_add.test.js index a1535c4560fc3..8d4523ca26de2 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/follower_index_add.test.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/follower_index_add.test.js @@ -7,7 +7,7 @@ import { setupEnvironment, pageHelpers, nextTick } from './helpers'; import { RemoteClustersFormField } from '../../public/app/components'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from '../../../../../../src/legacy/ui/public/index_patterns'; +import { indexPatterns } from '../../../../../../src/plugins/data/public'; jest.mock('ui/new_platform'); @@ -129,7 +129,7 @@ describe('Create Follower index', () => { ); }; - return INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.reduce((promise, char) => { + return indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.reduce((promise, char) => { return promise.then(() => expectInvalidChar(char)); }, Promise.resolve()); }); @@ -158,7 +158,7 @@ describe('Create Follower index', () => { ); }; - return INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.reduce((promise, char) => { + return indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.reduce((promise, char) => { return promise.then(() => expectInvalidChar(char)); }, Promise.resolve()); }); diff --git a/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/auto_follow_pattern_form.js b/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/auto_follow_pattern_form.js index e676b831e0f2e..ebb731a1b1aca 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/auto_follow_pattern_form.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/auto_follow_pattern_form.js @@ -29,7 +29,6 @@ import { EuiTitle, } from '@elastic/eui'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/index_patterns'; import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices'; import routing from '../services/routing'; @@ -45,8 +44,9 @@ import { } from '../services/auto_follow_pattern_validators'; import { AutoFollowPatternRequestFlyout } from './auto_follow_pattern_request_flyout'; +import { indexPatterns } from '../../../../../../../src/plugins/data/public'; -const indexPatternIllegalCharacters = INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.join(' '); +const indexPatternIllegalCharacters = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.join(' '); const indexNameIllegalCharacters = INDEX_ILLEGAL_CHARACTERS_VISIBLE.join(' '); const getEmptyAutoFollowPattern = (remoteClusterName = '') => ({ diff --git a/x-pack/legacy/plugins/cross_cluster_replication/public/app/services/auto_follow_pattern_validators.js b/x-pack/legacy/plugins/cross_cluster_replication/public/app/services/auto_follow_pattern_validators.js index bd51af824324b..18610c87c0a51 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/public/app/services/auto_follow_pattern_validators.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/public/app/services/auto_follow_pattern_validators.js @@ -8,18 +8,14 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { - ILLEGAL_CHARACTERS, - CONTAINS_SPACES, - validateIndexPattern as getIndexPatternErrors, -} from 'ui/index_patterns'; - import { indexNameBeginsWithPeriod, findIllegalCharactersInIndexName, indexNameContainsSpaces, } from 'ui/indices'; +import { indexPatterns } from '../../../../../../../src/plugins/data/public'; + export const validateName = (name = '') => { let errorMsg = null; @@ -57,9 +53,9 @@ export const validateName = (name = '') => { export const validateLeaderIndexPattern = indexPattern => { if (indexPattern) { - const errors = getIndexPatternErrors(indexPattern); + const errors = indexPatterns.validate(indexPattern); - if (errors[ILLEGAL_CHARACTERS]) { + if (errors[indexPatterns.ILLEGAL_CHARACTERS_KEY]) { return { message: ( { defaultMessage="Remove the {characterListLength, plural, one {character} other {characters}} {characterList} from the index pattern." values={{ - characterList: {errors[ILLEGAL_CHARACTERS].join(' ')}, - characterListLength: errors[ILLEGAL_CHARACTERS].length, + characterList: ( + {errors[indexPatterns.ILLEGAL_CHARACTERS_KEY].join(' ')} + ), + characterListLength: errors[indexPatterns.ILLEGAL_CHARACTERS_KEY].length, }} /> ), }; } - if (errors[CONTAINS_SPACES]) { + if (errors[indexPatterns.CONTAINS_SPACES_KEY]) { return { message: ( Promise diff --git a/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.test.ts b/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.test.ts index c7f8b72cc1abf..d38c950a5986f 100644 --- a/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.test.ts +++ b/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.test.ts @@ -6,9 +6,9 @@ import { GraphWorkspaceSavedObject, Workspace } from '../../types'; import { savedWorkspaceToAppState } from './deserialize'; -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; import { createWorkspace } from '../../angular/graph_client_workspace'; import { outlinkEncoders } from '../../helpers/outlink_encoders'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; describe('deserialize', () => { let savedWorkspace: GraphWorkspaceSavedObject; diff --git a/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts b/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts index 9a13da65e976a..af34b4f1a725b 100644 --- a/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts +++ b/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'src/legacy/core_plugins/data/public/'; import { SerializedNode, UrlTemplate, @@ -25,6 +24,7 @@ import { colorChoices, iconChoicesByClass, } from '../../helpers/style_choices'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; const defaultAdvancedSettings: AdvancedSettings = { useSignificance: true, diff --git a/x-pack/legacy/plugins/graph/public/state_management/datasource.sagas.ts b/x-pack/legacy/plugins/graph/public/state_management/datasource.sagas.ts index 7afea3d2a765a..34d39e71dec55 100644 --- a/x-pack/legacy/plugins/graph/public/state_management/datasource.sagas.ts +++ b/x-pack/legacy/plugins/graph/public/state_management/datasource.sagas.ts @@ -6,7 +6,6 @@ import { takeLatest, put, call, select } from 'redux-saga/effects'; import { i18n } from '@kbn/i18n'; -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; import { Action } from 'typescript-fsa'; import { GraphStoreDependencies } from './store'; import { loadFields } from './fields'; @@ -18,6 +17,7 @@ import { setDatasource, requestDatasource, } from './datasource'; +import { IndexPattern } from '../../../../../../src/plugins/data/public'; /** * Saga loading field information when the datasource is switched. This will overwrite current settings diff --git a/x-pack/legacy/plugins/graph/public/state_management/datasource.test.ts b/x-pack/legacy/plugins/graph/public/state_management/datasource.test.ts index 7e51e463f9f61..041098a9aaae5 100644 --- a/x-pack/legacy/plugins/graph/public/state_management/datasource.test.ts +++ b/x-pack/legacy/plugins/graph/public/state_management/datasource.test.ts @@ -10,7 +10,7 @@ import { datasourceSelector, requestDatasource } from './datasource'; import { datasourceSaga } from './datasource.sagas'; import { fieldsSelector } from './fields'; import { updateSettings } from './advanced_settings'; -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; +import { IndexPattern } from '../../../../../../src/plugins/data/public'; const waitForPromise = () => new Promise(r => setTimeout(r)); diff --git a/x-pack/legacy/plugins/graph/public/state_management/mocks.ts b/x-pack/legacy/plugins/graph/public/state_management/mocks.ts index 9672edef31d6f..5a4f0d033aa42 100644 --- a/x-pack/legacy/plugins/graph/public/state_management/mocks.ts +++ b/x-pack/legacy/plugins/graph/public/state_management/mocks.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; import { NotificationsStart, HttpStart } from 'kibana/public'; import createSagaMiddleware from 'redux-saga'; import { createStore, applyMiddleware, AnyAction } from 'redux'; import { ChromeStart } from 'kibana/public'; import { GraphStoreDependencies, createRootReducer, GraphStore, GraphState } from './store'; import { Workspace, GraphWorkspaceSavedObject, IndexPatternSavedObject } from '../types'; +import { IndexPattern } from '../../../../../../src/plugins/data/public'; jest.mock('ui/new_platform'); diff --git a/x-pack/legacy/plugins/graph/public/types/app_state.ts b/x-pack/legacy/plugins/graph/public/types/app_state.ts index 24b1876bb713f..eef8060f07f5c 100644 --- a/x-pack/legacy/plugins/graph/public/types/app_state.ts +++ b/x-pack/legacy/plugins/graph/public/types/app_state.ts @@ -5,9 +5,9 @@ */ import { SimpleSavedObject } from 'src/core/public'; -import { IndexPattern } from 'src/legacy/core_plugins/data/public'; import { FontawesomeIcon } from '../helpers/style_choices'; import { OutlinkEncoder } from '../helpers/outlink_encoders'; +import { IndexPattern } from '../../../../../../src/plugins/data/public'; export interface UrlTemplate { url: string; diff --git a/x-pack/legacy/plugins/maps/public/elasticsearch_geo_utils.test.js b/x-pack/legacy/plugins/maps/public/elasticsearch_geo_utils.test.js index 170ede9f2bb26..fb4b0a6e29e6c 100644 --- a/x-pack/legacy/plugins/maps/public/elasticsearch_geo_utils.test.js +++ b/x-pack/legacy/plugins/maps/public/elasticsearch_geo_utils.test.js @@ -5,7 +5,7 @@ */ jest.mock('ui/new_platform'); -jest.mock('ui/index_patterns'); + jest.mock('./kibana_services', () => { return { SPATIAL_FILTER_TYPE: 'spatial_filter', @@ -20,7 +20,7 @@ import { convertMapExtentToPolygon, roundCoordinates, } from './elasticsearch_geo_utils'; -import { flattenHitWrapper } from 'ui/index_patterns'; +import { indexPatterns } from '../../../../../src/plugins/data/public'; const geoFieldName = 'location'; const mapExtent = { @@ -172,7 +172,7 @@ describe('hitsToGeoJson', () => { }, }, }; - const indexPatternFlattenHit = flattenHitWrapper(indexPatternMock); + const indexPatternFlattenHit = indexPatterns.flattenHitWrapper(indexPatternMock); it('Should handle geoField being an object', () => { const hits = [ diff --git a/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.d.ts b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.d.ts index 2a15c597fed81..4258b3761f72c 100644 --- a/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.d.ts +++ b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.d.ts @@ -5,9 +5,8 @@ */ import { FC } from 'react'; - -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../common/types/kibana'; +import { IndexPattern } from '../../../../../../../../src/plugins/data/public'; declare const DataRecognizer: FC<{ indexPattern: IndexPattern; diff --git a/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx index 38e4a3fc24278..a4e2ebe6784d8 100644 --- a/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx @@ -6,9 +6,9 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; -import { IndexPattern } from 'ui/index_patterns'; import { FullTimeRangeSelector } from './index'; import { Query } from 'src/plugins/data/public'; +import { IndexPattern } from '../../../../../../../../src/plugins/data/public'; // Create a mock for the setFullTimeRange function in the service. // The mock is hoisted to the top, so need to prefix the mock function diff --git a/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx index f637ffb9beea0..ef2a4c28a570d 100644 --- a/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx @@ -8,9 +8,9 @@ import React, { FC } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { Query } from 'src/plugins/data/public'; -import { IndexPattern } from 'ui/index_patterns'; import { EuiButton } from '@elastic/eui'; import { setFullTimeRange } from './full_time_range_selector_service'; +import { IndexPattern } from '../../../../../../../../src/plugins/data/public'; interface Props { indexPattern: IndexPattern; diff --git a/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector_service.ts b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector_service.ts index bd31ccf7eca3d..e69aaf2ede037 100644 --- a/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector_service.ts +++ b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector_service.ts @@ -7,12 +7,12 @@ import moment from 'moment'; import { i18n } from '@kbn/i18n'; -import { IndexPattern } from 'ui/index_patterns'; import { toastNotifications } from 'ui/notify'; import { timefilter } from 'ui/timefilter'; import { Query } from 'src/plugins/data/public'; import dateMath from '@elastic/datemath'; import { ml, GetTimeFieldRangeResponse } from '../../services/ml_api_service'; +import { IndexPattern } from '../../../../../../../../src/plugins/data/public'; export interface TimeRange { from: number; diff --git a/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_pattern.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_pattern.ts index a9f30a904d54b..6a85c18de6d31 100644 --- a/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_pattern.ts +++ b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_pattern.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../../../../../src/plugins/data/public'; export const indexPatternMock = ({ id: 'the-index-pattern-id', diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx index 15f30b6cca6c4..abb35e50ec2a2 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx @@ -15,11 +15,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__ import { useCreateAnalyticsForm } from '../../hooks/use_create_analytics_form'; -jest.mock('ui/index_patterns', () => ({ - validateIndexPattern: () => true, - INDEX_PATTERN_ILLEGAL_CHARACTERS: [], -})); - const getMountedHook = () => mountHook( () => useCreateAnalyticsForm(), diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx index 880a1354e7a64..d5d509826667c 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx @@ -15,11 +15,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__ import { useCreateAnalyticsForm } from '../../hooks/use_create_analytics_form'; -jest.mock('ui/index_patterns', () => ({ - validateIndexPattern: () => true, - INDEX_PATTERN_ILLEGAL_CHARACTERS: [], -})); - const getMountedHook = () => mountHook( () => useCreateAnalyticsForm(), diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx index 49381e3b1c031..0d4daee373b13 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx @@ -15,11 +15,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__ import { useCreateAnalyticsForm } from '../../hooks/use_create_analytics_form'; -jest.mock('ui/index_patterns', () => ({ - validateIndexPattern: () => true, - INDEX_PATTERN_ILLEGAL_CHARACTERS: [], -})); - const getMountedHook = () => mountHook( () => useCreateAnalyticsForm(), diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx index e2106e56e0346..0815b8dbd8d3d 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { metadata } from 'ui/metadata'; -import { IndexPattern, INDEX_PATTERN_ILLEGAL_CHARACTERS } from 'ui/index_patterns'; import { ml } from '../../../../../services/ml_api_service'; import { Field, EVENT_RATE_FIELD_ID } from '../../../../../../../common/types/fields'; @@ -38,11 +37,10 @@ import { Messages } from './messages'; import { JobType } from './job_type'; import { JobDescriptionInput } from './job_description'; import { mmlUnitInvalidErrorMessage } from '../../hooks/use_create_analytics_form/reducer'; - -// based on code used by `ui/index_patterns` internally -// remove the space character from the list of illegal characters -INDEX_PATTERN_ILLEGAL_CHARACTERS.pop(); -const characterList = INDEX_PATTERN_ILLEGAL_CHARACTERS.join(', '); +import { + IndexPattern, + indexPatterns, +} from '../../../../../../../../../../../src/plugins/data/public'; const NUMERICAL_FIELD_TYPES = new Set([ 'long', @@ -63,7 +61,6 @@ const OMIT_FIELDS: string[] = ['_source', '_type', '_index', '_id', '_version', export const CreateAnalyticsForm: FC = ({ actions, state }) => { const { setFormState } = actions; const kibanaContext = useKibanaContext(); - const { form, indexPatternsMap, isAdvancedEditorEnabled, isJobCreated, requestMessages } = state; const { @@ -93,6 +90,7 @@ export const CreateAnalyticsForm: FC = ({ actions, sta sourceIndexFieldsCheckFailed, trainingPercent, } = form; + const characterList = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.join(', '); // Find out if index pattern contain numeric fields. Provides a hint in the form // that an analytics jobs is not able to identify outliers if there are no numeric fields present. diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts index 754f7a1136a97..fcb99ea83548d 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts @@ -12,10 +12,6 @@ import { ACTION } from './actions'; import { reducer, validateAdvancedEditor } from './reducer'; import { getInitialState, JOB_TYPES } from './state'; -jest.mock('ui/index_patterns', () => ({ - validateIndexPattern: () => true, -})); - type SourceIndex = DataFrameAnalyticsConfig['source']['index']; const getMockState = ({ diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts index 06c8a6c6a8846..8498b0e5a9e9e 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts @@ -5,9 +5,6 @@ */ import { i18n } from '@kbn/i18n'; - -import { validateIndexPattern } from 'ui/index_patterns'; - import { isValidIndexName } from '../../../../../../../common/util/es_utils'; import { Action, ACTION } from './actions'; @@ -26,6 +23,7 @@ import { isRegressionAnalysis, isClassificationAnalysis, } from '../../../../common/analytics'; +import { indexPatterns } from '../../../../../../../../../../../src/plugins/data/public'; const mmlAllowedUnitsStr = `${ALLOWED_DATA_UNITS.slice(0, ALLOWED_DATA_UNITS.length - 1).join( ', ' @@ -66,9 +64,9 @@ export const validateAdvancedEditor = (state: State): State => { // general check against Kibana index pattern names, but since this is about the advanced editor // with support for arrays in the job config, we also need to check that each individual name // doesn't include a comma if index names are supplied as an array. - // `validateIndexPattern()` returns a map of messages, we're only interested here if it's valid or not. + // `indexPatterns.validate()` returns a map of messages, we're only interested here if it's valid or not. // If there are no messages, it means the index pattern is valid. - let sourceIndexNameValid = Object.keys(validateIndexPattern(sourceIndexName)).length === 0; + let sourceIndexNameValid = Object.keys(indexPatterns.validate(sourceIndexName)).length === 0; const sourceIndex = jobConfig?.source?.index; if (sourceIndexNameValid) { if (typeof sourceIndex === 'string') { @@ -293,7 +291,7 @@ export function reducer(state: State, action: Action): State { if (action.payload.sourceIndex !== undefined) { newFormState.sourceIndexNameEmpty = newFormState.sourceIndex === ''; - const validationMessages = validateIndexPattern(newFormState.sourceIndex); + const validationMessages = indexPatterns.validate(newFormState.sourceIndex); newFormState.sourceIndexNameValid = Object.keys(validationMessages).length === 0; } diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx index 6854b439d7382..3298a7d00253f 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx @@ -12,10 +12,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__ import { getErrorMessage, useCreateAnalyticsForm } from './use_create_analytics_form'; -jest.mock('ui/index_patterns', () => ({ - validateIndexPattern: () => true, -})); - const getMountedHook = () => mountHook( () => useCreateAnalyticsForm(), diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts index 33a073d7a686e..1aaddda358082 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts @@ -8,10 +8,6 @@ import { GetDataFrameAnalyticsStatsResponseOk } from '../../../../../services/ml import { getAnalyticsJobsStats } from './get_analytics'; import { DATA_FRAME_TASK_STATE } from '../../components/analytics_list/common'; -jest.mock('ui/index_patterns', () => ({ - validateIndexPattern: () => true, -})); - describe('get_analytics', () => { test('should get analytics jobs stats', () => { // arrange diff --git a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx index 1b2f1553585cd..f291118140b9a 100644 --- a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx @@ -8,11 +8,9 @@ import React, { FC, useState } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; - -import { IndexPattern } from 'ui/index_patterns'; - import { EuiPanel, EuiSpacer, EuiText, EuiTitle, EuiFlexGroup } from '@elastic/eui'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; import { CreateJobLinkCard } from '../../../../components/create_job_link_card'; import { DataRecognizer } from '../../../../components/data_recognizer'; diff --git a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx index 4dd1593a14da5..180fd2f103f2c 100644 --- a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx @@ -21,7 +21,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; import { SEARCH_QUERY_LANGUAGE } from '../../../../../../common/constants/search'; import { SavedSearchQuery } from '../../../../contexts/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts index fe0d69fdeec6b..983908e2eb7f7 100644 --- a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { toastNotifications } from 'ui/notify'; -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../../../../../src/plugins/data/public'; import { SavedSearchQuery } from '../../../contexts/kibana'; import { IndexPatternTitle } from '../../../../../common/types/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx index 898c852fe50a5..99df9fcdb60a2 100644 --- a/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx @@ -8,7 +8,6 @@ import React, { FC, Fragment, useEffect, useState } from 'react'; import { merge } from 'rxjs'; import { i18n } from '@kbn/i18n'; -import { FieldType } from 'ui/index_patterns'; import { timefilter } from 'ui/timefilter'; import { @@ -22,7 +21,12 @@ import { EuiSpacer, EuiTitle, } from '@elastic/eui'; -import { KBN_FIELD_TYPES, esQuery, esKuery } from '../../../../../../../../src/plugins/data/public'; +import { + IFieldType, + KBN_FIELD_TYPES, + esQuery, + esKuery, +} from '../../../../../../../../src/plugins/data/public'; import { NavigationMenu } from '../../components/navigation_menu'; import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types'; import { SEARCH_QUERY_LANGUAGE } from '../../../../common/constants/search'; @@ -107,7 +111,7 @@ export const Page: FC = () => { // Obtain the list of non metric field types which appear in the index pattern. let indexedFieldTypes: ML_JOB_FIELD_TYPES[] = []; - const indexPatternFields: FieldType[] = currentIndexPattern.fields; + const indexPatternFields: IFieldType[] = currentIndexPattern.fields; indexPatternFields.forEach(field => { if (field.scripted !== true) { const dataVisualizerType: ML_JOB_FIELD_TYPES | undefined = kbnTypeToMLJobType(field); diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts index 502a88ecf6004..5e92ab67fcc79 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts @@ -6,13 +6,13 @@ import memoizeOne from 'memoize-one'; import { isEqual } from 'lodash'; -import { IndexPattern } from 'ui/index_patterns'; import { IndexPatternTitle } from '../../../../../../common/types/kibana'; import { Field, SplitField, AggFieldPair } from '../../../../../../common/types/fields'; import { ml } from '../../../../services/ml_api_service'; import { mlResultsService } from '../../../../services/results_service'; import { getCategoryFields as getCategoryFieldsOrig } from './searches'; import { aggFieldPairsCanBeCharted } from '../job_creator/util/general'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; type DetectorIndex = number; export interface LineChartPoint { diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts index d8917db7a33ff..b0eb1b98cd02b 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../../../common/types/kibana'; import { JobCreator } from './job_creator'; @@ -15,6 +14,7 @@ import { JOB_TYPE } from '../../../../../../common/constants/new_job'; import { getRichDetectors } from './util/general'; import { isValidJson } from '../../../../../../common/util/validation_utils'; import { ml } from '../../../../services/ml_api_service'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; export interface RichDetector { agg: Aggregation | null; diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts index 4707eff8d844e..513c8239db01e 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../../../common/types/kibana'; import { UrlConfig } from '../../../../../../common/types/custom_urls'; import { IndexPatternTitle } from '../../../../../../common/types/kibana'; @@ -24,6 +23,7 @@ import { isSparseDataJob } from './util/general'; import { parseInterval } from '../../../../../../common/util/parse_interval'; import { Calendar } from '../../../../../../common/types/calendars'; import { mlCalendarService } from '../../../../services/calendar_service'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; export class JobCreator { protected _type: JOB_TYPE = JOB_TYPE.SINGLE_METRIC; diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator_factory.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator_factory.ts index 4ffcd1b06ca47..868346d0188ea 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator_factory.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator_factory.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../../../common/types/kibana'; import { SingleMetricJobCreator } from './single_metric_job_creator'; import { MultiMetricJobCreator } from './multi_metric_job_creator'; import { PopulationJobCreator } from './population_job_creator'; import { AdvancedJobCreator } from './advanced_job_creator'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; import { JOB_TYPE } from '../../../../../../common/constants/new_job'; diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts index e86ee09d234f1..947c1bcf6c1a4 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../../../common/types/kibana'; import { JobCreator } from './job_creator'; import { @@ -22,6 +21,7 @@ import { } from '../../../../../../common/constants/new_job'; import { ml } from '../../../../services/ml_api_service'; import { getRichDetectors } from './util/general'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; export class MultiMetricJobCreator extends JobCreator { // a multi metric job has one optional overall partition field diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts index 8fcd03982424d..9300e53c578e1 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../../../common/types/kibana'; import { JobCreator } from './job_creator'; import { @@ -17,6 +16,7 @@ import { Job, Datafeed, Detector } from './configs'; import { createBasicDetector } from './util/default_configs'; import { JOB_TYPE, CREATED_BY_LABEL } from '../../../../../../common/constants/new_job'; import { getRichDetectors } from './util/general'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; export class PopulationJobCreator extends JobCreator { // a population job has one overall over (split) field, which is the same for all detectors diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts index cb8a46ade513c..f98fd4dbe970a 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchSavedObject } from '../../../../../../common/types/kibana'; import { parseInterval } from '../../../../../../common/util/parse_interval'; import { JobCreator } from './job_creator'; @@ -17,6 +16,7 @@ import { } from '../../../../../../common/constants/aggregation_types'; import { JOB_TYPE, CREATED_BY_LABEL } from '../../../../../../common/constants/new_job'; import { getRichDetectors } from './util/general'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; export class SingleMetricJobCreator extends JobCreator { protected _type: JOB_TYPE = JOB_TYPE.SINGLE_METRIC; diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts index 050387e6de263..d1e81c1c344de 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts @@ -4,8 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; -import { esQuery, Query, esKuery } from '../../../../../../../../../src/plugins/data/public'; +import { + IndexPattern, + esQuery, + Query, + esKuery, +} from '../../../../../../../../../src/plugins/data/public'; import { KibanaConfigTypeFix } from '../../../contexts/kibana'; import { SEARCH_QUERY_LANGUAGE } from '../../../../../common/constants/search'; import { SavedSearchSavedObject } from '../../../../../common/types/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts b/x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts index a9ecf56c58ea7..11f0d59e04545 100644 --- a/x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts +++ b/x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPattern } from 'ui/index_patterns'; import { mlFunctionToESAggregation } from '../../../common/util/job_utils'; import { getIndexPatternById, getIndexPatternIdFromName } from '../util/index_utils'; import { mlJobService } from './job_service'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; type FormatsByJobId = Record; type IndexPatternIdsByJob = Record; diff --git a/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities._service.test.ts b/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities._service.test.ts index 91c945ea8ff29..5aeed3587b5a0 100644 --- a/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities._service.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities._service.test.ts @@ -5,7 +5,7 @@ */ import { newJobCapsService } from './new_job_capabilities_service'; -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; // there is magic happening here. starting the include name with `mock..` // ensures it can be lazily loaded by the jest.mock function below. diff --git a/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts index 2abb8097598d2..14150edb977bd 100644 --- a/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts @@ -4,8 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { FieldType } from 'ui/index_patterns'; -import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { IFieldType, KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; import { kbnTypeToMLJobType, @@ -16,7 +15,7 @@ import { describe('ML - field type utils', () => { describe('kbnTypeToMLJobType', () => { test('returns correct ML_JOB_FIELD_TYPES for KBN_FIELD_TYPES', () => { - const field: FieldType = { + const field: IFieldType = { type: KBN_FIELD_TYPES.NUMBER, name: KBN_FIELD_TYPES.NUMBER, aggregatable: true, @@ -37,7 +36,7 @@ describe('ML - field type utils', () => { }); test('returns ML_JOB_FIELD_TYPES.KEYWORD for aggregatable KBN_FIELD_TYPES.STRING', () => { - const field: FieldType = { + const field: IFieldType = { type: KBN_FIELD_TYPES.STRING, name: KBN_FIELD_TYPES.STRING, aggregatable: true, @@ -46,7 +45,7 @@ describe('ML - field type utils', () => { }); test('returns ML_JOB_FIELD_TYPES.TEXT for non-aggregatable KBN_FIELD_TYPES.STRING', () => { - const field: FieldType = { + const field: IFieldType = { type: KBN_FIELD_TYPES.STRING, name: KBN_FIELD_TYPES.STRING, aggregatable: false, @@ -55,7 +54,7 @@ describe('ML - field type utils', () => { }); test('returns undefined for non-aggregatable "foo"', () => { - const field: FieldType = { + const field: IFieldType = { type: 'foo', name: 'foo', aggregatable: false, diff --git a/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts index e2b876aa8dbcd..e8fe2ffb1fed9 100644 --- a/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts @@ -5,15 +5,14 @@ */ import { i18n } from '@kbn/i18n'; -import { FieldType } from 'ui/index_patterns'; import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; -import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { IFieldType, KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; // convert kibana types to ML Job types // this is needed because kibana types only have string and not text and keyword. // and we can't use ES_FIELD_TYPES because it has no NUMBER type -export function kbnTypeToMLJobType(field: FieldType) { +export function kbnTypeToMLJobType(field: IFieldType) { // Return undefined if not one of the supported data visualizer field types. let type; switch (field.type) { diff --git a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js index 063f48dce337d..c960eabb37dcb 100644 --- a/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js +++ b/x-pack/legacy/plugins/rollup/__jest__/client_integration/job_create_logistics.test.js @@ -12,7 +12,7 @@ import { MONTH, YEAR, } from '../../../../../../src/plugins/es_ui_shared/public/components/cron_editor'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from '../../../../../../src/legacy/ui/public/index_patterns'; +import { indexPatterns } from '../../../../../../src/plugins/data/public'; import { setupEnvironment, pageHelpers } from './helpers'; jest.mock('ui/new_platform'); @@ -154,7 +154,7 @@ describe('Create Rollup Job, step 1: Logistics', () => { ); }; - [...INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE, ','].reduce((promise, char) => { + [...indexPatterns.ILLEGAL_CHARACTERS_VISIBLE, ','].reduce((promise, char) => { return promise.then(() => expectInvalidChar(char)); }, Promise.resolve()); }); diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js index 75c70ab6ce20a..8cba18804b1c6 100644 --- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js +++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js @@ -26,12 +26,13 @@ import { // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { CronEditor } from '../../../../../../../../../src/plugins/es_ui_shared/public/components/cron_editor'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/index_patterns'; import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices'; import { logisticalDetailsUrl, cronUrl } from '../../../services'; import { StepError } from './components'; -const indexPatternIllegalCharacters = INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.join(' '); +import { indexPatterns } from '../../../../../../../../../src/plugins/data/public'; + +const indexPatternIllegalCharacters = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.join(' '); const indexIllegalCharacters = INDEX_ILLEGAL_CHARACTERS_VISIBLE.join(' '); export class StepLogisticsUi extends Component { diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_index_pattern.js b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_index_pattern.js index 8082814abba51..206cc325813c0 100644 --- a/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_index_pattern.js +++ b/x-pack/legacy/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_index_pattern.js @@ -7,8 +7,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/index_patterns'; - +import { indexPatterns } from '../../../../../../../../../src/plugins/data/public'; export function validateIndexPattern(indexPattern, rollupIndex) { if (!indexPattern || !indexPattern.trim()) { return [ @@ -28,7 +27,7 @@ export function validateIndexPattern(indexPattern, rollupIndex) { ]; } - const illegalCharacters = INDEX_PATTERN_ILLEGAL_CHARACTERS_VISIBLE.reduce((chars, char) => { + const illegalCharacters = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.reduce((chars, char) => { if (indexPattern.includes(char)) { chars.push(char); } diff --git a/x-pack/legacy/plugins/transform/public/app/common/request.ts b/x-pack/legacy/plugins/transform/public/app/common/request.ts index 5f0c778695523..5d508f3d245d3 100644 --- a/x-pack/legacy/plugins/transform/public/app/common/request.ts +++ b/x-pack/legacy/plugins/transform/public/app/common/request.ts @@ -6,14 +6,14 @@ import { DefaultOperator } from 'elasticsearch'; -import { IndexPattern } from 'ui/index_patterns'; - import { dictionaryToArray } from '../../../common/types/common'; import { SavedSearchQuery } from '../lib/kibana'; import { StepDefineExposedState } from '../sections/create_transform/components/step_define/step_define_form'; import { StepDetailsExposedState } from '../sections/create_transform/components/step_details/step_details_form'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; + import { getEsAggFromAggConfig, getEsAggFromGroupByConfig, diff --git a/x-pack/legacy/plugins/transform/public/app/lib/kibana/common.ts b/x-pack/legacy/plugins/transform/public/app/lib/kibana/common.ts index 62c87413c9bce..3e55d509a94ab 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/kibana/common.ts +++ b/x-pack/legacy/plugins/transform/public/app/lib/kibana/common.ts @@ -5,8 +5,11 @@ */ import { SavedObjectsClientContract, IUiSettingsClient } from 'src/core/public'; -import { IndexPattern as IndexPatternType } from 'ui/index_patterns'; -import { esQuery, IndexPatternsContract } from '../../../../../../../../src/plugins/data/public'; +import { + IndexPattern, + esQuery, + IndexPatternsContract, +} from '../../../../../../../../src/plugins/data/public'; type IndexPatternId = string; type SavedSearchId = string; @@ -68,7 +71,7 @@ export function loadCurrentSavedSearch(savedSearches: any, savedSearchId: SavedS // Helper for creating the items used for searching and job creation. export function createSearchItems( - indexPattern: IndexPatternType | undefined, + indexPattern: IndexPattern | undefined, savedSearch: any, config: IUiSettingsClient ) { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts index c1a7fb3424c3a..78ad217a69e3d 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts @@ -14,7 +14,7 @@ import { } from '../../../../common'; import { getPivotPreviewDevConsoleStatement, getPivotDropdownOptions } from './common'; -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; describe('Transform: Define Pivot Common', () => { test('getPivotDropdownOptions()', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts index 54b810b7b6686..b4b03c1f0d571 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts @@ -5,10 +5,10 @@ */ import { get } from 'lodash'; import { EuiComboBoxOptionProps } from '@elastic/eui'; - -import { IndexPattern } from 'ui/index_patterns'; - -import { KBN_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; +import { + IndexPattern, + KBN_FIELD_TYPES, +} from '../../../../../../../../../../src/plugins/data/public'; import { PreviewRequestBody, diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.test.tsx index 824ff0462cbba..1ad8ed099b241 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.test.tsx @@ -14,7 +14,7 @@ import { UsePivotPreviewDataReturnType, } from './use_pivot_preview_data'; -import { IndexPattern } from 'ui/index_patterns'; +import { IndexPattern } from '../../../../../../../../../../src/plugins/data/public'; jest.mock('../../../../hooks/use_api'); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts index e02f2473fc10b..84fafcad8151e 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts @@ -6,13 +6,15 @@ import { useEffect, useState } from 'react'; -import { IndexPattern } from 'ui/index_patterns'; - import { dictionaryToArray } from '../../../../../../common/types/common'; import { useApi } from '../../../../hooks/use_api'; import { Dictionary } from '../../../../../../common/types/common'; -import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; +import { + IndexPattern, + ES_FIELD_TYPES, +} from '../../../../../../../../../../src/plugins/data/public'; + import { getPreviewRequestBody, PreviewRequestBody,