From 54646146d78965c2f1d67a61a93cc255a822e1d3 Mon Sep 17 00:00:00 2001 From: Coen Warmer Date: Mon, 17 Apr 2023 14:10:59 +0200 Subject: [PATCH] Use Observability Page Template from Observability Shared in Infra (#154778) Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/infra/kibana.jsonc | 16 ++++------------ .../logging/inline_log_view_splash_page.tsx | 2 +- .../infra/public/components/page_template.tsx | 4 ++-- .../components/subscription_splash_content.tsx | 2 +- .../public/pages/link_to/link_to_logs.test.tsx | 2 +- .../logs/log_entry_categories/page_content.tsx | 2 +- .../pages/logs/log_entry_rate/page_content.tsx | 2 +- .../public/pages/logs/shared/page_template.tsx | 4 ++-- .../infra/public/pages/metrics/page_template.tsx | 4 ++-- x-pack/plugins/infra/public/plugin.ts | 2 +- x-pack/plugins/infra/public/types.ts | 6 ++++++ x-pack/plugins/infra/tsconfig.json | 1 + 12 files changed, 23 insertions(+), 24 deletions(-) diff --git a/x-pack/plugins/infra/kibana.jsonc b/x-pack/plugins/infra/kibana.jsonc index e17d5bac5a98f..1243275a4a416 100644 --- a/x-pack/plugins/infra/kibana.jsonc +++ b/x-pack/plugins/infra/kibana.jsonc @@ -7,10 +7,7 @@ "id": "infra", "server": true, "browser": true, - "configPath": [ - "xpack", - "infra" - ], + "configPath": ["xpack", "infra"], "requiredPlugins": [ "alerting", "cases", @@ -21,21 +18,16 @@ "features", "lens", "observability", + "observabilityShared", "ruleRegistry", "security", "share", "triggersActionsUi", "unifiedSearch", "usageCollection", - "visTypeTimeseries", - ], - "optionalPlugins": [ - "spaces", - "ml", - "home", - "embeddable", - "osquery" + "visTypeTimeseries" ], + "optionalPlugins": ["spaces", "ml", "home", "embeddable", "osquery"], "requiredBundles": [ "unifiedSearch", "observability", diff --git a/x-pack/plugins/infra/public/components/logging/inline_log_view_splash_page.tsx b/x-pack/plugins/infra/public/components/logging/inline_log_view_splash_page.tsx index cebe7ea21d9c4..c2df977d972b1 100644 --- a/x-pack/plugins/infra/public/components/logging/inline_log_view_splash_page.tsx +++ b/x-pack/plugins/infra/public/components/logging/inline_log_view_splash_page.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiButton } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { EuiEmptyPrompt } from '@elastic/eui'; import { EuiText } from '@elastic/eui'; import { PageTemplate } from '../page_template'; diff --git a/x-pack/plugins/infra/public/components/page_template.tsx b/x-pack/plugins/infra/public/components/page_template.tsx index 0c5afd09b75f3..9efc29475a611 100644 --- a/x-pack/plugins/infra/public/components/page_template.tsx +++ b/x-pack/plugins/infra/public/components/page_template.tsx @@ -6,13 +6,13 @@ */ import React from 'react'; -import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { useKibanaContextForPlugin } from '../hooks/use_kibana'; export const PageTemplate: React.FC = (pageTemplateProps) => { const { services: { - observability: { + observabilityShared: { navigation: { PageTemplate: Template }, }, }, diff --git a/x-pack/plugins/infra/public/components/subscription_splash_content.tsx b/x-pack/plugins/infra/public/components/subscription_splash_content.tsx index b79e96da61377..593e5e45cb33c 100644 --- a/x-pack/plugins/infra/public/components/subscription_splash_content.tsx +++ b/x-pack/plugins/infra/public/components/subscription_splash_content.tsx @@ -11,7 +11,7 @@ import { EuiText, EuiButton, EuiEmptyPrompt } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { HttpStart } from '@kbn/core/public'; -import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { useTrialStatus } from '../hooks/use_trial_status'; import { LoadingPrompt } from './loading_page'; import { PageTemplate } from './page_template'; diff --git a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx index d3dd705a59811..2ee56c425e680 100644 --- a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx @@ -32,7 +32,7 @@ const renderRoutes = (routes: React.ReactElement) => { logViews: { client: {}, }, - observability: { + observabilityShared: { navigation: { PageTemplate: KibanaPageTemplate, }, diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx index 2f6d37ec8a971..bde85aa99ec7f 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import React, { useCallback, useEffect } from 'react'; -import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { isJobStatusWithResults } from '../../../../common/log_analysis'; import { LoadingPage } from '../../../components/loading_page'; import { diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx index 9a5382cc542e0..1f6fe04e59161 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import React, { memo, useCallback, useEffect } from 'react'; import useInterval from 'react-use/lib/useInterval'; -import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { isJobStatusWithResults } from '../../../../common/log_analysis'; import { LoadingPage } from '../../../components/loading_page'; import { diff --git a/x-pack/plugins/infra/public/pages/logs/shared/page_template.tsx b/x-pack/plugins/infra/public/pages/logs/shared/page_template.tsx index 8ffe09acf950e..2f41987071aa1 100644 --- a/x-pack/plugins/infra/public/pages/logs/shared/page_template.tsx +++ b/x-pack/plugins/infra/public/pages/logs/shared/page_template.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { NoDataConfig } from '@kbn/shared-ux-page-kibana-template'; import { useKibanaContextForPlugin } from '../../../hooks/use_kibana'; @@ -25,7 +25,7 @@ export const LogsPageTemplate: React.FC = ({ }) => { const { services: { - observability: { + observabilityShared: { navigation: { PageTemplate }, }, docLinks, diff --git a/x-pack/plugins/infra/public/pages/metrics/page_template.tsx b/x-pack/plugins/infra/public/pages/metrics/page_template.tsx index 4d4dec50dd74c..2b043cf33a790 100644 --- a/x-pack/plugins/infra/public/pages/metrics/page_template.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/page_template.tsx @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-plugin/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import type { NoDataConfig } from '@kbn/shared-ux-page-kibana-template'; import React from 'react'; import { @@ -26,7 +26,7 @@ export const MetricsPageTemplate: React.FC = ({ }) => { const { services: { - observability: { + observabilityShared: { navigation: { PageTemplate }, }, docLinks, diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts index c40425d745d39..cae0cbd62bae4 100644 --- a/x-pack/plugins/infra/public/plugin.ts +++ b/x-pack/plugins/infra/public/plugin.ts @@ -94,7 +94,7 @@ export class Plugin implements InfraClientPluginClass { { label: 'Metrics Explorer', app: 'metrics', path: '/explorer' }, { label: 'Hosts', isTechnicalPreview: true, app: 'metrics', path: '/hosts' }, ]; - pluginsSetup.observability.navigation.registerSections( + pluginsSetup.observabilityShared.navigation.registerSections( startDep$AndHostViewFlag$.pipe( map( ([ diff --git a/x-pack/plugins/infra/public/types.ts b/x-pack/plugins/infra/public/types.ts index e3e8d1e1c4ba6..0b961e0b8ed36 100644 --- a/x-pack/plugins/infra/public/types.ts +++ b/x-pack/plugins/infra/public/types.ts @@ -27,6 +27,10 @@ import type { ObservabilityPublicSetup, ObservabilityPublicStart, } from '@kbn/observability-plugin/public'; +import type { + ObservabilitySharedPluginSetup, + ObservabilitySharedPluginStart, +} from '@kbn/observability-shared-plugin/public'; // import type { OsqueryPluginStart } from '../../osquery/public'; import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; @@ -61,6 +65,7 @@ export interface InfraClientStartExports { export interface InfraClientSetupDeps { home?: HomePublicPluginSetup; observability: ObservabilityPublicSetup; + observabilityShared: ObservabilitySharedPluginSetup; triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; usageCollection: UsageCollectionSetup; ml: MlPluginSetup; @@ -78,6 +83,7 @@ export interface InfraClientStartDeps { lens: LensPublicStart; ml: MlPluginStart; observability: ObservabilityPublicStart; + observabilityShared: ObservabilitySharedPluginStart; osquery?: unknown; // OsqueryPluginStart; share: SharePluginStart; spaces: SpacesPluginStart; diff --git a/x-pack/plugins/infra/tsconfig.json b/x-pack/plugins/infra/tsconfig.json index 55fefdbe21e54..6d7327a7d9731 100644 --- a/x-pack/plugins/infra/tsconfig.json +++ b/x-pack/plugins/infra/tsconfig.json @@ -60,6 +60,7 @@ "@kbn/shared-ux-router", "@kbn/shared-ux-link-redirect-app", "@kbn/observability-alert-details", + "@kbn/observability-shared-plugin", "@kbn/ui-theme" ], "exclude": ["target/**/*"]