[7.x] Replace StaticIndexPattern with IIndexPattern from NP (#51872) (#52030)

* Replace StaticIndexPattern with IIndexPattern from NP (#51872)

* replace SIP with IIP

* import path

* fix backport merge

* import removed
This commit is contained in:
Liza Katz 2019-12-03 07:28:12 +02:00 committed by GitHub
parent fbb0ad7ac2
commit 542b94a242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 133 additions and 139 deletions

View file

@ -35,7 +35,6 @@ export {
FieldListInterface,
IndexPattern,
IndexPatterns,
StaticIndexPattern,
} from './index_patterns';
export { QueryStringInput } from './query';
export { SearchBar, SearchBarProps } from './search';

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { IFieldType, IIndexPattern, indexPatterns } from '../../../../../plugins/data/public';
import { IFieldType, indexPatterns } from '../../../../../plugins/data/public';
const getFromSavedObject = indexPatterns.getFromSavedObject;
const getRoutes = indexPatterns.getRoutes;
@ -25,7 +25,6 @@ const flattenHitWrapper = indexPatterns.flattenHitWrapper;
export { getFromSavedObject, getRoutes, flattenHitWrapper };
export { IFieldType as FieldType };
export { IIndexPattern as StaticIndexPattern };
export {
Field,
FieldListInterface,

View file

@ -17,7 +17,6 @@
* under the License.
*/
import { StaticIndexPattern } from 'plugins/data';
import moment from 'moment';
import { Subscription } from 'rxjs';
@ -31,7 +30,13 @@ import {
import { ViewMode } from '../../../embeddable_api/public/np_ready/public';
import { SavedObjectDashboard } from './saved_dashboard/saved_dashboard';
import { DashboardAppState, SavedDashboardPanel, ConfirmModalFn } from './types';
import { TimeRange, Query, esFilters, SavedQuery } from '../../../../../../src/plugins/data/public';
import {
IIndexPattern,
TimeRange,
Query,
esFilters,
SavedQuery,
} from '../../../../../../src/plugins/data/public';
import { DashboardAppController } from './dashboard_app_controller';
import { RenderDeps } from './application';
@ -54,7 +59,7 @@ export interface DashboardAppScope extends ng.IScope {
savedQuery?: SavedQuery;
refreshInterval: any;
panels: SavedDashboardPanel[];
indexPatterns: StaticIndexPattern[];
indexPatterns: IIndexPattern[];
$evalAsync: any;
dashboardViewMode: ViewMode;
expandedPanel?: string;

View file

@ -17,11 +17,11 @@
* under the License.
*/
import { StaticIndexPattern } from '../../../kibana_services';
import { IIndexPattern } from '../../../../../../../../plugins/data/public';
import { SortOrder } from '../components/table_header/helpers';
export function getSort(
sort?: SortOrder[],
indexPattern?: StaticIndexPattern,
indexPattern?: IIndexPattern,
defaultSortOrder?: SortOrder
): any;

View file

@ -18,10 +18,9 @@
*/
import { EmbeddableInput, EmbeddableOutput, IEmbeddable } from 'src/plugins/embeddable/public';
import { StaticIndexPattern } from '../kibana_services';
import { SavedSearch } from '../types';
import { SortOrder } from '../angular/doc_table/components/table_header/helpers';
import { esFilters, TimeRange, Query } from '../../../../../../plugins/data/public';
import { esFilters, IIndexPattern, TimeRange, Query } from '../../../../../../plugins/data/public';
export interface SearchInput extends EmbeddableInput {
timeRange: TimeRange;
@ -34,7 +33,7 @@ export interface SearchInput extends EmbeddableInput {
export interface SearchOutput extends EmbeddableOutput {
editUrl: string;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
editable: boolean;
}

View file

@ -84,7 +84,7 @@ export { unhashUrl } from 'ui/state_management/state_hashing';
// EXPORT types
export { Vis } from 'ui/vis';
export { StaticIndexPattern, IndexPatterns, IndexPattern, FieldType } from 'ui/index_patterns';
export { IndexPatterns, IndexPattern, FieldType } from 'ui/index_patterns';
export { ElasticSearchHit } from 'ui/registry/doc_views_types';
export { DocViewRenderProps, DocViewRenderFn } from 'ui/registry/doc_views';
export { Adapters } from 'ui/inspector/types';

View file

@ -17,18 +17,15 @@
* under the License.
*/
import {
getServices,
getFromSavedObject,
StaticIndexPattern,
VisSavedObject,
} from '../kibana_services';
import { getServices, getFromSavedObject, VisSavedObject } from '../kibana_services';
import { IIndexPattern } from '../../../../../../plugins/data/public';
const { savedObjectsClient, uiSettings } = getServices();
export async function getIndexPattern(
savedVis: VisSavedObject
): Promise<StaticIndexPattern | undefined> {
): Promise<IIndexPattern | undefined> {
if (savedVis.vis.type.name !== 'metrics') {
return savedVis.vis.indexPattern;
}

View file

@ -18,7 +18,6 @@
*/
import _, { forEach } from 'lodash';
import { StaticIndexPattern } from 'ui/index_patterns';
import { PersistedState } from 'ui/persisted_state';
import { Subscription } from 'rxjs';
import * as Rx from 'rxjs';
@ -33,6 +32,7 @@ import { IExpressionLoaderParams } from 'src/plugins/expressions/public';
import { SearchSourceContract } from '../../../../../ui/public/courier';
import { VISUALIZE_EMBEDDABLE_TYPE } from './constants';
import {
IIndexPattern,
TimeRange,
Query,
onlyDisabledFiltersChanged,
@ -61,7 +61,7 @@ export interface VisSavedObject extends SavedObject {
export interface VisualizeEmbeddableConfiguration {
savedVisualization: VisSavedObject;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
editUrl: string;
editable: boolean;
appState?: AppState;
@ -81,7 +81,7 @@ export interface VisualizeInput extends EmbeddableInput {
export interface VisualizeOutput extends EmbeddableOutput {
editUrl: string;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
savedObjectId: string;
visTypeName: string;
}

View file

@ -117,7 +117,6 @@ export {
// export types
export { METRIC_TYPE };
export { StaticIndexPattern } from 'ui/index_patterns';
export { AppState } from 'ui/state_management/app_state';
export { VisType } from 'ui/vis';

View file

@ -44,7 +44,6 @@ export {
FieldListInterface,
IndexPattern,
IndexPatterns,
StaticIndexPattern,
} from '../../../core_plugins/data/public';
export { FieldList } from '../../../../plugins/data/public';

View file

@ -27,7 +27,7 @@ import { FieldFormatsStart } from '../field_formats_provider';
import { setNotifications, setFieldFormats, setHttp } from './services';
import { IndexPatterns } from './index_patterns';
interface IndexPatternDependencies {
export interface IndexPatternDependencies {
uiSettings: IUiSettingsClient;
savedObjectsClient: SavedObjectsClientContract;
http: HttpServiceBase;

View file

@ -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 {
@ -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) {

View file

@ -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 {
@ -51,7 +50,7 @@ export const getDynamicIndexPattern = async ({
pattern: patternIndices
});
const indexPattern: StaticIndexPattern = {
const indexPattern: IIndexPattern = {
fields,
title: indexPatternTitle
};

View file

@ -5,11 +5,11 @@
*/
import { omit } from 'lodash';
import { IIndexPattern } from 'src/plugins/data/server';
import { Projection } from '../../../../common/projections/typings';
import { UIFilters } from '../../../../typings/ui-filters';
import { getUiFiltersES } from '../../helpers/convert_ui_filters/get_ui_filters_es';
import { localUIFilters, LocalUIFilterName } from './config';
import { StaticIndexPattern } from '../../../../../../../../src/legacy/core_plugins/data/public';
export const getFilterAggregations = ({
indexPattern,
@ -17,7 +17,7 @@ export const getFilterAggregations = ({
projection,
localFilterNames
}: {
indexPattern: StaticIndexPattern | undefined;
indexPattern: IIndexPattern | undefined;
uiFilters: UIFilters;
projection: Projection;
localFilterNames: LocalUIFilterName[];

View file

@ -5,7 +5,6 @@
*/
import React, { FunctionComponent } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { Action } from 'typescript-fsa';
import { EuiFlexItem } from '@elastic/eui';
import { findToolbar } from '../../../../common/inventory_models/toolbars';
@ -21,9 +20,10 @@ import { InfraGroupByOptions } from '../../../lib/lib';
import { WithWaffleViewState } from '../../../containers/waffle/with_waffle_view_state';
import { SavedViewsToolbarControls } from '../../saved_views/toolbar_control';
import { inventoryViewSavedObjectType } from '../../../../common/saved_objects/inventory_view';
import { IIndexPattern } from '../../../../../../../../src/plugins/data/public';
export interface ToolbarProps {
createDerivedIndexPattern: (type: 'logs' | 'metrics' | 'both') => StaticIndexPattern;
createDerivedIndexPattern: (type: 'logs' | 'metrics' | 'both') => IIndexPattern;
changeMetric: (payload: InfraSnapshotMetricInput) => Action<InfraSnapshotMetricInput>;
changeGroupBy: (payload: InfraSnapshotGroupbyInput[]) => Action<InfraSnapshotGroupbyInput[]>;
changeCustomOptions: (payload: InfraGroupByOptions[]) => Action<InfraGroupByOptions[]>;

View file

@ -7,14 +7,13 @@
import { i18n } from '@kbn/i18n';
import React, { useEffect, useState } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { WithKueryAutocompletion } from '../../containers/with_kuery_autocompletion';
import { AutocompleteField } from '../autocomplete_field';
import { isDisplayable } from '../../utils/is_displayable';
import { esKuery } from '../../../../../../../src/plugins/data/public';
import { esKuery, IIndexPattern } from '../../../../../../../src/plugins/data/public';
interface Props {
derivedIndexPattern: StaticIndexPattern;
derivedIndexPattern: IIndexPattern;
onSubmit: (query: string) => void;
value?: string | null;
}

View file

@ -7,7 +7,7 @@
import { EuiFlexGroup, EuiFlexItem, EuiSuperDatePicker, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import {
MetricsExplorerMetric,
MetricsExplorerAggregation,
@ -28,7 +28,7 @@ import { MetricExplorerViewState } from '../../pages/infrastructure/metrics_expl
import { metricsExplorerViewSavedObjectType } from '../../../common/saved_objects/metrics_explorer_view';
interface Props {
derivedIndexPattern: StaticIndexPattern;
derivedIndexPattern: IIndexPattern;
timeRange: MetricsExplorerTimeOptions;
options: MetricsExplorerOptions;
chartOptions: MetricsExplorerChartOptions;

View file

@ -7,7 +7,7 @@
import React from 'react';
import { connect } from 'react-redux';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { logFilterActions, logFilterSelectors, State } from '../../store';
import { FilterQuery } from '../../store/local/log_filter';
import { convertKueryToElasticSearchQuery } from '../../utils/kuery';
@ -16,7 +16,7 @@ import { bindPlainActionCreators } from '../../utils/typed_redux';
import { replaceStateKeyInQueryString, UrlStateContainer } from '../../utils/url_state';
interface WithLogFilterProps {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
export const withLogFilter = connect(

View file

@ -7,7 +7,7 @@
import DateMath from '@elastic/datemath';
import { isEqual } from 'lodash';
import { useEffect, useState } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { SourceQuery } from '../../../common/graphql/types';
import {
MetricsExplorerAggregation,
@ -24,7 +24,7 @@ function isSameOptions(current: MetricsExplorerOptions, next: MetricsExplorerOpt
export function useMetricsExplorerData(
options: MetricsExplorerOptions,
source: SourceQuery.Query['source']['configuration'],
derivedIndexPattern: StaticIndexPattern,
derivedIndexPattern: IIndexPattern,
timerange: MetricsExplorerTimeOptions,
afterKey: string | null,
signal: any

View file

@ -7,7 +7,7 @@
import React from 'react';
import { connect } from 'react-redux';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { State, waffleFilterActions, waffleFilterSelectors } from '../../store';
import { FilterQuery } from '../../store/local/waffle_filter';
import { convertKueryToElasticSearchQuery } from '../../utils/kuery';
@ -16,7 +16,7 @@ import { bindPlainActionCreators } from '../../utils/typed_redux';
import { UrlStateContainer } from '../../utils/url_state';
interface WithWaffleFilterProps {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
export const withWaffleFilter = connect(

View file

@ -5,7 +5,7 @@
*/
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import {
State,
waffleOptionsActions,
@ -56,7 +56,7 @@ const selectViewState = createSelector(
);
interface Props {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
export const withWaffleViewState = connect(

View file

@ -6,9 +6,8 @@
import React from 'react';
import { npStart } from 'ui/new_platform';
import { StaticIndexPattern } from 'ui/index_patterns';
import { AutocompleteSuggestion, IIndexPattern } from 'src/plugins/data/public';
import { RendererFunction } from '../utils/typed_react';
import { AutocompleteSuggestion } from '../../../../../../src/plugins/data/public';
const getAutocompleteProvider = (language: string) =>
npStart.plugins.data.autocomplete.getProvider(language);
@ -19,7 +18,7 @@ interface WithKueryAutocompletionLifecycleProps {
loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void;
suggestions: AutocompleteSuggestion[];
}>;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
interface WithKueryAutocompletionLifecycleState {

View file

@ -6,7 +6,7 @@
import React, { useContext } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { SourceQuery, UpdateSourceInput } from '../../graphql/types';
import { RendererFunction } from '../../utils/typed_react';
import { Source } from '../source';
@ -15,7 +15,7 @@ interface WithSourceProps {
children: RendererFunction<{
configuration?: SourceQuery.Query['source']['configuration'];
create: (sourceProperties: UpdateSourceInput) => Promise<any> | undefined;
createDerivedIndexPattern: (type: 'logs' | 'metrics' | 'both') => StaticIndexPattern;
createDerivedIndexPattern: (type: 'logs' | 'metrics' | 'both') => IIndexPattern;
exists?: boolean;
hasFailed: boolean;
isLoading: boolean;

View file

@ -7,7 +7,7 @@
import { i18n } from '@kbn/i18n';
import React from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { DocumentTitle } from '../../../components/document_title';
import { MetricsExplorerCharts } from '../../../components/metrics_explorer/charts';
import { MetricsExplorerToolbar } from '../../../components/metrics_explorer/toolbar';
@ -19,7 +19,7 @@ import { useTrackPageview } from '../../../hooks/use_track_metric';
interface MetricsExplorerPageProps {
source: SourceQuery.Query['source']['configuration'] | undefined;
derivedIndexPattern: StaticIndexPattern;
derivedIndexPattern: IIndexPattern;
}
export const MetricsExplorerPage = ({ source, derivedIndexPattern }: MetricsExplorerPageProps) => {

View file

@ -5,7 +5,7 @@
*/
import { useState, useCallback, useContext } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import {
MetricsExplorerMetric,
MetricsExplorerAggregation,
@ -27,7 +27,7 @@ export interface MetricExplorerViewState {
export const useMetricsExplorerState = (
source: SourceQuery.Query['source']['configuration'],
derivedIndexPattern: StaticIndexPattern
derivedIndexPattern: IIndexPattern
) => {
const [refreshSignal, setRefreshSignal] = useState(0);
const [afterKey, setAfterKey] = useState<string | null>(null);

View file

@ -4,12 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { StaticIndexPattern } from 'ui/index_patterns';
import { esKuery } from '../../../../../../src/plugins/data/public';
import { esKuery, IIndexPattern } from '../../../../../../src/plugins/data/public';
export const convertKueryToElasticSearchQuery = (
kueryExpression: string,
indexPattern: StaticIndexPattern
indexPattern: IIndexPattern
) => {
try {
return kueryExpression

View file

@ -9,7 +9,7 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { Query, TimeRange, esFilters } from 'src/plugins/data/public';
import { ExpressionRenderer } from 'src/plugins/expressions/public';
import { StaticIndexPattern } from 'src/legacy/core_plugins/data/public';
import { IIndexPattern } from 'src/plugins/data/public';
import { Subscription } from 'rxjs';
import {
Embeddable as AbstractEmbeddable,
@ -24,7 +24,7 @@ export interface LensEmbeddableConfiguration {
savedVis: Document;
editUrl: string;
editable: boolean;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
}
export interface LensEmbeddableInput extends EmbeddableInput {
@ -34,7 +34,7 @@ export interface LensEmbeddableInput extends EmbeddableInput {
}
export interface LensEmbeddableOutput extends EmbeddableOutput {
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
}
export class Embeddable extends AbstractEmbeddable<LensEmbeddableInput, LensEmbeddableOutput> {

View file

@ -6,7 +6,7 @@
import React from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
export type IndexPatternContextValue = StaticIndexPattern | null;
export type IndexPatternContextValue = IIndexPattern | null;
export const IndexPatternContext = React.createContext<IndexPatternContextValue>(null);

View file

@ -8,7 +8,6 @@ import { EuiPanel } from '@elastic/eui';
import { getOr, isEmpty, isEqual } from 'lodash/fp';
import React from 'react';
import styled from 'styled-components';
import { StaticIndexPattern } from 'ui/index_patterns';
import { BrowserFields } from '../../containers/source';
import { TimelineQuery } from '../../containers/timeline';
@ -29,7 +28,12 @@ import { TimelineRefetch } from '../timeline/refetch_timeline';
import { isCompactFooter } from '../timeline/timeline';
import { ManageTimelineContext } from '../timeline/timeline_context';
import * as i18n from './translations';
import { Query, esFilters, esQuery } from '../../../../../../../src/plugins/data/public';
import {
IIndexPattern,
Query,
esFilters,
esQuery,
} from '../../../../../../../src/plugins/data/public';
const DEFAULT_EVENTS_VIEWER_HEIGHT = 500;
@ -46,7 +50,7 @@ interface Props {
filters: esFilters.Filter[];
height?: number;
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isLive: boolean;
itemsPerPage: number;
itemsPerPageOptions: number[];

View file

@ -7,7 +7,7 @@
import React, { useMemo, useCallback } from 'react';
import { connect } from 'react-redux';
import { ActionCreator } from 'typescript-fsa';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { hostsActions } from '../../../../store/actions';
import {
Direction,
@ -37,7 +37,7 @@ interface OwnProps {
data: HostsEdges[];
fakeTotalCount: number;
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isInspect: boolean;
loading: boolean;
loadPage: (newActivePage: number) => void;

View file

@ -7,7 +7,7 @@
import { get } from 'lodash/fp';
import numeral from '@elastic/numeral';
import React from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { CountryFlagAndName } from '../../../source_destination/country_flag';
import {
@ -43,7 +43,7 @@ export type NetworkTopCountriesColumnsIpDetails = [
];
export const getNetworkTopCountriesColumns = (
indexPattern: StaticIndexPattern,
indexPattern: IIndexPattern,
flowTarget: FlowTargetSourceDest,
type: networkModel.NetworkType,
tableId: string
@ -157,7 +157,7 @@ export const getNetworkTopCountriesColumns = (
];
export const getCountriesColumnsCurated = (
indexPattern: StaticIndexPattern,
indexPattern: IIndexPattern,
flowTarget: FlowTargetSourceDest,
type: networkModel.NetworkType,
tableId: string

View file

@ -9,7 +9,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { ActionCreator } from 'typescript-fsa';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { networkActions } from '../../../../store/actions';
import {
@ -30,7 +30,7 @@ interface OwnProps {
fakeTotalCount: number;
flowTargeted: FlowTargetSourceDest;
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isInspect: boolean;
loading: boolean;
loadPage: (newActivePage: number) => void;

View file

@ -7,7 +7,7 @@
import { get } from 'lodash/fp';
import numeral from '@elastic/numeral';
import React from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { CountryFlag } from '../../../source_destination/country_flag';
import {
@ -48,7 +48,7 @@ export type NetworkTopNFlowColumnsIpDetails = [
];
export const getNetworkTopNFlowColumns = (
indexPattern: StaticIndexPattern,
indexPattern: IIndexPattern,
flowTarget: FlowTargetSourceDest,
type: networkModel.NetworkType,
tableId: string
@ -233,7 +233,7 @@ export const getNetworkTopNFlowColumns = (
];
export const getNFlowColumnsCurated = (
indexPattern: StaticIndexPattern,
indexPattern: IIndexPattern,
flowTarget: FlowTargetSourceDest,
type: networkModel.NetworkType,
tableId: string

View file

@ -8,7 +8,7 @@ import React, { useCallback } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { ActionCreator } from 'typescript-fsa';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { networkActions } from '../../../../store/actions';
import {
@ -29,7 +29,7 @@ interface OwnProps {
fakeTotalCount: number;
flowTargeted: FlowTargetSourceDest;
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isInspect: boolean;
loading: boolean;
loadPage: (newActivePage: number) => void;

View file

@ -6,11 +6,12 @@
import { isEqual } from 'lodash/fp';
import React, { memo, useState, useEffect, useMemo, useCallback } from 'react';
import { StaticIndexPattern, IndexPattern } from 'ui/index_patterns';
import { IndexPattern } from 'ui/index_patterns';
import { SavedQuery, SearchBar } from '../../../../../../../src/legacy/core_plugins/data/public';
import {
esFilters,
IIndexPattern,
FilterManager,
Query,
TimeHistory,
@ -24,7 +25,7 @@ export interface QueryBarComponentProps {
dateRangeFrom?: string;
dateRangeTo?: string;
hideSavedQuery?: boolean;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isLoading?: boolean;
isRefreshPaused?: boolean;
filterQuery: Query;

View file

@ -10,7 +10,8 @@ import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { Subscription } from 'rxjs';
import styled from 'styled-components';
import { StaticIndexPattern, IndexPattern } from 'ui/index_patterns';
import { IndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { SavedQuery } from 'src/legacy/core_plugins/data/public';
import { OnTimeChangeProps } from '@elastic/eui';
@ -68,7 +69,7 @@ interface SiemSearchBarDispatch {
interface SiemSearchBarProps {
id: InputsModelId;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
timelineId?: string;
dataTestSubj?: string;
}

View file

@ -7,7 +7,7 @@
import { memo, useEffect } from 'react';
import { connect } from 'react-redux';
import { ActionCreator } from 'typescript-fsa';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { inputsModel, KueryFilterQuery, timelineSelectors, State } from '../../store';
import { inputsActions } from '../../store/actions';
@ -31,7 +31,7 @@ interface TimelineKqlFetchDispatch {
export interface TimelineKqlFetchProps {
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
inputId: InputsModelId;
}

View file

@ -7,7 +7,7 @@
import { EuiCallOut } from '@elastic/eui';
import * as React from 'react';
import styled from 'styled-components';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { Sort } from '../body/sort';
import { DataProviders } from '../data_providers';
@ -29,7 +29,7 @@ interface Props {
browserFields: BrowserFields;
dataProviders: DataProvider[];
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
onChangeDataProviderKqlQuery: OnChangeDataProviderKqlQuery;
onChangeDroppableAndProvider: OnChangeDroppableAndProvider;
onDataProviderEdited: OnDataProviderEdited;

View file

@ -6,13 +6,17 @@
import { isEmpty, isNumber, get } from 'lodash/fp';
import memoizeOne from 'memoize-one';
import { StaticIndexPattern } from 'ui/index_patterns';
import { escapeQueryValue, convertToBuildEsQuery } from '../../lib/keury';
import { DataProvider, DataProvidersAnd, EXISTS_OPERATOR } from './data_providers/data_provider';
import { BrowserFields } from '../../containers/source';
import { Query, esQuery, esFilters } from '../../../../../../../src/plugins/data/public';
import {
IIndexPattern,
Query,
esQuery,
esFilters,
} from '../../../../../../../src/plugins/data/public';
const convertDateFieldToQuery = (field: string, value: string | number) =>
`${field}: ${isNumber(value) ? value : new Date(value).valueOf()}`;
@ -103,7 +107,7 @@ export const combineQueries = ({
}: {
config: esQuery.EsQueryConfig;
dataProviders: DataProvider[];
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
browserFields: BrowserFields;
filters: esFilters.Filter[];
kqlQuery: Query;

View file

@ -6,10 +6,10 @@
import { isEqual, isEmpty } from 'lodash/fp';
import React, { memo, useCallback, useState, useEffect } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { Subscription } from 'rxjs';
import {
IIndexPattern,
Query,
esFilters,
FilterManager,
@ -38,7 +38,7 @@ export interface QueryBarTimelineComponentProps {
from: number;
fromStr: string;
kqlMode: KqlMode;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isRefreshPaused: boolean;
refreshInterval: number;
savedQueryId: string | null;

View file

@ -8,9 +8,8 @@ import { getOr, isEqual } from 'lodash/fp';
import React, { useCallback } from 'react';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { StaticIndexPattern } from 'ui/index_patterns';
import { esFilters } from '../../../../../../../../src/plugins/data/public';
import { esFilters, IIndexPattern } from '../../../../../../../../src/plugins/data/public';
import { BrowserFields } from '../../../containers/source';
import { convertKueryToElasticSearchQuery } from '../../../lib/keury';
import {
@ -29,7 +28,7 @@ import { SearchOrFilter } from './search_or_filter';
interface OwnProps {
browserFields: BrowserFields;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
timelineId: string;
}

View file

@ -8,9 +8,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiSuperSelect, EuiToolTip } from '@elastic/
import * as React from 'react';
import { pure } from 'recompose';
import styled, { createGlobalStyle } from 'styled-components';
import { StaticIndexPattern } from 'ui/index_patterns';
import { esFilters } from '../../../../../../../../src/plugins/data/public';
import { esFilters, IIndexPattern } from '../../../../../../../../src/plugins/data/public';
import { BrowserFields } from '../../../containers/source';
import { KueryFilterQuery, KueryFilterQueryKind } from '../../../store';
import { KqlMode } from '../../../store/timeline/model';
@ -48,7 +47,7 @@ interface Props {
filterQueryDraft: KueryFilterQuery;
from: number;
fromStr: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isRefreshPaused: boolean;
kqlMode: KqlMode;
timelineId: string;

View file

@ -8,7 +8,6 @@ import { EuiFlexGroup } from '@elastic/eui';
import { getOr, isEmpty } from 'lodash/fp';
import * as React from 'react';
import styled from 'styled-components';
import { StaticIndexPattern } from 'ui/index_patterns';
import { BrowserFields } from '../../containers/source';
import { TimelineQuery } from '../../containers/timeline';
@ -36,7 +35,7 @@ import { TimelineHeader } from './header';
import { calculateBodyHeight, combineQueries } from './helpers';
import { TimelineRefetch } from './refetch_timeline';
import { ManageTimelineContext } from './timeline_context';
import { esQuery, esFilters } from '../../../../../../../src/plugins/data/public';
import { esQuery, esFilters, IIndexPattern } from '../../../../../../../src/plugins/data/public';
const WrappedByAutoSizer = styled.div`
width: 100%;
@ -65,7 +64,7 @@ interface Props {
flyoutHeaderHeight: number;
flyoutHeight: number;
id: string;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
isLive: boolean;
itemsPerPage: number;
itemsPerPageOptions: number[];

View file

@ -6,8 +6,7 @@
import ApolloClient from 'apollo-client';
import { ActionCreator } from 'typescript-fsa';
import { StaticIndexPattern } from 'ui/index_patterns';
import { Query, esFilters } from 'src/plugins/data/public';
import { IIndexPattern, Query, esFilters } from 'src/plugins/data/public';
import { UrlInputsModel } from '../../store/inputs/model';
import { RouteSpyState } from '../../utils/route/types';
@ -70,7 +69,7 @@ export type KeyUrlState = keyof UrlState;
export interface UrlStateProps {
navTabs: Record<string, NavTab>;
indexPattern?: StaticIndexPattern;
indexPattern?: IIndexPattern;
mapToUrlState?: (value: string) => UrlState;
onChange?: (urlState: UrlState, previousUrlState: UrlState) => void;
onInitialize?: (urlState: UrlState) => void;
@ -109,7 +108,7 @@ export interface UrlStateToRedux {
export interface SetInitialStateFromUrl<TCache> {
apolloClient: ApolloClient<TCache> | ApolloClient<{}> | undefined;
detailName: string | undefined;
indexPattern: StaticIndexPattern | undefined;
indexPattern: IIndexPattern | undefined;
pageName: string;
updateTimeline: DispatchUpdateTimeline;
updateTimelineIsLoading: ActionCreator<UpdateTimelineIsLoading>;

View file

@ -6,7 +6,7 @@
import { isEmpty, get } from 'lodash/fp';
import { useEffect, useState, Dispatch, SetStateAction } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { getIndexFields, sourceQuery } from '../../../containers/source';
import { useStateToaster } from '../../../components/toasters';
@ -20,7 +20,7 @@ interface FetchIndexPattern {
isLoading: boolean;
indices: string[];
indicesExists: boolean;
indexPatterns: StaticIndexPattern | null;
indexPatterns: IIndexPattern | null;
}
type Return = [FetchIndexPattern, Dispatch<SetStateAction<string[]>>];
@ -29,7 +29,7 @@ export const useFetchIndexPatterns = (): Return => {
const apolloClient = useApolloClient();
const [indices, setIndices] = useState<string[]>([]);
const [indicesExists, setIndicesExists] = useState(false);
const [indexPatterns, setIndexPatterns] = useState<StaticIndexPattern | null>(null);
const [indexPatterns, setIndexPatterns] = useState<IIndexPattern | null>(null);
const [isLoading, setIsLoading] = useState(false);
const [, dispatchToaster] = useStateToaster();

View file

@ -5,8 +5,10 @@
*/
import React, { useState } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { AutocompleteSuggestion } from '../../../../../../../src/plugins/data/public';
import {
AutocompleteSuggestion,
IIndexPattern,
} from '../../../../../../../src/plugins/data/public';
import { useKibanaPlugins } from '../../lib/compose/kibana_plugins';
type RendererResult = React.ReactElement<JSX.Element> | null;
@ -18,7 +20,7 @@ interface KueryAutocompletionLifecycleProps {
loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void;
suggestions: AutocompleteSuggestion[];
}>;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
interface KueryAutocompletionCurrentRequest {

View file

@ -9,7 +9,7 @@ import { get, keyBy, pick, set } from 'lodash/fp';
import { Query } from 'react-apollo';
import React, { useEffect, useState } from 'react';
import memoizeOne from 'memoize-one';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import chrome from 'ui/chrome';
import { DEFAULT_INDEX_KEY } from '../../../common/constants';
@ -52,7 +52,7 @@ export const getAllFieldsByName = (
interface WithSourceArgs {
indicesExist: boolean;
browserFields: BrowserFields;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
interface WithSourceProps {
@ -61,7 +61,7 @@ interface WithSourceProps {
}
export const getIndexFields = memoizeOne(
(title: string, fields: IndexField[]): StaticIndexPattern =>
(title: string, fields: IndexField[]): IIndexPattern =>
fields && fields.length > 0
? {
fields: fields.map(field => pick(['name', 'searchable', 'type', 'aggregatable'], field)),
@ -118,7 +118,7 @@ export const useWithSource = (sourceId: string, indices: string[]) => {
const [loading, updateLoading] = useState(false);
const [indicesExist, setIndicesExist] = useState<boolean | undefined | null>(undefined);
const [browserFields, setBrowserFields] = useState<BrowserFields | null>(null);
const [indexPattern, setIndexPattern] = useState<StaticIndexPattern | null>(null);
const [indexPattern, setIndexPattern] = useState<IIndexPattern | null>(null);
const [errorMessage, updateErrorMessage] = useState<string | null>(null);
const apolloClient = useApolloClient();

View file

@ -7,12 +7,12 @@
import { EuiFormRow } from '@elastic/eui';
import { isEqual } from 'lodash/fp';
import React, { useCallback, useEffect, useState } from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { Subscription } from 'rxjs';
import styled from 'styled-components';
import {
esFilters,
IIndexPattern,
Query,
FilterManager,
SavedQuery,
@ -35,7 +35,7 @@ interface QueryBarDefineRuleProps {
field: FieldHook;
idAria: string;
isLoading: boolean;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}
const StyledEuiFormRow = styled(EuiFormRow)`

View file

@ -6,7 +6,7 @@
import { mount } from 'enzyme';
import React from 'react';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { MemoryRouter } from 'react-router-dom';
import { mockIndexPattern } from '../../../mock/index_pattern';
@ -31,10 +31,7 @@ jest.mock('../../../containers/source', () => ({
WithSource: ({
children,
}: {
children: (args: {
indicesExist: boolean;
indexPattern: StaticIndexPattern;
}) => React.ReactNode;
children: (args: { indicesExist: boolean; indexPattern: IIndexPattern }) => React.ReactNode;
}) => children({ indicesExist: true, indexPattern: mockIndexPattern }),
}));

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { StaticIndexPattern } from 'ui/index_patterns';
import { ActionCreator } from 'typescript-fsa';
import { Query, esFilters } from 'src/plugins/data/public';
import { Query, IIndexPattern, esFilters } from 'src/plugins/data/public';
import { InputsModelId } from '../../../store/inputs/constants';
import { HostComponentProps } from '../../../components/link_to/redirect_to_hosts';
@ -60,7 +59,7 @@ export type HostDetailsNavTab = Record<KeyHostDetailsNavTab, NavTab>;
export type HostDetailsTabsProps = HostBodyComponentDispatchProps &
HostsQueryProps & {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
type: hostsModel.HostsType;
filterQuery: string;
};

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { NarrowDateRange } from '../../../components/ml/types';
import { hostsModel } from '../../../store';
import { ESTermQuery } from '../../../../common/typed_json';
@ -46,7 +46,7 @@ interface QueryTabBodyProps {
export type HostsComponentsQueryProps = QueryTabBodyProps & {
deleteQuery?: ({ id }: { id: string }) => void;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
skip: boolean;
setQuery: SetQuery;
updateDateRange?: UpdateDateRange;

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { StaticIndexPattern } from 'ui/index_patterns';
import { ActionCreator } from 'typescript-fsa';
import { Query, esFilters } from 'src/plugins/data/public';
import { IIndexPattern, Query, esFilters } from 'src/plugins/data/public';
import { SiemPageName } from '../home/types';
import { hostsModel } from '../../store';
@ -34,7 +33,7 @@ export type HostsTabsProps = HostsComponentDispatchProps &
HostsQueryProps & {
filterQuery: string;
type: hostsModel.HostsType;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
};
export type HostsQueryProps = GlobalTimeArgs;

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { StaticIndexPattern } from 'ui/index_patterns';
import { ActionCreator } from 'typescript-fsa';
import { Query, esFilters } from 'src/plugins/data/public';
import { IIndexPattern, Query, esFilters } from 'src/plugins/data/public';
import { NetworkType } from '../../../store/network/model';
import { ESTermQuery } from '../../../../common/typed_json';
@ -68,5 +67,5 @@ export type TlsQueryTableComponentProps = OwnProps & {
export type NetworkWithIndexComponentsQueryTableProps = OwnProps & {
flowTarget: FlowTargetSourceDest;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
};

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { NavTab } from '../../../components/navigation/types';
import { FlowTargetSourceDest } from '../../../graphql/types';
@ -29,7 +29,7 @@ interface QueryTabBodyProps extends Pick<GlobalTimeArgs, 'setQuery' | 'deleteQue
export type NetworkComponentQueryProps = QueryTabBodyProps;
export type IPsQueryTabBodyProps = QueryTabBodyProps & {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
flowTarget: FlowTargetSourceDest;
};
@ -46,7 +46,7 @@ export type NetworkRoutesProps = GlobalTimeArgs & {
networkPagePath: string;
type: networkModel.NetworkType;
filterQuery?: string | ESTermQuery;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
setAbsoluteRangeDatePicker: SetAbsoluteRangeDatePicker;
};

View file

@ -6,7 +6,7 @@
import { isEqual } from 'lodash/fp';
import { Dispatch } from 'redux';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { KueryFilterQuery } from '../../store';
import { applyKqlFilterQuery as dispatchApplyTimelineFilterQuery } from '../../store/timeline/actions';
@ -14,7 +14,7 @@ import { convertKueryToElasticSearchQuery } from '../../lib/keury';
import { RefetchKql } from '../../store/inputs/model';
interface UseUpdateKqlProps {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
kueryFilterQuery: KueryFilterQuery | null;
kueryFilterQueryDraft: KueryFilterQuery | null;
storeType: 'timelineType';

View file

@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react';
import { SearchResponse } from 'elasticsearch';
import { StaticIndexPattern } from 'ui/index_patterns';
import { IIndexPattern } from 'src/plugins/data/public';
import { useApi } from '../../../../hooks/use_api';
import { getNestedProperty } from '../../../../../../common/utils/object_utils';
@ -56,7 +56,7 @@ export interface UseSourceIndexDataReturnType {
}
export const useSourceIndexData = (
indexPattern: StaticIndexPattern,
indexPattern: IIndexPattern,
query: PivotQuery,
selectedFields: EsFieldName[],
setSelectedFields: React.Dispatch<React.SetStateAction<EsFieldName[]>>