remove IFieldType references (#107355)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
f3d8431dd6
commit
dcd628b8a3
|
@ -12,7 +12,7 @@ import React, { Component } from 'react';
|
|||
import { injectI18n, FormattedMessage, InjectedIntlProps } from '@kbn/i18n/react';
|
||||
import { EuiFormRow, EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
|
||||
|
||||
import { IndexPattern, IFieldType } from '../../../../data/public';
|
||||
import { IndexPattern, IndexPatternField } from '../../../../data/public';
|
||||
|
||||
interface FieldSelectUiState {
|
||||
isLoading: boolean;
|
||||
|
@ -25,7 +25,7 @@ export type FieldSelectUiProps = InjectedIntlProps & {
|
|||
indexPatternId: string;
|
||||
onChange: (value: any) => void;
|
||||
fieldName?: string;
|
||||
filterField?: (field: IFieldType) => boolean;
|
||||
filterField?: (field: IndexPatternField) => boolean;
|
||||
controlIndex: number;
|
||||
};
|
||||
|
||||
|
@ -96,7 +96,7 @@ class FieldSelectUi extends Component<FieldSelectUiProps, FieldSelectUiState> {
|
|||
const fields: Array<EuiComboBoxOptionOption<string>> = [];
|
||||
indexPattern.fields
|
||||
.filter(this.props.filterField ?? (() => true))
|
||||
.forEach((field: IFieldType) => {
|
||||
.forEach((field: IndexPatternField) => {
|
||||
const fieldsList = fieldsByTypeMap.get(field.type) ?? [];
|
||||
fieldsList.push(field.name);
|
||||
fieldsByTypeMap.set(field.type, fieldsList);
|
||||
|
|
|
@ -14,7 +14,7 @@ import { EuiFormRow, EuiFieldNumber, EuiSwitch, EuiSelect } from '@elastic/eui';
|
|||
import { IndexPatternSelectFormRow } from './index_pattern_select_form_row';
|
||||
import { FieldSelect } from './field_select';
|
||||
import { ControlParams, ControlParamsOptions } from '../../editor_utils';
|
||||
import { IndexPattern, IFieldType, IndexPatternSelectProps } from '../../../../data/public';
|
||||
import { IndexPattern, IndexPatternField, IndexPatternSelectProps } from '../../../../data/public';
|
||||
import { InputControlVisDependencies } from '../../plugin';
|
||||
|
||||
interface ListControlEditorState {
|
||||
|
@ -40,7 +40,7 @@ interface ListControlEditorProps {
|
|||
deps: InputControlVisDependencies;
|
||||
}
|
||||
|
||||
function filterField(field: IFieldType) {
|
||||
function filterField(field: IndexPatternField) {
|
||||
return (
|
||||
Boolean(field.aggregatable) &&
|
||||
['number', 'boolean', 'date', 'ip', 'string'].includes(field.type)
|
||||
|
@ -116,7 +116,7 @@ export class ListControlEditor extends PureComponent<
|
|||
return;
|
||||
}
|
||||
|
||||
const field = (indexPattern.fields as IFieldType[]).find(
|
||||
const field = (indexPattern.fields as IndexPatternField[]).find(
|
||||
({ name }) => name === this.props.controlParams.fieldName
|
||||
);
|
||||
if (!field) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
|
|||
import { IndexPatternSelectFormRow } from './index_pattern_select_form_row';
|
||||
import { FieldSelect } from './field_select';
|
||||
import { ControlParams, ControlParamsOptions } from '../../editor_utils';
|
||||
import { IndexPattern, IFieldType, IndexPatternSelectProps } from '../../../../data/public';
|
||||
import { IndexPattern, IndexPatternField, IndexPatternSelectProps } from '../../../../data/public';
|
||||
import { InputControlVisDependencies } from '../../plugin';
|
||||
|
||||
interface RangeControlEditorProps {
|
||||
|
@ -35,7 +35,7 @@ interface RangeControlEditorState {
|
|||
IndexPatternSelect: ComponentType<IndexPatternSelectProps> | null;
|
||||
}
|
||||
|
||||
function filterField(field: IFieldType) {
|
||||
function filterField(field: IndexPatternField) {
|
||||
return field.type === 'number';
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,12 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
import { FilterManager } from './filter_manager';
|
||||
import { esFilters, RangeFilter, RangeFilterParams, IFieldType } from '../../../../data/public';
|
||||
import {
|
||||
esFilters,
|
||||
RangeFilter,
|
||||
RangeFilterParams,
|
||||
IndexPatternField,
|
||||
} from '../../../../data/public';
|
||||
|
||||
interface SliderValue {
|
||||
min?: string | number;
|
||||
|
@ -53,7 +58,7 @@ export class RangeFilterManager extends FilterManager {
|
|||
const indexPattern = this.getIndexPattern()!;
|
||||
const newFilter = esFilters.buildRangeFilter(
|
||||
// TODO: Fix type to be required
|
||||
indexPattern.fields.getByName(this.fieldName) as IFieldType,
|
||||
indexPattern.fields.getByName(this.fieldName) as IndexPatternField,
|
||||
toRange(value),
|
||||
indexPattern
|
||||
);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import _ from 'lodash';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
IFieldType,
|
||||
IndexPatternField,
|
||||
TimefilterContract,
|
||||
SearchSourceFields,
|
||||
DataPublicPluginStart,
|
||||
|
@ -26,7 +26,7 @@ function getEscapedQuery(query = '') {
|
|||
}
|
||||
|
||||
interface TermsAggArgs {
|
||||
field?: IFieldType;
|
||||
field?: IndexPatternField;
|
||||
size: number | null;
|
||||
direction: string;
|
||||
query?: string;
|
||||
|
|
|
@ -9,14 +9,18 @@
|
|||
import _ from 'lodash';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { IFieldType, TimefilterContract, DataPublicPluginStart } from 'src/plugins/data/public';
|
||||
import {
|
||||
IndexPatternField,
|
||||
TimefilterContract,
|
||||
DataPublicPluginStart,
|
||||
} from 'src/plugins/data/public';
|
||||
import { Control, noValuesDisableMsg, noIndexPatternMsg } from './control';
|
||||
import { RangeFilterManager } from './filter_manager/range_filter_manager';
|
||||
import { createSearchSource } from './create_search_source';
|
||||
import { ControlParams } from '../editor_utils';
|
||||
import { InputControlVisDependencies } from '../plugin';
|
||||
|
||||
const minMaxAgg = (field?: IFieldType) => {
|
||||
const minMaxAgg = (field?: IndexPatternField) => {
|
||||
const aggBody: any = {};
|
||||
if (field) {
|
||||
if (field.scripted) {
|
||||
|
|
Loading…
Reference in a new issue