Skip to content

Commit

Permalink
fix circular dep
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Apr 19, 2023
1 parent 3a826af commit eb9f239
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { FieldStatsServices } from '@kbn/unified-field-list-plugin/public';
import { type FieldStatsServices } from '@kbn/unified-field-list-plugin/public';
import { useTimefilter, useTimeRangeUpdates } from '@kbn/ml-date-picker';
import { useDataSource } from '../../hooks/use_data_source';
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import React, { type FC, useCallback, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiComboBox, type EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { type Field } from '@kbn/ml-plugin/common/types/fields';
import { useChangePointDetectionContext } from './change_point_detection_context';
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context';

Expand All @@ -29,7 +28,7 @@ export const MetricFieldSelector: FC<MetricFieldSelectorProps> = React.memo(
return {
value: v.name,
label: v.displayName,
field: { id: v.name, type: v.type } as Field,
field: { id: v.name, type: v.type },
};
});
}, [metricFieldOptions]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import React, { FC, useMemo, useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiComboBox, type EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { type Field } from '@kbn/ml-plugin/common/types/fields';
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context';
import { useChangePointDetectionContext } from './change_point_detection_context';

Expand All @@ -34,7 +33,7 @@ export const SplitFieldSelector: FC<SplitFieldSelectorProps> = React.memo(({ val
...splitFieldsOptions.map((v) => ({
value: v.name,
label: v.displayName,
...(v.name ? { field: { id: v.name, type: v?.type } as Field } : {}),
...(v.name ? { field: { id: v.name, type: v?.type } } : {}),
})),
];
}, [splitFieldsOptions]);
Expand Down
18 changes: 13 additions & 5 deletions x-pack/plugins/aiops/public/hooks/use_aiops_app_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { createContext, useContext } from 'react';
import { createContext, type FC, useContext } from 'react';

import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';

Expand All @@ -15,14 +15,17 @@ import type { ChartsPluginStart } from '@kbn/charts-plugin/public';
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type {
CoreStart,
CoreSetup,
CoreStart,
HttpStart,
IUiSettingsClient,
ThemeServiceStart,
} from '@kbn/core/public';
import type { LensPublicStart } from '@kbn/lens-plugin/public';
import { type GetMlSharedImportsReturnType } from '@kbn/ml-plugin/public';
import { type EuiComboBoxProps } from '@elastic/eui/src/components/combo_box/combo_box';
import { type DataView } from '@kbn/data-views-plugin/common';
import type { FieldStatsProps, FieldStatsServices } from '@kbn/unified-field-list-plugin/public';
import type { TimeRange as TimeRangeMs } from '@kbn/ml-date-picker';

export interface AiopsAppDependencies {
application: CoreStart['application'];
Expand All @@ -39,8 +42,13 @@ export interface AiopsAppDependencies {
lens: LensPublicStart;
// deps for unified field stats
fieldStats?: {
useFieldStatsTrigger: GetMlSharedImportsReturnType['useFieldStatsTrigger'];
FieldStatsFlyoutProvider: GetMlSharedImportsReturnType['FieldStatsFlyoutProvider'];
useFieldStatsTrigger: () => { renderOption: EuiComboBoxProps<string>['renderOption'] };
FieldStatsFlyoutProvider: FC<{
dataView: DataView;
fieldStatsServices: FieldStatsServices;
timeRangeMs?: TimeRangeMs;
dslQuery?: FieldStatsProps['dslQuery'];
}>;
};
}

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/aiops/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@kbn/ml-route-utils",
"@kbn/unified-field-list-plugin",
"@kbn/ml-random-sampler-utils",
"@kbn/ml-plugin",
],
"exclude": [
"target/**/*",
Expand Down

0 comments on commit eb9f239

Please sign in to comment.