mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[index pattern managment] remove IFieldType references (#107239)
* remove IFieldType references * typescript fixes * update snapshot
This commit is contained in:
parent
c330fc5a9a
commit
b072a5d32b
7 changed files with 14 additions and 17 deletions
|
@ -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({
|
||||
|
|
|
@ -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' },
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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<IndexPatternField> & IndexPatternFieldBase;
|
||||
|
||||
export interface IndexedFieldItem extends IndexedFieldItemBase {
|
||||
info: string[];
|
||||
excluded: boolean;
|
||||
kbnType: string;
|
||||
|
|
|
@ -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<FieldEdiorProps, FieldEditorState
|
|||
scriptingLangs: [],
|
||||
fieldTypes: [],
|
||||
fieldTypeFormats: [],
|
||||
existingFieldNames: indexPattern.fields.getAll().map((f: IFieldType) => f.name),
|
||||
existingFieldNames: indexPattern.fields.getAll().map((f: IndexPatternField) => f.name),
|
||||
fieldFormatId: undefined,
|
||||
fieldFormatParams: {},
|
||||
showScriptingHelp: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue