diff --git a/x-pack/plugins/ml/public/application/aiops/change_point_detection.tsx b/x-pack/plugins/ml/public/application/aiops/change_point_detection.tsx index 551e19a264463..3919f9f9e5ccd 100644 --- a/x-pack/plugins/ml/public/application/aiops/change_point_detection.tsx +++ b/x-pack/plugins/ml/public/application/aiops/change_point_detection.tsx @@ -51,22 +51,22 @@ export const ChangePointDetectionPage: FC = () => { appDependencies={{ ...pick(services, [ 'application', + 'cases', + 'charts', 'data', + 'embeddable', 'executionContext', - 'charts', 'fieldFormats', 'http', + 'i18n', + 'lens', 'notifications', + 'presentationUtil', 'share', 'storage', + 'theme', 'uiSettings', 'unifiedSearch', - 'theme', - 'lens', - 'presentationUtil', - 'embeddable', - 'cases', - 'i18n', 'usageCollection', ]), fieldStats: { useFieldStatsTrigger, FieldStatsFlyoutProvider }, diff --git a/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx b/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx index 22fd99136d6ab..455ff9bfc1377 100644 --- a/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx +++ b/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx @@ -45,19 +45,19 @@ export const LogCategorizationPage: FC = () => { showFrozenDataTierChoice={showNodeInfo} appDependencies={pick(services, [ 'application', + 'charts', 'data', 'executionContext', - 'charts', 'fieldFormats', 'http', + 'i18n', + 'lens', 'notifications', 'share', 'storage', + 'theme', 'uiSettings', 'unifiedSearch', - 'theme', - 'lens', - 'i18n', ])} /> )} diff --git a/x-pack/plugins/ml/public/application/aiops/log_rate_analysis.tsx b/x-pack/plugins/ml/public/application/aiops/log_rate_analysis.tsx index 6cc12921accad..c20264a129ea3 100644 --- a/x-pack/plugins/ml/public/application/aiops/log_rate_analysis.tsx +++ b/x-pack/plugins/ml/public/application/aiops/log_rate_analysis.tsx @@ -48,19 +48,19 @@ export const LogRateAnalysisPage: FC = () => { showFrozenDataTierChoice={showNodeInfo} appDependencies={pick(services, [ 'application', + 'charts', 'data', 'executionContext', - 'charts', 'fieldFormats', 'http', + 'i18n', + 'lens', 'notifications', 'share', 'storage', + 'theme', 'uiSettings', 'unifiedSearch', - 'theme', - 'lens', - 'i18n', ])} /> )} diff --git a/x-pack/plugins/ml/public/application/app.tsx b/x-pack/plugins/ml/public/application/app.tsx index 843f277c11eb5..449f03d81b9fd 100644 --- a/x-pack/plugins/ml/public/application/app.tsx +++ b/x-pack/plugins/ml/public/application/app.tsx @@ -32,10 +32,11 @@ import { mlApiServicesProvider } from './services/ml_api_service'; import { HttpService } from './services/http_service'; import type { PageDependencies } from './routing/router'; import { EnabledFeaturesContextProvider } from './contexts/ml'; +import type { StartServices } from './contexts/kibana'; export type MlDependencies = Omit< MlSetupDependencies, - 'share' | 'fieldFormats' | 'maps' | 'cases' | 'licensing' + 'share' | 'fieldFormats' | 'maps' | 'cases' | 'licensing' | 'uiActions' > & MlStartDependencies; @@ -78,31 +79,32 @@ const App: FC = ({ coreStart, deps, appMountParams, isServerless, mlFe setBreadcrumbs: coreStart.chrome!.setBreadcrumbs, }; - const services = useMemo(() => { + const services: StartServices = useMemo(() => { return { - kibanaVersion: deps.kibanaVersion, - share: deps.share, + cases: deps.cases, + charts: deps.charts, + contentManagement: deps.contentManagement, + dashboard: deps.dashboard, data: deps.data, dataViewEditor: deps.dataViewEditor, - security: deps.security, - licenseManagement: deps.licenseManagement, - storage: localStorage, - embeddable: deps.embeddable, - maps: deps.maps, - triggersActionsUi: deps.triggersActionsUi, + dataViews: deps.data.dataViews, dataVisualizer: deps.dataVisualizer, - usageCollection: deps.usageCollection, + embeddable: deps.embeddable, fieldFormats: deps.fieldFormats, - dashboard: deps.dashboard, - charts: deps.charts, - cases: deps.cases, - unifiedSearch: deps.unifiedSearch, - licensing: deps.licensing, + kibanaVersion: deps.kibanaVersion, lens: deps.lens, + licenseManagement: deps.licenseManagement, + maps: deps.maps, + presentationUtil: deps.presentationUtil, savedObjectsManagement: deps.savedObjectsManagement, savedSearch: deps.savedSearch, - contentManagement: deps.contentManagement, - presentationUtil: deps.presentationUtil, + security: deps.security, + share: deps.share, + storage: localStorage, + triggersActionsUi: deps.triggersActionsUi, + uiActions: deps.uiActions, + unifiedSearch: deps.unifiedSearch, + usageCollection: deps.usageCollection, ...coreStart, mlServices: getMlGlobalServices(coreStart.http, deps.usageCollection), }; diff --git a/x-pack/plugins/ml/public/application/contexts/kibana/kibana_context.ts b/x-pack/plugins/ml/public/application/contexts/kibana/kibana_context.ts index 3e999cb1d8aa4..29fdc7dc2f5b3 100644 --- a/x-pack/plugins/ml/public/application/contexts/kibana/kibana_context.ts +++ b/x-pack/plugins/ml/public/application/contexts/kibana/kibana_context.ts @@ -10,7 +10,7 @@ import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { CoreStart } from '@kbn/core/public'; import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { useKibana, KibanaReactContextValue } from '@kbn/kibana-react-plugin/public'; -import type { SecurityPluginSetup } from '@kbn/security-plugin/public'; +import type { SecurityPluginStart } from '@kbn/security-plugin/public'; import type { LicenseManagementUIPluginSetup } from '@kbn/license-management-plugin/public'; import type { SharePluginStart } from '@kbn/share-plugin/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; @@ -18,7 +18,6 @@ import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; import type { MapsStartApi } from '@kbn/maps-plugin/public'; import type { DataVisualizerPluginStart } from '@kbn/data-visualizer-plugin/public'; import type { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; -import type { FieldFormatsRegistry } from '@kbn/field-formats-plugin/common'; import type { DashboardStart } from '@kbn/dashboard-plugin/public'; import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; import type { ChartsPluginStart } from '@kbn/charts-plugin/public'; @@ -30,33 +29,34 @@ import type { ContentManagementPublicStart } from '@kbn/content-management-plugi import type { SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/public'; import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public'; import type { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public'; +import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; +import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { MlServicesContext } from '../../app'; interface StartPlugins { + cases?: CasesUiStart; + charts: ChartsPluginStart; + contentManagement: ContentManagementPublicStart; + dashboard: DashboardStart; data: DataPublicPluginStart; dataViewEditor: DataViewEditorStart; dataViews: DataViewsPublicPluginStart; - security?: SecurityPluginSetup; - licenseManagement?: LicenseManagementUIPluginSetup; - share: SharePluginStart; - embeddable: EmbeddableStart; - maps?: MapsStartApi; - triggersActionsUi?: TriggersAndActionsUIPublicPluginStart; dataVisualizer?: DataVisualizerPluginStart; - usageCollection?: UsageCollectionSetup; - fieldFormats: FieldFormatsRegistry; - dashboard: DashboardStart; - spacesApi?: SpacesPluginStart; - charts: ChartsPluginStart; - cases?: CasesUiStart; - unifiedSearch: UnifiedSearchPublicPluginStart; - core: CoreStart; - appName: string; + embeddable: EmbeddableStart; + fieldFormats: FieldFormatsStart; lens: LensPublicStart; + licenseManagement?: LicenseManagementUIPluginSetup; + maps?: MapsStartApi; + presentationUtil: PresentationUtilPluginStart; savedObjectsManagement: SavedObjectsManagementPluginStart; savedSearch: SavedSearchPublicPluginStart; - contentManagement: ContentManagementPublicStart; - presentationUtil: PresentationUtilPluginStart; + security?: SecurityPluginStart; + share: SharePluginStart; + spacesApi?: SpacesPluginStart; + triggersActionsUi?: TriggersAndActionsUIPublicPluginStart; + uiActions: UiActionsStart; + unifiedSearch: UnifiedSearchPublicPluginStart; + usageCollection?: UsageCollectionSetup; } export type StartServices = CoreStart & StartPlugins & { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx index 74ca6037f8a90..e2998651f2c21 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx @@ -19,6 +19,7 @@ import { QueryStringInput } from '@kbn/unified-search-plugin/public'; import { QueryErrorMessage } from '@kbn/ml-error-utils'; import { SEARCH_QUERY_LANGUAGE, SearchQueryLanguage } from '@kbn/ml-query-utils'; +import { PLUGIN_ID } from '../../../../../../../common/constants/app'; import { Dictionary } from '../../../../../../../common/types/common'; import { removeFilterFromQueryString } from '../../../../../explorer/explorer_utils'; import { useMlKibana } from '../../../../../contexts/kibana'; @@ -53,17 +54,8 @@ export const ExplorationQueryBar: FC = ({ ); const { services } = useMlKibana(); - const { - unifiedSearch, - data, - storage, - appName, - notifications, - http, - docLinks, - uiSettings, - dataViews, - } = services; + const { unifiedSearch, data, storage, notifications, http, docLinks, uiSettings, dataViews } = + services; const searchChangeHandler = (q: Query) => setSearchInput(q); @@ -206,7 +198,7 @@ export const ExplorationQueryBar: FC = ({ disableAutoFocus={true} dataTestSubj="mlDFAnalyticsQueryInput" languageSwitcherPopoverAnchorPosition="rightDown" - appName={appName} + appName={PLUGIN_ID} deps={{ unifiedSearch, notifications, diff --git a/x-pack/plugins/ml/public/application/explorer/components/explorer_query_bar/explorer_query_bar.tsx b/x-pack/plugins/ml/public/application/explorer/components/explorer_query_bar/explorer_query_bar.tsx index a98b4dc861a36..9e55ade9f6bd5 100644 --- a/x-pack/plugins/ml/public/application/explorer/components/explorer_query_bar/explorer_query_bar.tsx +++ b/x-pack/plugins/ml/public/application/explorer/components/explorer_query_bar/explorer_query_bar.tsx @@ -15,6 +15,7 @@ import type { DataView } from '@kbn/data-views-plugin/common'; import type { QueryErrorMessage } from '@kbn/ml-error-utils'; import type { InfluencersFilterQuery } from '@kbn/ml-anomaly-utils'; import { SEARCH_QUERY_LANGUAGE } from '@kbn/ml-query-utils'; +import { PLUGIN_ID } from '../../../../../common/constants/app'; import { useAnomalyExplorerContext } from '../../anomaly_explorer_context'; import { useMlKibana } from '../../../contexts/kibana'; @@ -113,7 +114,6 @@ export const ExplorerQueryBar: FC = ({ unifiedSearch, data, storage, - appName, notifications, http, docLinks, @@ -176,7 +176,7 @@ export const ExplorerQueryBar: FC = ({ disableAutoFocus dataTestSubj="explorerQueryInput" languageSwitcherPopoverAnchorPosition="rightDown" - appName={appName} + appName={PLUGIN_ID} deps={{ unifiedSearch, notifications, diff --git a/x-pack/plugins/ml/public/plugin.ts b/x-pack/plugins/ml/public/plugin.ts index 9b9bf6eddada2..c0356b0f40192 100644 --- a/x-pack/plugins/ml/public/plugin.ts +++ b/x-pack/plugins/ml/public/plugin.ts @@ -70,45 +70,45 @@ import type { MlCapabilities } from './shared'; import { ElasticModels } from './application/services/elastic_models_service'; export interface MlStartDependencies { - dataViewEditor: DataViewEditorStart; + cases?: CasesUiStart; + charts: ChartsPluginStart; + contentManagement: ContentManagementPublicStart; + dashboard: DashboardStart; data: DataPublicPluginStart; - unifiedSearch: UnifiedSearchPublicPluginStart; - licensing: LicensingPluginStart; - share: SharePluginStart; - uiActions: UiActionsStart; - spaces?: SpacesPluginStart; - embeddable: EmbeddableStart; - maps?: MapsStartApi; - triggersActionsUi?: TriggersAndActionsUIPublicPluginStart; + dataViewEditor: DataViewEditorStart; dataVisualizer: DataVisualizerPluginStart; + embeddable: EmbeddableStart; fieldFormats: FieldFormatsStart; - dashboard: DashboardStart; - charts: ChartsPluginStart; - lens?: LensPublicStart; - cases?: CasesUiStart; - security: SecurityPluginStart; + lens: LensPublicStart; + licensing: LicensingPluginStart; + maps?: MapsStartApi; + presentationUtil: PresentationUtilPluginStart; savedObjectsManagement: SavedObjectsManagementPluginStart; savedSearch: SavedSearchPublicPluginStart; - contentManagement: ContentManagementPublicStart; - presentationUtil: PresentationUtilPluginStart; + security: SecurityPluginStart; + share: SharePluginStart; + spaces?: SpacesPluginStart; + triggersActionsUi?: TriggersAndActionsUIPublicPluginStart; + uiActions: UiActionsStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } export interface MlSetupDependencies { - maps?: MapsSetupApi; - licensing: LicensingPluginSetup; - management?: ManagementSetup; - licenseManagement?: LicenseManagementUIPluginSetup; - home?: HomePublicPluginSetup; + alerting?: AlertingSetup; + cases?: CasesUiSetup; + dashboard: DashboardSetup; embeddable: EmbeddableSetup; - uiActions: UiActionsSetup; + fieldFormats: FieldFormatsSetup; + home?: HomePublicPluginSetup; kibanaVersion: string; + licenseManagement?: LicenseManagementUIPluginSetup; + licensing: LicensingPluginSetup; + management?: ManagementSetup; + maps?: MapsSetupApi; share: SharePluginSetup; triggersActionsUi?: TriggersAndActionsUIPublicPluginSetup; - alerting?: AlertingSetup; + uiActions: UiActionsSetup; usageCollection?: UsageCollectionSetup; - fieldFormats: FieldFormatsSetup; - dashboard: DashboardSetup; - cases?: CasesUiSetup; } export type MlCoreSetup = CoreSetup; @@ -154,31 +154,31 @@ export class MlPlugin implements Plugin { return renderApp( coreStart, { + cases: pluginsStart.cases, charts: pluginsStart.charts, + contentManagement: pluginsStart.contentManagement, + dashboard: pluginsStart.dashboard, data: pluginsStart.data, dataViewEditor: pluginsStart.dataViewEditor, - unifiedSearch: pluginsStart.unifiedSearch, - dashboard: pluginsStart.dashboard, - share: pluginsStart.share, - security: pluginsStart.security, - licensing: pluginsStart.licensing, - management: pluginsSetup.management, - licenseManagement: pluginsSetup.licenseManagement, - home: pluginsSetup.home, - embeddable: { ...pluginsSetup.embeddable, ...pluginsStart.embeddable }, - maps: pluginsStart.maps, - uiActions: pluginsStart.uiActions, - kibanaVersion: this.initializerContext.env.packageInfo.version, - triggersActionsUi: pluginsStart.triggersActionsUi, dataVisualizer: pluginsStart.dataVisualizer, - usageCollection: pluginsSetup.usageCollection, + embeddable: { ...pluginsSetup.embeddable, ...pluginsStart.embeddable }, fieldFormats: pluginsStart.fieldFormats, + home: pluginsSetup.home, + kibanaVersion: this.initializerContext.env.packageInfo.version, lens: pluginsStart.lens, - cases: pluginsStart.cases, + licenseManagement: pluginsSetup.licenseManagement, + licensing: pluginsStart.licensing, + management: pluginsSetup.management, + maps: pluginsStart.maps, + presentationUtil: pluginsStart.presentationUtil, savedObjectsManagement: pluginsStart.savedObjectsManagement, savedSearch: pluginsStart.savedSearch, - contentManagement: pluginsStart.contentManagement, - presentationUtil: pluginsStart.presentationUtil, + security: pluginsStart.security, + share: pluginsStart.share, + triggersActionsUi: pluginsStart.triggersActionsUi, + uiActions: pluginsStart.uiActions, + unifiedSearch: pluginsStart.unifiedSearch, + usageCollection: pluginsSetup.usageCollection, }, params, this.isServerless,