From 06bef094278473882da26a2bf4b8d8b7cd735daf Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Mon, 2 Dec 2019 12:39:43 +0200 Subject: [PATCH] Replace StaticIndexPattern with IIndexPattern from NP (#51872) * replace SIP with IIP * import path --- src/legacy/core_plugins/data/public/index.ts | 1 - .../kibana/public/dashboard/dashboard_app.tsx | 11 ++++++++--- .../discover/angular/doc_table/lib/get_sort.d.ts | 4 ++-- .../kibana/public/discover/embeddable/types.ts | 5 ++--- .../kibana/public/discover/kibana_services.ts | 2 +- .../public/visualize/embeddable/get_index_pattern.ts | 11 ++++------- .../visualize/embeddable/visualize_embeddable.ts | 6 +++--- .../kibana/public/visualize/kibana_services.ts | 1 - src/legacy/ui/public/index_patterns/index.ts | 1 - .../public/index_patterns/index_patterns_service.ts | 2 +- .../local_ui_filters/get_filter_aggregations.ts | 4 ++-- .../public/components/inventory/toolbars/toolbar.tsx | 4 ++-- .../public/components/metrics_explorer/kuery_bar.tsx | 5 ++--- .../public/components/metrics_explorer/toolbar.tsx | 4 ++-- .../infra/public/containers/logs/with_log_filter.tsx | 4 ++-- .../metrics_explorer/use_metrics_explorer_data.ts | 4 ++-- .../public/containers/waffle/with_waffle_filters.tsx | 4 ++-- .../containers/waffle/with_waffle_view_state.tsx | 4 ++-- .../public/containers/with_kuery_autocompletion.tsx | 5 ++--- .../public/containers/with_source/with_source.tsx | 4 ++-- .../pages/infrastructure/metrics_explorer/index.tsx | 4 ++-- .../metrics_explorer/use_metric_explorer_state.ts | 4 ++-- x-pack/legacy/plugins/infra/public/utils/kuery.ts | 5 ++--- .../editor_frame_plugin/embeddable/embeddable.tsx | 6 +++--- .../jobs/new_job/common/index_pattern_context.ts | 4 ++-- .../public/components/events_viewer/events_viewer.tsx | 10 +++++++--- .../components/page/hosts/hosts_table/index.tsx | 4 ++-- .../network/network_top_countries_table/columns.tsx | 6 +++--- .../network/network_top_countries_table/index.tsx | 4 ++-- .../page/network/network_top_n_flow_table/columns.tsx | 6 +++--- .../page/network/network_top_n_flow_table/index.tsx | 4 ++-- .../siem/public/components/query_bar/index.tsx | 5 +++-- .../siem/public/components/search_bar/index.tsx | 5 +++-- .../public/components/timeline/fetch_kql_timeline.tsx | 4 ++-- .../siem/public/components/timeline/header/index.tsx | 4 ++-- .../siem/public/components/timeline/helpers.tsx | 10 +++++++--- .../public/components/timeline/query_bar/index.tsx | 4 ++-- .../components/timeline/search_or_filter/index.tsx | 5 ++--- .../timeline/search_or_filter/search_or_filter.tsx | 5 ++--- .../siem/public/components/timeline/timeline.tsx | 5 ++--- .../plugins/siem/public/components/url_state/types.ts | 7 +++---- .../detection_engine/rules/fetch_index_patterns.tsx | 6 +++--- .../public/containers/kuery_autocompletion/index.tsx | 8 +++++--- .../plugins/siem/public/containers/source/index.tsx | 8 ++++---- .../create_rule/components/query_bar/index.tsx | 4 ++-- .../public/pages/hosts/details/details_tabs.test.tsx | 7 ++----- .../plugins/siem/public/pages/hosts/details/types.ts | 5 ++--- .../siem/public/pages/hosts/navigation/types.ts | 4 ++-- .../legacy/plugins/siem/public/pages/hosts/types.ts | 5 ++--- .../siem/public/pages/network/ip_details/types.ts | 5 ++--- .../siem/public/pages/network/navigation/types.ts | 6 +++--- .../plugins/siem/public/utils/kql/use_update_kql.tsx | 4 ++-- .../source_index_preview/use_source_index_data.ts | 4 ++-- 53 files changed, 130 insertions(+), 133 deletions(-) diff --git a/src/legacy/core_plugins/data/public/index.ts b/src/legacy/core_plugins/data/public/index.ts index bdfedbc2c81a8..4cefff8a6e2fc 100644 --- a/src/legacy/core_plugins/data/public/index.ts +++ b/src/legacy/core_plugins/data/public/index.ts @@ -35,7 +35,6 @@ export { FieldListInterface, IndexPattern, IndexPatterns, - StaticIndexPattern, } from './index_patterns'; export { QueryStringInput } from './query'; export { SearchBar, SearchBarProps } from './search'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx index 26b86204b03db..dcedb2a166fcc 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx @@ -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; diff --git a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/lib/get_sort.d.ts b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/lib/get_sort.d.ts index bb32da0d11fc0..ebf715a64d939 100644 --- a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/lib/get_sort.d.ts +++ b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/lib/get_sort.d.ts @@ -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; diff --git a/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts b/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts index 2d940ad8cba98..adfa3d5acbf7a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts +++ b/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts @@ -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; } diff --git a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts b/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts index 393399f7da345..497427136f415 100644 --- a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts +++ b/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts @@ -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'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/get_index_pattern.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/get_index_pattern.ts index b6d5adcd98bd0..9bc9ab99c4aff 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/get_index_pattern.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/get_index_pattern.ts @@ -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 { +): Promise { if (savedVis.vis.type.name !== 'metrics') { return savedVis.vis.indexPattern; } diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts index a2b46dab1ef33..13d33c9eb99ec 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts @@ -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; } diff --git a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts b/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts index 61b1cde0dcaf9..612f0ba0f077b 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts @@ -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'; diff --git a/src/legacy/ui/public/index_patterns/index.ts b/src/legacy/ui/public/index_patterns/index.ts index 200276c1727fc..237f3137bc9f4 100644 --- a/src/legacy/ui/public/index_patterns/index.ts +++ b/src/legacy/ui/public/index_patterns/index.ts @@ -44,7 +44,6 @@ export { FieldListInterface, IndexPattern, IndexPatterns, - StaticIndexPattern, } from '../../../core_plugins/data/public'; export { FieldList } from '../../../../plugins/data/public'; diff --git a/src/plugins/data/public/index_patterns/index_patterns_service.ts b/src/plugins/data/public/index_patterns/index_patterns_service.ts index 40f833868847b..43ba5082ec479 100644 --- a/src/plugins/data/public/index_patterns/index_patterns_service.ts +++ b/src/plugins/data/public/index_patterns/index_patterns_service.ts @@ -27,7 +27,7 @@ import { FieldFormatsStart } from '../field_formats_provider'; import { setNotifications, setFieldFormats } from './services'; import { IndexPatterns } from './index_patterns'; -interface IndexPatternDependencies { +export interface IndexPatternDependencies { uiSettings: IUiSettingsClient; savedObjectsClient: SavedObjectsClientContract; http: HttpServiceBase; diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_filter_aggregations.ts b/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_filter_aggregations.ts index 0bf89414e2894..859b6f1f19c22 100644 --- a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_filter_aggregations.ts +++ b/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_filter_aggregations.ts @@ -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[]; diff --git a/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx b/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx index 167a328135bf7..7cf9b1c292409 100644 --- a/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx +++ b/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx @@ -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; changeGroupBy: (payload: InfraSnapshotGroupbyInput[]) => Action; changeCustomOptions: (payload: InfraGroupByOptions[]) => Action; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx index a851f8380b915..f1957c1fa91a7 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx +++ b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx @@ -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; } diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx index 1b7a9c6953bf1..d2a6cec36f6df 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx +++ b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx @@ -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; diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/with_log_filter.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/with_log_filter.tsx index e06e83f08680c..60261fc728ebb 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/with_log_filter.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/with_log_filter.tsx @@ -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( diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts b/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts index f514c1a7e0524..1418d6aef67ac 100644 --- a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts +++ b/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts @@ -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 diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_filters.tsx b/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_filters.tsx index 379b73f48158a..0214237ef52d8 100644 --- a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_filters.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_filters.tsx @@ -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( diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx b/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx index 86beb28a7f3ca..4e8a051bf8697 100644 --- a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx @@ -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( diff --git a/x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx b/x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx index 8f2ed458cc118..ba072b754b957 100644 --- a/x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx @@ -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 { diff --git a/x-pack/legacy/plugins/infra/public/containers/with_source/with_source.tsx b/x-pack/legacy/plugins/infra/public/containers/with_source/with_source.tsx index 0512888ecd4ea..e8c609ae0bad9 100644 --- a/x-pack/legacy/plugins/infra/public/containers/with_source/with_source.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/with_source/with_source.tsx @@ -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 | undefined; - createDerivedIndexPattern: (type: 'logs' | 'metrics' | 'both') => StaticIndexPattern; + createDerivedIndexPattern: (type: 'logs' | 'metrics' | 'both') => IIndexPattern; exists?: boolean; hasFailed: boolean; isLoading: boolean; diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx b/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx index 7a9a705a78887..63f5a81967618 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx @@ -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) => { diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts b/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts index 605a907e077f7..415a6ae89a8b1 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts +++ b/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts @@ -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(null); diff --git a/x-pack/legacy/plugins/infra/public/utils/kuery.ts b/x-pack/legacy/plugins/infra/public/utils/kuery.ts index 2e793d53b4622..2292bf272b388 100644 --- a/x-pack/legacy/plugins/infra/public/utils/kuery.ts +++ b/x-pack/legacy/plugins/infra/public/utils/kuery.ts @@ -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 diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.tsx index 5e87182bba32b..6fcf2bab8921f 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.tsx @@ -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 { diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index_pattern_context.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index_pattern_context.ts index aa92536da8d1d..271513ea4b406 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index_pattern_context.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index_pattern_context.ts @@ -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(null); diff --git a/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx b/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx index c868b7950289a..ee7853d092784 100644 --- a/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx +++ b/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx @@ -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[]; diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx index 502fa0583536a..62788abec1487 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/columns.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/columns.tsx index abb57c7d7f55e..ae2723e006509 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/columns.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/columns.tsx @@ -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 diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx index 15c48ddf32cd6..81a48ca162e15 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/columns.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/columns.tsx index abb4d9ac29f1b..d9de8091805f6 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/columns.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/columns.tsx @@ -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 diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx index b37a3dce808bd..12b87a517b4f7 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx b/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx index 591fe6a73359d..bf440e238c2a3 100644 --- a/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx b/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx index 710c1e230faba..fa9ff1e16ddb7 100644 --- a/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx @@ -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; } diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx index 35d4cd93c372d..4b1e723f1bb3a 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx @@ -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; } diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx index fb00c9aa74846..814d25d9c718d 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx index 6a880df27b29c..0f228a4d3df10 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/query_bar/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/query_bar/index.tsx index a49ec1b758367..c55ead5e2d5d5 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/query_bar/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/query_bar/index.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx index 4af6178a7223b..31d2b7a2d85f2 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx @@ -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; } diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx index eaa476bf3e2b2..373d9a50d245b 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx index fe100e47a8afb..ec7d10d2373d4 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx @@ -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[]; diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/types.ts b/x-pack/legacy/plugins/siem/public/components/url_state/types.ts index 13618125325e1..4eb6398cc7773 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/types.ts +++ b/x-pack/legacy/plugins/siem/public/components/url_state/types.ts @@ -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; - 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 { apolloClient: ApolloClient | ApolloClient<{}> | undefined; detailName: string | undefined; - indexPattern: StaticIndexPattern | undefined; + indexPattern: IIndexPattern | undefined; pageName: string; updateTimeline: DispatchUpdateTimeline; updateTimelineIsLoading: ActionCreator; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx index dbc148a96365d..8cbda9cd5afe9 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx @@ -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>]; @@ -29,7 +29,7 @@ export const useFetchIndexPatterns = (): Return => { const apolloClient = useApolloClient(); const [indices, setIndices] = useState([]); const [indicesExists, setIndicesExists] = useState(false); - const [indexPatterns, setIndexPatterns] = useState(null); + const [indexPatterns, setIndexPatterns] = useState(null); const [isLoading, setIsLoading] = useState(false); const [, dispatchToaster] = useStateToaster(); diff --git a/x-pack/legacy/plugins/siem/public/containers/kuery_autocompletion/index.tsx b/x-pack/legacy/plugins/siem/public/containers/kuery_autocompletion/index.tsx index dac531365c870..d06f4f6fbbbfa 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kuery_autocompletion/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/kuery_autocompletion/index.tsx @@ -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 | null; @@ -18,7 +20,7 @@ interface KueryAutocompletionLifecycleProps { loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void; suggestions: AutocompleteSuggestion[]; }>; - indexPattern: StaticIndexPattern; + indexPattern: IIndexPattern; } interface KueryAutocompletionCurrentRequest { diff --git a/x-pack/legacy/plugins/siem/public/containers/source/index.tsx b/x-pack/legacy/plugins/siem/public/containers/source/index.tsx index bc7b87cda6af9..653d5543c0923 100644 --- a/x-pack/legacy/plugins/siem/public/containers/source/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/source/index.tsx @@ -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(undefined); const [browserFields, setBrowserFields] = useState(null); - const [indexPattern, setIndexPattern] = useState(null); + const [indexPattern, setIndexPattern] = useState(null); const [errorMessage, updateErrorMessage] = useState(null); const apolloClient = useApolloClient(); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx index e3180c150b239..92b2f557d4cec 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx @@ -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)` diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx index f136ff72c906d..a9a0693a25447 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx @@ -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 }), })); diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/types.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/details/types.ts index 4f3d34f51fb93..091f0173635af 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/types.ts @@ -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; export type HostDetailsTabsProps = HostBodyComponentDispatchProps & HostsQueryProps & { - indexPattern: StaticIndexPattern; + indexPattern: IIndexPattern; type: hostsModel.HostsType; filterQuery: string; }; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts index 98d931dd7e275..cfe7953f16cee 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts index afc577244f7e0..2121a3840926a 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts @@ -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; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/types.ts b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/types.ts index e0029d8d219eb..d29f58e90360e 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/types.ts @@ -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; }; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts b/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts index bc63e26f71eba..b8ad8877bf3c1 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts @@ -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>