From cb3d353a3656408a3fb541e9ccbf9587ab63fb2f Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 20 Aug 2021 12:08:54 -0400 Subject: [PATCH] Remove references to deprecated IIndexPattern. (#109347) --- .../shared/exploratory_view/configurations/utils.ts | 10 +++++----- .../exploratory_view/hooks/use_app_index_pattern.tsx | 8 ++++---- .../public/components/shared/exploratory_view/types.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts index f7df2939d990..1af4e83ed1f5 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts @@ -7,7 +7,7 @@ import rison, { RisonValue } from 'rison-node'; import type { SeriesUrl, UrlFilter } from '../types'; import type { AllSeries, AllShortSeries } from '../hooks/use_series_storage'; -import { IIndexPattern } from '../../../../../../../../src/plugins/data/common/index_patterns'; +import { IndexPattern } from '../../../../../../../../src/plugins/data/common/index_patterns'; import { esFilters, ExistsFilter } from '../../../../../../../../src/plugins/data/public'; import { URL_KEYS } from './constants/url_constants'; import { PersistableFilter } from '../../../../../../lens/common'; @@ -53,7 +53,7 @@ export function createExploratoryViewUrl(allSeries: AllSeries, baseHref = '') { ); } -export function buildPhraseFilter(field: string, value: string, indexPattern: IIndexPattern) { +export function buildPhraseFilter(field: string, value: string, indexPattern: IndexPattern) { const fieldMeta = indexPattern?.fields.find((fieldT) => fieldT.name === field); if (fieldMeta) { return [esFilters.buildPhraseFilter(fieldMeta, value, indexPattern)]; @@ -61,7 +61,7 @@ export function buildPhraseFilter(field: string, value: string, indexPattern: II return []; } -export function buildPhrasesFilter(field: string, value: string[], indexPattern: IIndexPattern) { +export function buildPhrasesFilter(field: string, value: string[], indexPattern: IndexPattern) { const fieldMeta = indexPattern?.fields.find((fieldT) => fieldT.name === field); if (fieldMeta) { return [esFilters.buildPhrasesFilter(fieldMeta, value, indexPattern)]; @@ -69,7 +69,7 @@ export function buildPhrasesFilter(field: string, value: string[], indexPattern: return []; } -export function buildExistsFilter(field: string, indexPattern: IIndexPattern) { +export function buildExistsFilter(field: string, indexPattern: IndexPattern) { const fieldMeta = indexPattern?.fields.find((fieldT) => fieldT.name === field); if (fieldMeta) { return [esFilters.buildExistsFilter(fieldMeta, indexPattern)]; @@ -86,7 +86,7 @@ export function urlFilterToPersistedFilter({ }: { urlFilters: UrlFilter[]; initFilters: FiltersType; - indexPattern: IIndexPattern; + indexPattern: IndexPattern; }) { const parsedFilters: FiltersType = initFilters ? [...initFilters] : []; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx index 7a5f12a72b1f..e508990ea25a 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx @@ -13,14 +13,14 @@ import { ObservabilityPublicPluginsStart } from '../../../../plugin'; import { ObservabilityIndexPatterns } from '../utils/observability_index_patterns'; import { getDataHandler } from '../../../../data_handler'; -export interface IIndexPatternContext { +export interface IndexPatternContext { loading: boolean; indexPatterns: IndexPatternState; hasAppData: HasAppDataState; loadIndexPattern: (params: { dataType: AppDataType }) => void; } -export const IndexPatternContext = createContext>({}); +export const IndexPatternContext = createContext>({}); interface ProviderProps { children: JSX.Element; @@ -46,7 +46,7 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { services: { data }, } = useKibana(); - const loadIndexPattern: IIndexPatternContext['loadIndexPattern'] = useCallback( + const loadIndexPattern: IndexPatternContext['loadIndexPattern'] = useCallback( async ({ dataType }) => { if (hasAppData[dataType] === null && !loading[dataType]) { setLoading((prevState) => ({ ...prevState, [dataType]: true })); @@ -101,7 +101,7 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { export const useAppIndexPatternContext = (dataType?: AppDataType) => { const { loading, hasAppData, loadIndexPattern, indexPatterns } = useContext( - (IndexPatternContext as unknown) as Context + (IndexPatternContext as unknown) as Context ); if (dataType && !indexPatterns?.[dataType] && !loading) { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts index fbda2f4ff62e..9817899412ce 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts @@ -17,7 +17,7 @@ import { } from '../../../../../lens/public'; import { PersistableFilter } from '../../../../../lens/common'; -import { IIndexPattern } from '../../../../../../../src/plugins/data/public'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; export const ReportViewTypes = { dist: 'data-distribution', @@ -91,7 +91,7 @@ export interface UrlFilter { } export interface ConfigProps { - indexPattern: IIndexPattern; + indexPattern: IndexPattern; series?: SeriesUrl; }