diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx index ac10957d68a4..fabc6ec69b0e 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; -import { IFieldType } from '../../../../../../../plugins/data/public'; +import { IndexPatternField } from '../../../../../../../plugins/data/public'; import { mockManagementPlugin } from '../../../../mocks'; import { createComponentWithContext } from '../../../test_utils'; @@ -20,7 +20,7 @@ jest.mock('./components/advanced_options', () => ({ AdvancedOptions: 'AdvancedOp jest.mock('./components/action_buttons', () => ({ ActionButtons: 'ActionButtons' })); jest.mock('./../../lib', () => ({ extractTimeFields: jest.requireActual('./../../lib').extractTimeFields, - ensureMinimumTime: async (fields: IFieldType) => Promise.resolve(fields), + ensureMinimumTime: async (fields: IndexPatternField) => Promise.resolve(fields), })); const mockIndexPatternCreationType = new IndexPatternCreationConfig({ diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts index 90070c37995a..071c21d22952 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts @@ -7,13 +7,14 @@ */ import { extractTimeFields } from './extract_time_fields'; +import type { IndexPatternField } from 'src/plugins/data/public'; describe('extractTimeFields', () => { it('should handle no date fields', () => { const fields = [ { type: 'text', name: 'name' }, { type: 'text', name: 'name' }, - ]; + ] as IndexPatternField[]; expect(extractTimeFields(fields)).toEqual([ { display: `The indices which match this index pattern don't contain any time fields.` }, @@ -21,7 +22,7 @@ describe('extractTimeFields', () => { }); it('should add extra options', () => { - const fields = [{ type: 'date', name: '@timestamp' }]; + const fields = [{ type: 'date', name: '@timestamp' }] as IndexPatternField[]; expect(extractTimeFields(fields)).toEqual([ { display: '@timestamp', fieldName: '@timestamp' }, diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts index 1d7e25638412..e2af9339e57a 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts @@ -7,9 +7,9 @@ */ import { i18n } from '@kbn/i18n'; -import { IFieldType } from '../../../../../../plugins/data/public'; +import { IndexPatternField } from '../../../../../../plugins/data/public'; -export function extractTimeFields(fields: IFieldType[]) { +export function extractTimeFields(fields: IndexPatternField[]) { const dateFields = fields.filter((field) => field.type === 'date'); const label = i18n.translate( 'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldsLabel', diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap index fc436faa6c75..95acb14282ba 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap @@ -138,7 +138,6 @@ exports[`Table should render normally 1`] = ` Object { "displayName": "Elastic", "excluded": false, - "format": "", "hasRuntime": false, "info": Array [], "isMapped": true, @@ -150,7 +149,6 @@ exports[`Table should render normally 1`] = ` Object { "displayName": "timestamp", "excluded": false, - "format": "YYYY-MM-DD", "hasRuntime": false, "info": Array [], "isMapped": true, @@ -161,7 +159,6 @@ exports[`Table should render normally 1`] = ` Object { "displayName": "conflictingField", "excluded": false, - "format": "", "hasRuntime": false, "info": Array [], "isMapped": true, diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx index 163152b52e80..5fb2ba46882c 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx @@ -25,7 +25,6 @@ const items: IndexedFieldItem[] = [ type: 'name', kbnType: 'string', excluded: false, - format: '', isMapped: true, hasRuntime: false, }, @@ -36,7 +35,6 @@ const items: IndexedFieldItem[] = [ kbnType: 'date', info: [], excluded: false, - format: 'YYYY-MM-DD', isMapped: true, hasRuntime: false, }, @@ -47,7 +45,6 @@ const items: IndexedFieldItem[] = [ kbnType: 'conflict', info: [], excluded: false, - format: '', isMapped: true, hasRuntime: false, }, diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts index 4454651eff30..662134a003eb 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts @@ -6,9 +6,12 @@ * Side Public License, v 1. */ -import { IFieldType } from '../../../../../../plugins/data/public'; +import { IndexPatternFieldBase } from '@kbn/es-query'; +import { IndexPatternField } from '../../../../../../plugins/data/public'; -export interface IndexedFieldItem extends IFieldType { +type IndexedFieldItemBase = Partial & IndexPatternFieldBase; + +export interface IndexedFieldItem extends IndexedFieldItemBase { info: string[]; excluded: boolean; kbnType: string; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx index fc55e8a36c99..b5c0186cd998 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx @@ -39,10 +39,9 @@ import { getSupportedScriptingLanguages, } from '../../scripting_languages'; import { - IndexPatternField, FieldFormatInstanceType, IndexPattern, - IFieldType, + IndexPatternField, KBN_FIELD_TYPES, ES_FIELD_TYPES, DataPublicPluginStart, @@ -145,7 +144,7 @@ export class FieldEditor extends PureComponent f.name), + existingFieldNames: indexPattern.fields.getAll().map((f: IndexPatternField) => f.name), fieldFormatId: undefined, fieldFormatParams: {}, showScriptingHelp: false,