Skip to content

Commit

Permalink
[7.x] Replace StaticIndexPattern with IIndexPattern from NP (#51872) (#…
Browse files Browse the repository at this point in the history
…52030)

* Replace StaticIndexPattern with IIndexPattern from NP (#51872)

* replace SIP with IIP

* import path

* fix backport merge

* import removed
  • Loading branch information
Liza Katz authored Dec 3, 2019
1 parent fbb0ad7 commit 542b94a
Show file tree
Hide file tree
Showing 56 changed files with 133 additions and 139 deletions.
1 change: 0 additions & 1 deletion src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export {
FieldListInterface,
IndexPattern,
IndexPatterns,
StaticIndexPattern,
} from './index_patterns';
export { QueryStringInput } from './query';
export { SearchBar, SearchBarProps } from './search';
Expand Down
3 changes: 1 addition & 2 deletions src/legacy/core_plugins/data/public/index_patterns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
* 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;
const flattenHitWrapper = indexPatterns.flattenHitWrapper;

export { getFromSavedObject, getRoutes, flattenHitWrapper };
export { IFieldType as FieldType };
export { IIndexPattern as StaticIndexPattern };
export {
Field,
FieldListInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import { StaticIndexPattern } from 'plugins/data';
import moment from 'moment';
import { Subscription } from 'rxjs';

Expand All @@ -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';
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +33,7 @@ export interface SearchInput extends EmbeddableInput {

export interface SearchOutput extends EmbeddableOutput {
editUrl: string;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
editable: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface VisSavedObject extends SavedObject {

export interface VisualizeEmbeddableConfiguration {
savedVisualization: VisSavedObject;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
editUrl: string;
editable: boolean;
appState?: AppState;
Expand All @@ -81,7 +81,7 @@ export interface VisualizeInput extends EmbeddableInput {

export interface VisualizeOutput extends EmbeddableOutput {
editUrl: string;
indexPatterns?: StaticIndexPattern[];
indexPatterns?: IIndexPattern[];
savedObjectId: string;
visTypeName: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 0 additions & 1 deletion src/legacy/ui/public/index_patterns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export {
FieldListInterface,
IndexPattern,
IndexPatterns,
StaticIndexPattern,
} from '../../../core_plugins/data/public';

export { FieldList } from '../../../../plugins/data/public';
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

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

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

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

const indexPattern: StaticIndexPattern = {
const indexPattern: IIndexPattern = {
fields,
title: indexPatternTitle
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
*/

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,
uiFilters,
projection,
localFilterNames
}: {
indexPattern: StaticIndexPattern | undefined;
indexPattern: IIndexPattern | undefined;
uiFilters: UIFilters;
projection: Projection;
localFilterNames: LocalUIFilterName[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -56,7 +56,7 @@ const selectViewState = createSelector(
);

interface Props {
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}

export const withWaffleViewState = connect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -19,7 +18,7 @@ interface WithKueryAutocompletionLifecycleProps {
loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void;
suggestions: AutocompleteSuggestion[];
}>;
indexPattern: StaticIndexPattern;
indexPattern: IIndexPattern;
}

interface WithKueryAutocompletionLifecycleState {
Expand Down
Loading

0 comments on commit 542b94a

Please sign in to comment.