From 2e1172a03769c68650d8a792b8b9c47057b0b83f Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 27 Jan 2022 15:32:32 -0500 Subject: [PATCH] [Fleet] Remove usage of IFieldType in Fleet (#123960) --- .../applications/fleet/components/search_bar.tsx | 8 ++++---- .../components/agent_logs/query_bar.tsx | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx index f1a23ea759def..b1cc6ad81ec5f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx @@ -9,7 +9,7 @@ import React, { useState, useEffect, useMemo } from 'react'; import { fromKueryExpression } from '@kbn/es-query'; -import type { IFieldType } from '../../../../../../../src/plugins/data/public'; +import type { FieldSpec } from '../../../../../../../src/plugins/data/common'; import { QueryStringInput } from '../../../../../../../src/plugins/data/public'; import { useStartServices } from '../hooks'; import { INDEX_NAME, AGENTS_PREFIX } from '../constants'; @@ -32,7 +32,7 @@ export const SearchBar: React.FunctionComponent = ({ indexPattern = INDEX_NAME, }) => { const { data } = useStartServices(); - const [indexPatternFields, setIndexPatternFields] = useState(); + const [indexPatternFields, setIndexPatternFields] = useState(); const isQueryValid = useMemo(() => { if (!value || value === '') { @@ -50,7 +50,7 @@ export const SearchBar: React.FunctionComponent = ({ useEffect(() => { const fetchFields = async () => { try { - const _fields: IFieldType[] = await data.indexPatterns.getFieldsForWildcard({ + const _fields: FieldSpec[] = await data.dataViews.getFieldsForWildcard({ pattern: indexPattern, }); const fields = (_fields || []).filter((field) => { @@ -69,7 +69,7 @@ export const SearchBar: React.FunctionComponent = ({ } }; fetchFields(); - }, [data.indexPatterns, fieldPrefix, indexPattern]); + }, [data.dataViews, fieldPrefix, indexPattern]); return ( void; }> = memo(({ query, isQueryValid, onUpdateQuery }) => { const { data } = useStartServices(); - const [indexPatternFields, setIndexPatternFields] = useState(); + const [indexPatternFields, setIndexPatternFields] = useState(); useEffect(() => { const fetchFields = async () => { try { const fields = ( - ((await data.indexPatterns.getFieldsForWildcard({ + (await data.dataViews.getFieldsForWildcard({ pattern: AGENT_LOG_INDEX_PATTERN, - })) as IFieldType[]) || [] + })) || [] ).filter((field) => { return !EXCLUDED_FIELDS.includes(field.name); }); @@ -45,7 +45,7 @@ export const LogQueryBar: React.FunctionComponent<{ } }; fetchFields(); - }, [data.indexPatterns]); + }, [data.dataViews]); return (