Skip to content

Commit

Permalink
[APM] Replace StaticIndexPattern with IIndexPattern (#51689)
Browse files Browse the repository at this point in the history
  • Loading branch information
smith authored Nov 26, 2019
1 parent f7d9e7b commit e721ec4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { MemoryRouter } from 'react-router-dom';
import { UpdateBreadcrumbs } from '../UpdateBreadcrumbs';
import * as kibanaCore from '../../../../../../observability/public/context/kibana_core';

jest.mock('ui/index_patterns');
jest.mock('ui/new_platform');

const coreMock = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import React, { useState } from 'react';
import { uniqueId, startsWith } from 'lodash';
import styled from 'styled-components';
import { StaticIndexPattern } from 'ui/index_patterns';
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
import { i18n } from '@kbn/i18n';
import { fromQuery, toQuery } from '../Links/url_helpers';
Expand All @@ -19,7 +18,8 @@ import { useUrlParams } from '../../../hooks/useUrlParams';
import { history } from '../../../utils/history';
import {
AutocompleteSuggestion,
AutocompleteProvider
AutocompleteProvider,
IIndexPattern
} from '../../../../../../../../src/plugins/data/public';
import { useDynamicIndexPattern } from '../../../hooks/useDynamicIndexPattern';
import { usePlugins } from '../../../new-platform/plugin';
Expand All @@ -33,18 +33,15 @@ interface State {
isLoadingSuggestions: boolean;
}

function convertKueryToEsQuery(
kuery: string,
indexPattern: StaticIndexPattern
) {
function convertKueryToEsQuery(kuery: string, indexPattern: IIndexPattern) {
const ast = fromKueryExpression(kuery);
return toElasticsearchQuery(ast, indexPattern);
}

function getSuggestions(
query: string,
selectionStart: number,
indexPattern: StaticIndexPattern,
indexPattern: IIndexPattern,
boolFilter: unknown,
autocompleteProvider?: AutocompleteProvider
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import moment from 'moment';
import { KibanaRequest } from 'src/core/server';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/common';
import { APMConfig } from '../../../../../../plugins/apm/server';
import {
Expand All @@ -22,7 +21,7 @@ import { ProcessorEvent } from '../../../common/processor_event';
import { getDynamicIndexPattern } from '../index_pattern/get_dynamic_index_pattern';

function decodeUiFilters(
indexPattern: StaticIndexPattern | undefined,
indexPattern: IIndexPattern | undefined,
uiFiltersEncoded?: string
) {
if (!uiFiltersEncoded || !indexPattern) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { StaticIndexPattern } from 'ui/index_patterns';
import { APICaller } from 'src/core/server';
import LRU from 'lru-cache';
import {
Expand Down Expand Up @@ -51,7 +50,7 @@ export const getDynamicIndexPattern = async ({
pattern: patternIndices
});

const indexPattern: StaticIndexPattern = {
const indexPattern: IIndexPattern = {
fields,
title: indexPatternTitle
};
Expand Down

0 comments on commit e721ec4

Please sign in to comment.