From 58af03501abcefa3c2b5559c8184ca407f3e6df5 Mon Sep 17 00:00:00 2001 From: Matt Kime Date: Mon, 10 Aug 2020 17:52:46 -0500 Subject: [PATCH] use fields.getAll where possible --- ...plugin-plugins-data-public.fieldlist.getall.md | 11 +++++++++++ ...kibana-plugin-plugins-data-public.fieldlist.md | 1 + ...s-data-public.iindexpatternfieldlist.getall.md | 15 +++++++++++++++ ...-plugins-data-public.iindexpatternfieldlist.md | 1 + .../common/es_query/filters/exists_filter.test.ts | 2 +- .../es_query/filters/get_filter_field.test.ts | 2 +- .../es_query/filters/phrases_filter.test.ts | 2 +- .../common/index_patterns/fields/field_list.ts | 2 ++ .../{fields.mocks.ts.ts => fields.mocks.ts} | 0 .../index_patterns/fields/index_pattern_field.ts | 4 ++-- .../index_patterns/index_pattern.ts | 4 ++-- src/plugins/data/common/index_patterns/mocks.ts | 2 +- src/plugins/data/common/index_patterns/types.ts | 4 ++-- src/plugins/data/public/public.api.md | 4 ++++ .../sidebar/lib/get_index_pattern_field_list.ts | 6 +++--- .../public/application/components/table/table.tsx | 8 +++----- .../edit_index_pattern/edit_index_pattern.tsx | 6 ++++-- .../components/edit_index_pattern/tabs/tabs.tsx | 2 +- .../components/edit_index_pattern/tabs/utils.ts | 4 ++-- .../components/scripting_help/test_script.tsx | 1 + .../components/field_editor/field_editor.tsx | 8 ++++---- .../public/control/list_control_factory.ts | 2 +- .../public/helpers/arg_value_suggestions.ts | 3 +++ .../common/components/autocomplete/field.test.tsx | 2 +- .../autocomplete/field_value_lists.test.tsx | 2 +- .../autocomplete/field_value_match.test.tsx | 2 +- .../autocomplete/field_value_match_any.test.tsx | 2 +- .../components/autocomplete/helpers.test.ts | 2 +- .../hooks/use_field_value_autocomplete.test.ts | 2 +- .../components/autocomplete/operator.test.tsx | 2 +- .../exceptions/builder/entry_item.test.tsx | 2 +- .../exceptions/builder/exception_item.test.tsx | 2 +- .../exceptions/builder/helpers.test.tsx | 2 +- .../components/exceptions/builder/index.test.tsx | 2 +- 34 files changed, 77 insertions(+), 39 deletions(-) create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md rename src/plugins/data/common/index_patterns/fields/{fields.mocks.ts.ts => fields.mocks.ts} (100%) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md new file mode 100644 index 0000000000000..da29a4de9acc8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldList](./kibana-plugin-plugins-data-public.fieldlist.md) > [getAll](./kibana-plugin-plugins-data-public.fieldlist.getall.md) + +## FieldList.getAll property + +Signature: + +```typescript +readonly getAll: () => IndexPatternField[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md index ef740575dff4e..012b069430290 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md @@ -21,6 +21,7 @@ export declare class FieldList extends Array implements IInde | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [add](./kibana-plugin-plugins-data-public.fieldlist.add.md) | | (field: FieldSpec) => void | | +| [getAll](./kibana-plugin-plugins-data-public.fieldlist.getall.md) | | () => IndexPatternField[] | | | [getByName](./kibana-plugin-plugins-data-public.fieldlist.getbyname.md) | | (name: IndexPatternField['name']) => IndexPatternField | undefined | | | [getByType](./kibana-plugin-plugins-data-public.fieldlist.getbytype.md) | | (type: IndexPatternField['type']) => any[] | | | [remove](./kibana-plugin-plugins-data-public.fieldlist.remove.md) | | (field: IFieldType) => void | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md new file mode 100644 index 0000000000000..070e36e303a80 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPatternFieldList](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.md) > [getAll](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md) + +## IIndexPatternFieldList.getAll() method + +Signature: + +```typescript +getAll(): IndexPatternField[]; +``` +Returns: + +`IndexPatternField[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md index 4ab012a2601d2..b068c4804c0dd 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md @@ -15,6 +15,7 @@ export interface IIndexPatternFieldList extends Array | Method | Description | | --- | --- | | [add(field)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.add.md) | | +| [getAll()](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md) | | | [getByName(name)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getbyname.md) | | | [getByType(type)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getbytype.md) | | | [remove(field)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.remove.md) | | diff --git a/src/plugins/data/common/es_query/filters/exists_filter.test.ts b/src/plugins/data/common/es_query/filters/exists_filter.test.ts index 065301986726d..298ea7f49da5e 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.test.ts +++ b/src/plugins/data/common/es_query/filters/exists_filter.test.ts @@ -19,7 +19,7 @@ import { buildExistsFilter, getExistsFilterField } from './exists_filter'; import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../index_patterns/fields/fields.mocks'; describe('exists filter', function () { const indexPattern: IIndexPattern = ({ diff --git a/src/plugins/data/common/es_query/filters/get_filter_field.test.ts b/src/plugins/data/common/es_query/filters/get_filter_field.test.ts index 4329a45f84ef9..3b27aa98cf5f6 100644 --- a/src/plugins/data/common/es_query/filters/get_filter_field.test.ts +++ b/src/plugins/data/common/es_query/filters/get_filter_field.test.ts @@ -21,7 +21,7 @@ import { buildPhraseFilter } from './phrase_filter'; import { buildQueryFilter } from './query_string_filter'; import { getFilterField } from './get_filter_field'; import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../index_patterns/fields/fields.mocks'; describe('getFilterField', function () { const indexPattern: IIndexPattern = ({ diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.test.ts b/src/plugins/data/common/es_query/filters/phrases_filter.test.ts index 7fbab263ac040..ed42b63be7ecc 100644 --- a/src/plugins/data/common/es_query/filters/phrases_filter.test.ts +++ b/src/plugins/data/common/es_query/filters/phrases_filter.test.ts @@ -19,7 +19,7 @@ import { buildPhrasesFilter, getPhrasesFilterField } from './phrases_filter'; import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../index_patterns/fields/fields.mocks'; describe('phrases filter', function () { const indexPattern: IIndexPattern = ({ diff --git a/src/plugins/data/common/index_patterns/fields/field_list.ts b/src/plugins/data/common/index_patterns/fields/field_list.ts index 207002f42bbce..172da9f9ca43f 100644 --- a/src/plugins/data/common/index_patterns/fields/field_list.ts +++ b/src/plugins/data/common/index_patterns/fields/field_list.ts @@ -27,6 +27,7 @@ type FieldMap = Map; export interface IIndexPatternFieldList extends Array { add(field: FieldSpec): void; + getAll(): IndexPatternField[]; getByName(name: IndexPatternField['name']): IndexPatternField | undefined; getByType(type: IndexPatternField['type']): IndexPatternField[]; remove(field: IFieldType): void; @@ -72,6 +73,7 @@ export class FieldList extends Array implements IIndexPattern specs.map((field) => this.add(field)); } + public readonly getAll = () => [...this.byName.values()]; public readonly getByName = (name: IndexPatternField['name']) => this.byName.get(name); public readonly getByType = (type: IndexPatternField['type']) => [ ...(this.groups.get(type) || new Map()).values(), diff --git a/src/plugins/data/common/index_patterns/fields/fields.mocks.ts.ts b/src/plugins/data/common/index_patterns/fields/fields.mocks.ts similarity index 100% rename from src/plugins/data/common/index_patterns/fields/fields.mocks.ts.ts rename to src/plugins/data/common/index_patterns/fields/fields.mocks.ts diff --git a/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts b/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts index 4e22332bef141..679de103f8019 100644 --- a/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts +++ b/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts @@ -62,7 +62,7 @@ export class IndexPatternField implements IFieldType { // writable attrs public get count() { - return this.spec.count; + return this.spec.count || 0; } public set count(count) { @@ -107,7 +107,7 @@ export class IndexPatternField implements IFieldType { } public get scripted() { - return this.spec.scripted; + return !!this.spec.scripted; } public get searchable() { diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts index 211919e8e6b53..4e484dce7826f 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts @@ -403,11 +403,11 @@ export class IndexPattern implements IIndexPattern { } getNonScriptedFields() { - return [...this.fields.filter((field) => !field.scripted)]; + return [...this.fields.getAll().filter((field) => !field.scripted)]; } getScriptedFields() { - return [...this.fields.filter((field) => field.scripted)]; + return [...this.fields.getAll().filter((field) => field.scripted)]; } isTimeBased(): boolean { diff --git a/src/plugins/data/common/index_patterns/mocks.ts b/src/plugins/data/common/index_patterns/mocks.ts index 6036c08fa2b10..faf1b8307ea2e 100644 --- a/src/plugins/data/common/index_patterns/mocks.ts +++ b/src/plugins/data/common/index_patterns/mocks.ts @@ -17,4 +17,4 @@ * under the License. */ -export * from './fields/fields.mocks.ts'; +export * from './fields/fields.mocks'; diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index 3a7cf54843dfc..a771113acd231 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -149,7 +149,7 @@ export interface FieldSpecExportFmt { } export interface FieldSpec { - count: number; + count?: number; script?: string; lang?: string; conflictDescriptions?: Record; @@ -158,7 +158,7 @@ export interface FieldSpec { name: string; type: string; esTypes?: string[]; - scripted: boolean; + scripted?: boolean; searchable: boolean; aggregatable: boolean; readFromDocValues?: boolean; diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 76f88df4dd6fc..adff7b205b931 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -585,6 +585,8 @@ export class FieldList extends Array implements IIndexPattern // (undocumented) readonly add: (field: FieldSpec) => void; // (undocumented) + readonly getAll: () => IndexPatternField[]; + // (undocumented) readonly getByName: (name: IndexPatternField['name']) => IndexPatternField | undefined; // (undocumented) readonly getByType: (type: IndexPatternField['type']) => any[]; @@ -879,6 +881,8 @@ export interface IIndexPatternFieldList extends Array { // (undocumented) add(field: FieldSpec): void; // (undocumented) + getAll(): IndexPatternField[]; + // (undocumented) getByName(name: IndexPatternField['name']): IndexPatternField | undefined; // (undocumented) getByType(type: IndexPatternField['type']): IndexPatternField[]; diff --git a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts index 751a59d982153..00e00aa8e2991 100644 --- a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { difference, map } from 'lodash'; +import { difference } from 'lodash'; import { IndexPattern, IndexPatternField } from 'src/plugins/data/public'; export function getIndexPatternFieldList( @@ -26,7 +26,7 @@ export function getIndexPatternFieldList( if (!indexPattern || !fieldCounts) return []; const fieldNamesInDocs = Object.keys(fieldCounts); - const fieldNamesInIndexPattern = map(indexPattern.fields, 'name'); + const fieldNamesInIndexPattern = indexPattern.fields.getAll().map((fld) => fld.name); const unknownTypes: IndexPatternField[] = []; difference(fieldNamesInDocs, fieldNamesInIndexPattern).forEach((unknownFieldName) => { @@ -36,5 +36,5 @@ export function getIndexPatternFieldList( } as IndexPatternField); }); - return [...indexPattern.fields, ...unknownTypes]; + return [...indexPattern.fields.getAll(), ...unknownTypes]; } diff --git a/src/plugins/discover/public/application/components/table/table.tsx b/src/plugins/discover/public/application/components/table/table.tsx index 9b95f2fc6bd27..628045bd32f61 100644 --- a/src/plugins/discover/public/application/components/table/table.tsx +++ b/src/plugins/discover/public/application/components/table/table.tsx @@ -104,15 +104,13 @@ export function DocViewTable({ // to the index pattern, but that has its own complications which you can read more about in the following // issue: https://github.com/elastic/kibana/issues/54957 const isNestedField = - !indexPattern.fields.find((patternField) => patternField.name === field) && - !!indexPattern.fields.find((patternField) => { + !indexPattern.fields.getByName(field) && + !!indexPattern.fields.getAll().find((patternField) => { // We only want to match a full path segment const nestedRootRegex = new RegExp(escapeRegExp(field) + '(\\.|$)'); return nestedRootRegex.test(patternField.subType?.nested?.path ?? ''); }); - const fieldType = isNestedField - ? 'nested' - : indexPattern.fields.find((patternField) => patternField.name === field)?.type; + const fieldType = isNestedField ? 'nested' : indexPattern.fields.getByName(field)?.type; return ( ().services; const [fields, setFields] = useState(indexPattern.getNonScriptedFields()); const [conflictedFields, setConflictedFields] = useState( - indexPattern.fields.filter((field) => field.type === 'conflict') + indexPattern.fields.getAll().filter((field) => field.type === 'conflict') ); const [defaultIndex, setDefaultIndex] = useState(uiSettings.get('defaultIndex')); const [tags, setTags] = useState([]); useEffect(() => { setFields(indexPattern.getNonScriptedFields()); - setConflictedFields(indexPattern.fields.filter((field) => field.type === 'conflict')); + setConflictedFields( + indexPattern.fields.getAll().filter((field) => field.type === 'conflict') + ); }, [indexPattern]); useEffect(() => { diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx index a59dca80a3684..f32eb63ad04b4 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx @@ -87,7 +87,7 @@ export function Tabs({ indexPattern, fields, history, location }: TabsProps) { const refreshFilters = useCallback(() => { const tempIndexedFieldTypes: string[] = []; const tempScriptedFieldLanguages: string[] = []; - indexPattern.fields.forEach((field) => { + indexPattern.fields.getAll().forEach((field) => { if (field.scripted) { if (field.lang) { tempScriptedFieldLanguages.push(field.lang); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts index 5ab9c695caaa0..b422de93de7a9 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts @@ -84,9 +84,9 @@ export function getTabs( fieldFilter: string, indexPatternListProvider: IndexPatternManagementStart['list'] ) { - const totalCount = getCounts(indexPattern.fields, indexPattern.getSourceFiltering()); + const totalCount = getCounts(indexPattern.fields.getAll(), indexPattern.getSourceFiltering()); const filteredCount = getCounts( - indexPattern.fields, + indexPattern.fields.getAll(), indexPattern.getSourceFiltering(), fieldFilter ); diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx index cb1d5a25c01ae..77c6698fdc337 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -188,6 +188,7 @@ export class TestScript extends Component { const fields: EuiComboBoxOptionOption[] = []; this.props.indexPattern.fields + .getAll() .filter((field) => { const isMultiField = field.subType && field.subType.multi; return !field.name.startsWith('_') && !isMultiField && !field.scripted; 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 d78e1e1014581..6a3f632a9582e 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 @@ -155,7 +155,7 @@ export class FieldEditor extends PureComponent f.name), + existingFieldNames: indexPattern.fields.getAll().map((f: IFieldType) => f.name), fieldFormatId: undefined, fieldFormatParams: {}, showScriptingHelp: false, @@ -197,7 +197,7 @@ export class FieldEditor extends PureComponent f.name === spec.name), + isCreating: !indexPattern.fields.getByName(spec.name), isDeprecatedLang: this.deprecatedLangs.includes(spec.lang || ''), errors: [], scriptingLangs, @@ -804,11 +804,11 @@ export class FieldEditor extends PureComponent f.name === field.name); + const fieldExists = !!indexPattern.fields.getByName(field.name); let oldField: IndexPatternField['spec']; - if (index > -1) { + if (fieldExists) { oldField = indexPattern.fields.getByName(field.name)!.spec; indexPattern.fields.update(field); } else { diff --git a/src/plugins/input_control_vis/public/control/list_control_factory.ts b/src/plugins/input_control_vis/public/control/list_control_factory.ts index 65a3e37a93edf..acbbf08c7d004 100644 --- a/src/plugins/input_control_vis/public/control/list_control_factory.ts +++ b/src/plugins/input_control_vis/public/control/list_control_factory.ts @@ -216,7 +216,7 @@ export async function listControlFactory( // dynamic options are only allowed on String fields but the setting defaults to true so it could // be enabled for non-string fields (since UI input is hidden for non-string fields). // If field is not string, then disable dynamic options. - const field = indexPattern.fields.find(({ name }) => name === controlParams.fieldName); + const field = indexPattern.fields.getAll().find(({ name }) => name === controlParams.fieldName); if (field && field.type !== 'string') { controlParams.options.dynamicOptions = false; } diff --git a/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts index 19ec46bd7f659..85d41aab5859d 100644 --- a/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts +++ b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts @@ -117,6 +117,7 @@ export function getArgValueSuggestions() { const valueSplit = partial.split(':'); return indexPattern.fields + .getAll() .filter((field) => { return ( field.aggregatable && @@ -136,6 +137,7 @@ export function getArgValueSuggestions() { } return indexPattern.fields + .getAll() .filter((field) => { return ( field.aggregatable && @@ -155,6 +157,7 @@ export function getArgValueSuggestions() { } return indexPattern.fields + .getAll() .filter((field) => { return ( 'date' === field.type && diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx index 30864f246071b..a678deae41542 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx @@ -12,7 +12,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { fields, getField, -} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { FieldComponent } from './field'; describe('FieldComponent', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx index eca38b9effe1b..eef6e09d496db 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx @@ -11,7 +11,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; // we don't have the types for waitFor just yet, so using "as waitFor" until when we do import { wait as waitFor } from '@testing-library/react'; -import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { ListSchema } from '../../../lists_plugin_deps'; import { getFoundListSchemaMock } from '../../../../../lists/common/schemas/response/found_list_schema.mock'; import { getListResponseMock } from '../../../../../lists/common/schemas/response/list_schema.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx index 998ed1f3351c8..94040ccb639be 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx @@ -12,7 +12,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { fields, getField, -} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { AutocompleteFieldMatchComponent } from './field_value_match'; import { useFieldValueAutocomplete } from './hooks/use_field_value_autocomplete'; jest.mock('./hooks/use_field_value_autocomplete'); diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx index 0a0281a9c4a51..4074150f76d06 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx @@ -12,7 +12,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { fields, getField, -} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { AutocompleteFieldMatchAnyComponent } from './field_value_match_any'; import { useFieldValueAutocomplete } from './hooks/use_field_value_autocomplete'; jest.mock('./hooks/use_field_value_autocomplete'); diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts b/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts index 289cdd5e87c00..bbcbcbcf928b3 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts @@ -5,7 +5,7 @@ */ import '../../../common/mock/match_media'; -import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { EXCEPTION_OPERATORS, diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts b/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts index a76b50d11a875..82e9c21f6b839 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts @@ -13,7 +13,7 @@ import { } from './use_field_value_autocomplete'; import { useKibana } from '../../../../common/lib/kibana'; import { stubIndexPatternWithFields } from '../../../../../../../../src/plugins/data/common/index_patterns/index_pattern.stub'; -import { getField } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { OperatorTypeEnum } from '../../../../lists_plugin_deps'; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx index 737be199e2481..e6f6227811085 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx @@ -9,7 +9,7 @@ import { mount } from 'enzyme'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; -import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { OperatorComponent } from './operator'; import { isOperator, isNotOperator } from './operators'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx index 2a116c4cd8acf..59a5db2a09779 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx @@ -22,7 +22,7 @@ import { import { fields, getField, -} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getFoundListSchemaMock } from '../../../../../../lists/common/schemas/response/found_list_schema.mock'; import { getEmptyValue } from '../../empty_value'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx index e90639a2c0285..0f9be25e046b2 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx @@ -10,7 +10,7 @@ import { mount } from 'enzyme'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { useKibana } from '../../../../common/lib/kibana'; -import { fields } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; import { getEntryMatchMock } from '../../../../../../lists/common/schemas/types/entry_match.mock'; import { getEntryMatchAnyMock } from '../../../../../../lists/common/schemas/types/entry_match_any.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx index 04ab9ee7216f7..9bfd04cc19d72 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx @@ -6,7 +6,7 @@ import { fields, getField, -} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getEntryNestedMock } from '../../../../../../lists/common/schemas/types/entry_nested.mock'; import { getEntryMatchMock } from '../../../../../../lists/common/schemas/types/entry_match.mock'; import { getEntryMatchAnyMock } from '../../../../../../lists/common/schemas/types/entry_match_any.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx index 3fa0e59f9acb0..2d389a7dbcee1 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx @@ -13,7 +13,7 @@ import { wait as waitFor } from '@testing-library/react'; import { fields, getField, -} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; import { getEntryMatchAnyMock } from '../../../../../../lists/common/schemas/types/entry_match_any.mock';