[Logs UI][Metrics UI] Replace usage of deprecated IndexPattern types (#114448)
* [Logs UI][Metrics UI] Replace usage of deprecated IndexPattern types (#107887)
This commit is contained in:
parent
ab5ecc4e13
commit
8ea719ca8a
|
@ -7,17 +7,11 @@
|
|||
|
||||
import { from, of } from 'rxjs';
|
||||
import { delay } from 'rxjs/operators';
|
||||
import {
|
||||
fieldList,
|
||||
FieldSpec,
|
||||
IIndexPattern,
|
||||
IndexPattern,
|
||||
IndexPatternsContract,
|
||||
RuntimeField,
|
||||
} from 'src/plugins/data/common';
|
||||
import { DataView, DataViewsContract } from '../../../../../src/plugins/data_views/common';
|
||||
import { fieldList, FieldSpec, RuntimeField } from '../../../../../src/plugins/data/common';
|
||||
|
||||
type IndexPatternMock = Pick<
|
||||
IndexPattern,
|
||||
DataView,
|
||||
| 'fields'
|
||||
| 'getComputedFields'
|
||||
| 'getFieldByName'
|
||||
|
@ -27,7 +21,7 @@ type IndexPatternMock = Pick<
|
|||
| 'title'
|
||||
| 'type'
|
||||
>;
|
||||
type IndexPatternMockSpec = Pick<IIndexPattern, 'id' | 'title' | 'type' | 'timeFieldName'> & {
|
||||
type IndexPatternMockSpec = Pick<DataView, 'id' | 'title' | 'type' | 'timeFieldName'> & {
|
||||
fields: FieldSpec[];
|
||||
};
|
||||
|
||||
|
@ -71,8 +65,8 @@ export const createIndexPatternsMock = (
|
|||
asyncDelay: number,
|
||||
indexPatterns: IndexPatternMock[]
|
||||
): {
|
||||
getIdsWithTitle: IndexPatternsContract['getIdsWithTitle'];
|
||||
get: (...args: Parameters<IndexPatternsContract['get']>) => Promise<IndexPatternMock>;
|
||||
getIdsWithTitle: DataViewsContract['getIdsWithTitle'];
|
||||
get: (...args: Parameters<DataViewsContract['get']>) => Promise<IndexPatternMock>;
|
||||
} => {
|
||||
return {
|
||||
async getIdsWithTitle(_refresh?: boolean) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { estypes } from '@elastic/elasticsearch';
|
||||
import { IndexPattern, IndexPatternsContract } from '../../../../../src/plugins/data/common';
|
||||
import { DataView, DataViewsContract } from '../../../../../src/plugins/data_views/common';
|
||||
import { ObjectEntries } from '../utility_types';
|
||||
import { ResolveLogSourceConfigurationError } from './errors';
|
||||
import {
|
||||
|
@ -21,14 +21,14 @@ export interface ResolvedLogSourceConfiguration {
|
|||
timestampField: string;
|
||||
tiebreakerField: string;
|
||||
messageField: string[];
|
||||
fields: IndexPattern['fields'];
|
||||
fields: DataView['fields'];
|
||||
runtimeMappings: estypes.MappingRuntimeFields;
|
||||
columns: LogSourceColumnConfiguration[];
|
||||
}
|
||||
|
||||
export const resolveLogSourceConfiguration = async (
|
||||
sourceConfiguration: LogSourceConfigurationProperties,
|
||||
indexPatternsService: IndexPatternsContract
|
||||
indexPatternsService: DataViewsContract
|
||||
): Promise<ResolvedLogSourceConfiguration> => {
|
||||
if (sourceConfiguration.logIndices.type === 'index_name') {
|
||||
return await resolveLegacyReference(sourceConfiguration, indexPatternsService);
|
||||
|
@ -39,7 +39,7 @@ export const resolveLogSourceConfiguration = async (
|
|||
|
||||
const resolveLegacyReference = async (
|
||||
sourceConfiguration: LogSourceConfigurationProperties,
|
||||
indexPatternsService: IndexPatternsContract
|
||||
indexPatternsService: DataViewsContract
|
||||
): Promise<ResolvedLogSourceConfiguration> => {
|
||||
if (sourceConfiguration.logIndices.type !== 'index_name') {
|
||||
throw new Error('This function can only resolve legacy references');
|
||||
|
@ -74,7 +74,7 @@ const resolveLegacyReference = async (
|
|||
|
||||
const resolveKibanaIndexPatternReference = async (
|
||||
sourceConfiguration: LogSourceConfigurationProperties,
|
||||
indexPatternsService: IndexPatternsContract
|
||||
indexPatternsService: DataViewsContract
|
||||
): Promise<ResolvedLogSourceConfiguration> => {
|
||||
if (sourceConfiguration.logIndices.type !== 'index_pattern') {
|
||||
throw new Error('This function can only resolve Kibana Index Pattern references');
|
||||
|
@ -103,7 +103,7 @@ const resolveKibanaIndexPatternReference = async (
|
|||
};
|
||||
|
||||
// this might take other sources of runtime fields into account in the future
|
||||
const resolveRuntimeMappings = (indexPattern: IndexPattern): estypes.MappingRuntimeFields => {
|
||||
const resolveRuntimeMappings = (indexPattern: DataView): estypes.MappingRuntimeFields => {
|
||||
const { runtimeFields } = indexPattern.getComputedFields();
|
||||
|
||||
const runtimeMappingsFromIndexPattern = (
|
||||
|
|
|
@ -9,7 +9,7 @@ import { mountWithIntl, nextTick } from '@kbn/test/jest';
|
|||
// We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock`
|
||||
import { coreMock as mockCoreMock } from 'src/core/public/mocks';
|
||||
import { MetricExpression } from '../types';
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { MetricsSourceConfiguration } from '../../../../common/metrics_sources';
|
||||
import React from 'react';
|
||||
import { ExpressionChart } from './expression_chart';
|
||||
|
@ -40,7 +40,7 @@ jest.mock('../hooks/use_metrics_explorer_chart_data', () => ({
|
|||
|
||||
describe('ExpressionChart', () => {
|
||||
async function setup(expression: MetricExpression, filterQuery?: string, groupBy?: string) {
|
||||
const derivedIndexPattern: IIndexPattern = {
|
||||
const derivedIndexPattern: DataViewBase = {
|
||||
title: 'metricbeat-*',
|
||||
fields: [],
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Axis, Chart, niceTimeFormatter, Position, Settings } from '@elastic/cha
|
|||
import { first, last } from 'lodash';
|
||||
import { EuiText } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { MetricsSourceConfiguration } from '../../../../common/metrics_sources';
|
||||
import { Color } from '../../../../common/color_palette';
|
||||
import { MetricsExplorerRow, MetricsExplorerAggregation } from '../../../../common/http_api';
|
||||
|
@ -34,7 +34,7 @@ import { ThresholdAnnotations } from '../../common/criterion_preview_chart/thres
|
|||
|
||||
interface Props {
|
||||
expression: MetricExpression;
|
||||
derivedIndexPattern: IIndexPattern;
|
||||
derivedIndexPattern: DataViewBase;
|
||||
source: MetricsSourceConfiguration | null;
|
||||
filterQuery?: string;
|
||||
groupBy?: string | string[];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { useMemo } from 'react';
|
||||
import { MetricsSourceConfiguration } from '../../../../common/metrics_sources';
|
||||
import { MetricExpression } from '../types';
|
||||
|
@ -14,7 +14,7 @@ import { useMetricsExplorerData } from '../../../pages/metrics/metrics_explorer/
|
|||
|
||||
export const useMetricsExplorerChartData = (
|
||||
expression: MetricExpression,
|
||||
derivedIndexPattern: IIndexPattern,
|
||||
derivedIndexPattern: DataViewBase,
|
||||
source: MetricsSourceConfiguration | null,
|
||||
filterQuery?: string,
|
||||
groupBy?: string | string[]
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
import createContainer from 'constate';
|
||||
import { useCallback, useState } from 'react';
|
||||
import useDebounce from 'react-use/lib/useDebounce';
|
||||
import { esQuery, IIndexPattern, Query } from '../../../../../../../src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { esQuery, Query } from '../../../../../../../src/plugins/data/public';
|
||||
|
||||
type ParsedQuery = ReturnType<typeof esQuery.buildEsQuery>;
|
||||
|
||||
|
@ -33,7 +34,7 @@ const initialLogFilterState: ILogFilterState = {
|
|||
|
||||
const validationDebounceTimeout = 1000; // milliseconds
|
||||
|
||||
export const useLogFilterState = ({ indexPattern }: { indexPattern: IIndexPattern }) => {
|
||||
export const useLogFilterState = ({ indexPattern }: { indexPattern: DataViewBase }) => {
|
||||
const [logFilterState, setLogFilterState] = useState<ILogFilterState>(initialLogFilterState);
|
||||
|
||||
const parseQuery = useCallback(
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import createContainer from 'constate';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import type { HttpHandler } from 'src/core/public';
|
||||
import { IndexPatternsContract } from '../../../../../../../src/plugins/data/common';
|
||||
import { DataViewsContract } from '../../../../../../../src/plugins/data_views/public';
|
||||
import {
|
||||
LogIndexField,
|
||||
LogSourceConfigurationPropertiesPatch,
|
||||
|
@ -42,7 +42,7 @@ export const useLogSource = ({
|
|||
}: {
|
||||
sourceId: string;
|
||||
fetch: HttpHandler;
|
||||
indexPatternsService: IndexPatternsContract;
|
||||
indexPatternsService: DataViewsContract;
|
||||
}) => {
|
||||
const [sourceConfiguration, setSourceConfiguration] = useState<
|
||||
LogSourceConfiguration | undefined
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { QuerySuggestion, IIndexPattern, DataPublicPluginStart } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { QuerySuggestion, DataPublicPluginStart } from 'src/plugins/data/public';
|
||||
import {
|
||||
withKibana,
|
||||
KibanaReactContextValue,
|
||||
|
@ -21,7 +22,7 @@ interface WithKueryAutocompletionLifecycleProps {
|
|||
loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void;
|
||||
suggestions: QuerySuggestion[];
|
||||
}>;
|
||||
indexPattern: IIndexPattern;
|
||||
indexPattern: DataViewBase;
|
||||
}
|
||||
|
||||
interface WithKueryAutocompletionLifecycleState {
|
||||
|
@ -82,6 +83,7 @@ class WithKueryAutocompletionComponent extends React.Component<
|
|||
query: expression,
|
||||
selectionStart: cursorPosition,
|
||||
selectionEnd: cursorPosition,
|
||||
// @ts-expect-error (until data service updates to new types)
|
||||
indexPatterns: [indexPattern],
|
||||
boolFilter: [],
|
||||
})) || [];
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import React, { useContext } from 'react';
|
||||
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import {
|
||||
MetricsSourceConfigurationProperties,
|
||||
PartialMetricsSourceConfigurationProperties,
|
||||
|
@ -21,7 +21,7 @@ interface WithSourceProps {
|
|||
create: (
|
||||
sourceProperties: PartialMetricsSourceConfigurationProperties
|
||||
) => Promise<any> | undefined;
|
||||
createDerivedIndexPattern: (type: 'metrics') => IIndexPattern;
|
||||
createDerivedIndexPattern: (type: 'metrics') => DataViewBase;
|
||||
exists?: boolean;
|
||||
hasFailed: boolean;
|
||||
isLoading: boolean;
|
||||
|
|
|
@ -10,23 +10,16 @@ import { from, of } from 'rxjs';
|
|||
import { delay } from 'rxjs/operators';
|
||||
import { CoreStart } from '../../../../../src/core/public';
|
||||
import { FieldSpec } from '../../../../../src/plugins/data/common';
|
||||
import {
|
||||
IIndexPattern,
|
||||
IndexPattern,
|
||||
IndexPatternField,
|
||||
IndexPatternsContract,
|
||||
} from '../../../../../src/plugins/data/public';
|
||||
import { DataView, DataViewsContract } from '../../../../../src/plugins/data_views/public';
|
||||
import { DataViewField } from '../../../../../src/plugins/data_views/common';
|
||||
import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
|
||||
import { Pick2 } from '../../common/utility_types';
|
||||
|
||||
type MockIndexPattern = Pick<
|
||||
IndexPattern,
|
||||
DataView,
|
||||
'id' | 'title' | 'type' | 'getTimeField' | 'isTimeBased' | 'getFieldByName' | 'getComputedFields'
|
||||
>;
|
||||
export type MockIndexPatternSpec = Pick<
|
||||
IIndexPattern,
|
||||
'id' | 'title' | 'type' | 'timeFieldName'
|
||||
> & {
|
||||
export type MockIndexPatternSpec = Pick<DataView, 'id' | 'title' | 'type' | 'timeFieldName'> & {
|
||||
fields: FieldSpec[];
|
||||
};
|
||||
|
||||
|
@ -59,8 +52,8 @@ export const createIndexPatternsMock = (
|
|||
asyncDelay: number,
|
||||
indexPatterns: MockIndexPattern[]
|
||||
): {
|
||||
getIdsWithTitle: IndexPatternsContract['getIdsWithTitle'];
|
||||
get: (...args: Parameters<IndexPatternsContract['get']>) => Promise<MockIndexPattern>;
|
||||
getIdsWithTitle: DataViewsContract['getIdsWithTitle'];
|
||||
get: (...args: Parameters<DataViewsContract['get']>) => Promise<MockIndexPattern>;
|
||||
} => {
|
||||
return {
|
||||
async getIdsWithTitle(_refresh?: boolean) {
|
||||
|
@ -85,7 +78,7 @@ export const createIndexPatternMock = ({
|
|||
fields,
|
||||
timeFieldName,
|
||||
}: MockIndexPatternSpec): MockIndexPattern => {
|
||||
const indexPatternFields = fields.map((fieldSpec) => new IndexPatternField(fieldSpec));
|
||||
const indexPatternFields = fields.map((fieldSpec) => new DataViewField(fieldSpec));
|
||||
|
||||
return {
|
||||
id,
|
||||
|
|
|
@ -131,6 +131,7 @@ const defaultArgs: IndicesConfigurationPanelStoryArgs = {
|
|||
id: 'INDEX_PATTERN_A',
|
||||
title: 'pattern-a-*',
|
||||
timeFieldName: '@timestamp',
|
||||
type: undefined,
|
||||
fields: [
|
||||
{
|
||||
name: '@timestamp',
|
||||
|
@ -149,6 +150,8 @@ const defaultArgs: IndicesConfigurationPanelStoryArgs = {
|
|||
{
|
||||
id: 'INDEX_PATTERN_B',
|
||||
title: 'pattern-b-*',
|
||||
timeFieldName: '@timestamp',
|
||||
type: undefined,
|
||||
fields: [],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IndexPattern, KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public';
|
||||
import { DataView } from '../../../../../../../src/plugins/data_views/public';
|
||||
import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public';
|
||||
|
||||
export interface GenericValidationError {
|
||||
type: 'generic';
|
||||
|
@ -67,7 +68,7 @@ export const validateStringNotEmpty = (fieldName: string, value: string): FormVa
|
|||
export const validateColumnListNotEmpty = (columns: unknown[]): FormValidationError[] =>
|
||||
columns.length <= 0 ? [{ type: 'empty_column_list' }] : [];
|
||||
|
||||
export const validateIndexPattern = (indexPattern: IndexPattern): FormValidationError[] => {
|
||||
export const validateIndexPattern = (indexPattern: DataView): FormValidationError[] => {
|
||||
return [
|
||||
...validateIndexPatternIsTimeBased(indexPattern),
|
||||
...validateIndexPatternHasStringMessageField(indexPattern),
|
||||
|
@ -75,9 +76,7 @@ export const validateIndexPattern = (indexPattern: IndexPattern): FormValidation
|
|||
];
|
||||
};
|
||||
|
||||
export const validateIndexPatternIsTimeBased = (
|
||||
indexPattern: IndexPattern
|
||||
): FormValidationError[] =>
|
||||
export const validateIndexPatternIsTimeBased = (indexPattern: DataView): FormValidationError[] =>
|
||||
indexPattern.isTimeBased()
|
||||
? []
|
||||
: [
|
||||
|
@ -88,7 +87,7 @@ export const validateIndexPatternIsTimeBased = (
|
|||
];
|
||||
|
||||
export const validateIndexPatternHasStringMessageField = (
|
||||
indexPattern: IndexPattern
|
||||
indexPattern: DataView
|
||||
): FormValidationError[] => {
|
||||
const messageField = indexPattern.getFieldByName('message');
|
||||
|
||||
|
@ -111,7 +110,7 @@ export const validateIndexPatternHasStringMessageField = (
|
|||
}
|
||||
};
|
||||
|
||||
export const validateIndexPatternIsntRollup = (indexPattern: IndexPattern): FormValidationError[] =>
|
||||
export const validateIndexPatternIsntRollup = (indexPattern: DataView): FormValidationError[] =>
|
||||
indexPattern.type != null
|
||||
? [
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ import React, { useContext } from 'react';
|
|||
import { Route, RouteComponentProps, Switch } from 'react-router-dom';
|
||||
|
||||
import { EuiErrorBoundary, EuiHeaderLinks, EuiHeaderLink } from '@elastic/eui';
|
||||
import { IIndexPattern } from 'src/plugins/data/common';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { MetricsSourceConfigurationProperties } from '../../../common/metrics_sources';
|
||||
import { DocumentTitle } from '../../components/document_title';
|
||||
import { HelpCenterContent } from '../../components/help_center_content';
|
||||
|
@ -141,7 +141,7 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => {
|
|||
|
||||
const PageContent = (props: {
|
||||
configuration: MetricsSourceConfigurationProperties;
|
||||
createDerivedIndexPattern: (type: 'metrics') => IIndexPattern;
|
||||
createDerivedIndexPattern: (type: 'metrics') => DataViewBase;
|
||||
}) => {
|
||||
const { createDerivedIndexPattern, configuration } = props;
|
||||
const { options } = useContext(MetricsExplorerOptionsContainer.Context);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { EuiFlexItem } from '@elastic/eui';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { useSourceContext } from '../../../../../containers/metrics_source';
|
||||
import {
|
||||
SnapshotMetricInput,
|
||||
|
@ -18,13 +19,12 @@ import { findToolbar } from '../../../../../../common/inventory_models/toolbars'
|
|||
import { ToolbarWrapper } from './toolbar_wrapper';
|
||||
|
||||
import { InfraGroupByOptions } from '../../../../../lib/lib';
|
||||
import { IIndexPattern } from '../../../../../../../../../src/plugins/data/public';
|
||||
import { InventoryItemType } from '../../../../../../common/inventory_models/types';
|
||||
import { WaffleOptionsState, WaffleSortOption } from '../../hooks/use_waffle_options';
|
||||
import { useInventoryMeta } from '../../hooks/use_inventory_meta';
|
||||
|
||||
export interface ToolbarProps extends Omit<WaffleOptionsState, 'boundsOverride' | 'autoBounds'> {
|
||||
createDerivedIndexPattern: (type: 'metrics') => IIndexPattern;
|
||||
createDerivedIndexPattern: (type: 'metrics') => DataViewBase;
|
||||
changeMetric: (payload: SnapshotMetricInput) => void;
|
||||
changeGroupBy: (payload: SnapshotGroupBy) => void;
|
||||
changeCustomOptions: (payload: InfraGroupByOptions[]) => void;
|
||||
|
|
|
@ -8,13 +8,10 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { WithKueryAutocompletion } from '../../../../containers/with_kuery_autocompletion';
|
||||
import { AutocompleteField } from '../../../../components/autocomplete_field';
|
||||
import {
|
||||
esKuery,
|
||||
IIndexPattern,
|
||||
QuerySuggestion,
|
||||
} from '../../../../../../../../src/plugins/data/public';
|
||||
import { esKuery, QuerySuggestion } from '../../../../../../../../src/plugins/data/public';
|
||||
|
||||
type LoadSuggestionsFn = (
|
||||
e: string,
|
||||
|
@ -25,7 +22,7 @@ type LoadSuggestionsFn = (
|
|||
export type CurryLoadSuggestionsType = (loadSuggestions: LoadSuggestionsFn) => LoadSuggestionsFn;
|
||||
|
||||
interface Props {
|
||||
derivedIndexPattern: IIndexPattern;
|
||||
derivedIndexPattern: DataViewBase;
|
||||
onSubmit: (query: string) => void;
|
||||
onChange?: (query: string) => void;
|
||||
value?: string | null;
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
import { EuiFlexGroup, EuiFlexItem, EuiSuperDatePicker, EuiText } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
import { IIndexPattern, UI_SETTINGS } from '../../../../../../../../src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/public';
|
||||
import {
|
||||
MetricsExplorerMetric,
|
||||
MetricsExplorerAggregation,
|
||||
|
@ -27,7 +28,7 @@ import { useKibanaUiSetting } from '../../../../utils/use_kibana_ui_setting';
|
|||
import { mapKibanaQuickRangesToDatePickerRanges } from '../../../../utils/map_timepicker_quickranges_to_datepicker_ranges';
|
||||
|
||||
interface Props {
|
||||
derivedIndexPattern: IIndexPattern;
|
||||
derivedIndexPattern: DataViewBase;
|
||||
timeRange: MetricsExplorerTimeOptions;
|
||||
options: MetricsExplorerOptions;
|
||||
chartOptions: MetricsExplorerChartOptions;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { useState, useCallback, useContext } from 'react';
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { MetricsSourceConfigurationProperties } from '../../../../../common/metrics_sources';
|
||||
import {
|
||||
MetricsExplorerMetric,
|
||||
|
@ -29,7 +29,7 @@ export interface MetricExplorerViewState {
|
|||
|
||||
export const useMetricsExplorerState = (
|
||||
source: MetricsSourceConfigurationProperties,
|
||||
derivedIndexPattern: IIndexPattern,
|
||||
derivedIndexPattern: DataViewBase,
|
||||
shouldLoadImmediately = true
|
||||
) => {
|
||||
const [refreshSignal, setRefreshSignal] = useState(0);
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
createSeries,
|
||||
} from '../../../../utils/fixtures/metrics_explorer';
|
||||
import { MetricsExplorerOptions, MetricsExplorerTimeOptions } from './use_metrics_explorer_options';
|
||||
import { IIndexPattern } from '../../../../../../../../src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { HttpHandler } from 'kibana/public';
|
||||
import { MetricsSourceConfigurationProperties } from '../../../../../common/metrics_sources';
|
||||
|
||||
|
@ -39,7 +39,7 @@ const renderUseMetricsExplorerDataHook = () => {
|
|||
(props: {
|
||||
options: MetricsExplorerOptions;
|
||||
source: MetricsSourceConfigurationProperties | undefined;
|
||||
derivedIndexPattern: IIndexPattern;
|
||||
derivedIndexPattern: DataViewBase;
|
||||
timeRange: MetricsExplorerTimeOptions;
|
||||
afterKey: string | null | Record<string, string | null>;
|
||||
signal: any;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import DateMath from '@elastic/datemath';
|
||||
import { isEqual } from 'lodash';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { MetricsSourceConfigurationProperties } from '../../../../../common/metrics_sources';
|
||||
import {
|
||||
MetricsExplorerResponse,
|
||||
|
@ -27,7 +27,7 @@ function isSameOptions(current: MetricsExplorerOptions, next: MetricsExplorerOpt
|
|||
export function useMetricsExplorerData(
|
||||
options: MetricsExplorerOptions,
|
||||
source: MetricsSourceConfigurationProperties | undefined,
|
||||
derivedIndexPattern: IIndexPattern,
|
||||
derivedIndexPattern: DataViewBase,
|
||||
timerange: MetricsExplorerTimeOptions,
|
||||
afterKey: string | null | Record<string, string | null>,
|
||||
signal: any,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { EuiErrorBoundary } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useEffect, useContext } from 'react';
|
||||
import { IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { MetricsSourceConfigurationProperties } from '../../../../common/metrics_sources';
|
||||
import { useTrackPageview } from '../../../../../observability/public';
|
||||
import { useMetricsBreadcrumbs } from '../../../hooks/use_metrics_breadcrumbs';
|
||||
|
@ -25,7 +25,7 @@ import { SavedViewsToolbarControls } from '../../../components/saved_views/toolb
|
|||
|
||||
interface MetricsExplorerPageProps {
|
||||
source: MetricsSourceConfigurationProperties;
|
||||
derivedIndexPattern: IIndexPattern;
|
||||
derivedIndexPattern: DataViewBase;
|
||||
}
|
||||
|
||||
export const MetricsExplorerPage = ({ source, derivedIndexPattern }: MetricsExplorerPageProps) => {
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { esKuery, IIndexPattern } from '../../../../../src/plugins/data/public';
|
||||
import { DataViewBase } from '@kbn/es-query';
|
||||
import { esKuery } from '../../../../../src/plugins/data/public';
|
||||
|
||||
export const convertKueryToElasticSearchQuery = (
|
||||
kueryExpression: string,
|
||||
indexPattern: IIndexPattern
|
||||
indexPattern: DataViewBase
|
||||
) => {
|
||||
try {
|
||||
return kueryExpression
|
||||
|
|
|
@ -48,6 +48,7 @@ function setup() {
|
|||
id: 'test-index-pattern',
|
||||
title: 'log-indices-*',
|
||||
timeFieldName: '@timestamp',
|
||||
type: undefined,
|
||||
fields: [
|
||||
{
|
||||
name: 'event.dataset',
|
||||
|
|
|
@ -342,6 +342,7 @@ const createDataPluginMock = (esSearchStrategyMock: ISearchStrategy): any => ({
|
|||
id: 'test-index-pattern',
|
||||
title: 'log-indices-*',
|
||||
timeFieldName: '@timestamp',
|
||||
type: undefined,
|
||||
fields: [
|
||||
{
|
||||
name: 'event.dataset',
|
||||
|
|
|
@ -297,6 +297,7 @@ const createDataPluginMock = (esSearchStrategyMock: ISearchStrategy): any => ({
|
|||
id: 'test-index-pattern',
|
||||
title: 'log-indices-*',
|
||||
timeFieldName: '@timestamp',
|
||||
type: undefined,
|
||||
fields: [
|
||||
{
|
||||
name: 'event.dataset',
|
||||
|
|
Loading…
Reference in a new issue