mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -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 React from 'react';
|
||||||
import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public';
|
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 { mockManagementPlugin } from '../../../../mocks';
|
||||||
import { createComponentWithContext } from '../../../test_utils';
|
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('./components/action_buttons', () => ({ ActionButtons: 'ActionButtons' }));
|
||||||
jest.mock('./../../lib', () => ({
|
jest.mock('./../../lib', () => ({
|
||||||
extractTimeFields: jest.requireActual('./../../lib').extractTimeFields,
|
extractTimeFields: jest.requireActual('./../../lib').extractTimeFields,
|
||||||
ensureMinimumTime: async (fields: IFieldType) => Promise.resolve(fields),
|
ensureMinimumTime: async (fields: IndexPatternField) => Promise.resolve(fields),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockIndexPatternCreationType = new IndexPatternCreationConfig({
|
const mockIndexPatternCreationType = new IndexPatternCreationConfig({
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { extractTimeFields } from './extract_time_fields';
|
import { extractTimeFields } from './extract_time_fields';
|
||||||
|
import type { IndexPatternField } from 'src/plugins/data/public';
|
||||||
|
|
||||||
describe('extractTimeFields', () => {
|
describe('extractTimeFields', () => {
|
||||||
it('should handle no date fields', () => {
|
it('should handle no date fields', () => {
|
||||||
const fields = [
|
const fields = [
|
||||||
{ type: 'text', name: 'name' },
|
{ type: 'text', name: 'name' },
|
||||||
{ type: 'text', name: 'name' },
|
{ type: 'text', name: 'name' },
|
||||||
];
|
] as IndexPatternField[];
|
||||||
|
|
||||||
expect(extractTimeFields(fields)).toEqual([
|
expect(extractTimeFields(fields)).toEqual([
|
||||||
{ display: `The indices which match this index pattern don't contain any time fields.` },
|
{ 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', () => {
|
it('should add extra options', () => {
|
||||||
const fields = [{ type: 'date', name: '@timestamp' }];
|
const fields = [{ type: 'date', name: '@timestamp' }] as IndexPatternField[];
|
||||||
|
|
||||||
expect(extractTimeFields(fields)).toEqual([
|
expect(extractTimeFields(fields)).toEqual([
|
||||||
{ display: '@timestamp', fieldName: '@timestamp' },
|
{ display: '@timestamp', fieldName: '@timestamp' },
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
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 dateFields = fields.filter((field) => field.type === 'date');
|
||||||
const label = i18n.translate(
|
const label = i18n.translate(
|
||||||
'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldsLabel',
|
'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldsLabel',
|
||||||
|
|
|
@ -138,7 +138,6 @@ exports[`Table should render normally 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"displayName": "Elastic",
|
"displayName": "Elastic",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"format": "",
|
|
||||||
"hasRuntime": false,
|
"hasRuntime": false,
|
||||||
"info": Array [],
|
"info": Array [],
|
||||||
"isMapped": true,
|
"isMapped": true,
|
||||||
|
@ -150,7 +149,6 @@ exports[`Table should render normally 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"displayName": "timestamp",
|
"displayName": "timestamp",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"format": "YYYY-MM-DD",
|
|
||||||
"hasRuntime": false,
|
"hasRuntime": false,
|
||||||
"info": Array [],
|
"info": Array [],
|
||||||
"isMapped": true,
|
"isMapped": true,
|
||||||
|
@ -161,7 +159,6 @@ exports[`Table should render normally 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"displayName": "conflictingField",
|
"displayName": "conflictingField",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"format": "",
|
|
||||||
"hasRuntime": false,
|
"hasRuntime": false,
|
||||||
"info": Array [],
|
"info": Array [],
|
||||||
"isMapped": true,
|
"isMapped": true,
|
||||||
|
|
|
@ -25,7 +25,6 @@ const items: IndexedFieldItem[] = [
|
||||||
type: 'name',
|
type: 'name',
|
||||||
kbnType: 'string',
|
kbnType: 'string',
|
||||||
excluded: false,
|
excluded: false,
|
||||||
format: '',
|
|
||||||
isMapped: true,
|
isMapped: true,
|
||||||
hasRuntime: false,
|
hasRuntime: false,
|
||||||
},
|
},
|
||||||
|
@ -36,7 +35,6 @@ const items: IndexedFieldItem[] = [
|
||||||
kbnType: 'date',
|
kbnType: 'date',
|
||||||
info: [],
|
info: [],
|
||||||
excluded: false,
|
excluded: false,
|
||||||
format: 'YYYY-MM-DD',
|
|
||||||
isMapped: true,
|
isMapped: true,
|
||||||
hasRuntime: false,
|
hasRuntime: false,
|
||||||
},
|
},
|
||||||
|
@ -47,7 +45,6 @@ const items: IndexedFieldItem[] = [
|
||||||
kbnType: 'conflict',
|
kbnType: 'conflict',
|
||||||
info: [],
|
info: [],
|
||||||
excluded: false,
|
excluded: false,
|
||||||
format: '',
|
|
||||||
isMapped: true,
|
isMapped: true,
|
||||||
hasRuntime: false,
|
hasRuntime: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,9 +6,12 @@
|
||||||
* Side Public License, v 1.
|
* 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[];
|
info: string[];
|
||||||
excluded: boolean;
|
excluded: boolean;
|
||||||
kbnType: string;
|
kbnType: string;
|
||||||
|
|
|
@ -39,10 +39,9 @@ import {
|
||||||
getSupportedScriptingLanguages,
|
getSupportedScriptingLanguages,
|
||||||
} from '../../scripting_languages';
|
} from '../../scripting_languages';
|
||||||
import {
|
import {
|
||||||
IndexPatternField,
|
|
||||||
FieldFormatInstanceType,
|
FieldFormatInstanceType,
|
||||||
IndexPattern,
|
IndexPattern,
|
||||||
IFieldType,
|
IndexPatternField,
|
||||||
KBN_FIELD_TYPES,
|
KBN_FIELD_TYPES,
|
||||||
ES_FIELD_TYPES,
|
ES_FIELD_TYPES,
|
||||||
DataPublicPluginStart,
|
DataPublicPluginStart,
|
||||||
|
@ -145,7 +144,7 @@ export class FieldEditor extends PureComponent<FieldEdiorProps, FieldEditorState
|
||||||
scriptingLangs: [],
|
scriptingLangs: [],
|
||||||
fieldTypes: [],
|
fieldTypes: [],
|
||||||
fieldTypeFormats: [],
|
fieldTypeFormats: [],
|
||||||
existingFieldNames: indexPattern.fields.getAll().map((f: IFieldType) => f.name),
|
existingFieldNames: indexPattern.fields.getAll().map((f: IndexPatternField) => f.name),
|
||||||
fieldFormatId: undefined,
|
fieldFormatId: undefined,
|
||||||
fieldFormatParams: {},
|
fieldFormatParams: {},
|
||||||
showScriptingHelp: false,
|
showScriptingHelp: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue