Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace StaticIndexPattern with IIndexPattern from NP #51872

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 } 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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
Loading